git: 9front

Download patch

ref: cebcef9cd131672f088744e19af3eb33197f9e30
parent: ed75773ef33b04d2cb35c6cdfef5794f4fec58e7
author: cinap_lenrek <cinap_lenrek@rei2.9hal>
date: Sat Jan 21 20:12:28 EST 2012

play: add manpage, error reporting

--- a/rc/bin/play
+++ b/rc/bin/play
@@ -31,15 +31,16 @@
 		switch($1){
 		case *plain*
 			sed 's/
//g' | while(j=`{read}){
+				echo $"j >[1=2]
 				if(~ $"j http:* https:* HTTP:* HTTPS:*){
 					if(~ $#typ 0) typ=mp3
-					echo $"j >[1=2]
 					hget -r 'Icy-MetaData: 0' $j | play1 $typ
 				}
 				if not {
-					if(test -r $"j){
-						echo $"j >[1=2]
+					if(test -r $"j)
 						play1 <$"j
+					if not {
+						echo $argv0: 'can''t open file:' $"j >[1=2]
 					}
 				}
 			}
--- /dev/null
+++ b/sys/man/1/play
@@ -1,0 +1,59 @@
+.TH PLAY 1
+.SH NAME
+play \- simple audio player
+.SH SYNOPSIS
+.B play
+[
+.B -o
+.I file
+] [
+.B -t
+.I type
+] [ 
+.I file 
+\&| 
+.I url 
+\&... ]
+.SH DESCRIPTION
+.I Play
+is a simple audio player that understand a number of
+audio and playlist formats.
+.PP
+If no
+.I file
+or
+.I url
+arguments are given, standard input is used.
+Wihout the
+.B -t
+option, the file type is determined using
+.IR file (1)
+command and the appropriate decoder is invoked.
+.PP
+Supported
+.I type
+values are:
+.TP
+.B plain
+Plain text with one file or url per line.
+.TP
+.B pls
+Winamp playlist file.
+.TP
+.B mp3
+Mpeg audio.
+.TP
+.B ogg
+Ogg vorbis.
+.PP
+By default, raw audio data is written to
+.B /dev/audio
+unless changed with the
+.B -o
+option.
+.SH SOURCE
+.B /rc/bin/play
+.SH "SEE ALSO"
+.IR mp3dec (1),
+.IR oggdec (1),
+.IR hget (1)
--