summaryrefslogtreecommitdiff
path: root/rc/bin/play
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@rei2.9hal>2012-02-14 17:29:18 +0100
committercinap_lenrek <cinap_lenrek@rei2.9hal>2012-02-14 17:29:18 +0100
commitac0107ca4234d1c51fcf3c7ae30fc6fde86464ae (patch)
tree505cf18e5268c14b0d385c637ecfba1e574e8073 /rc/bin/play
parenta57ad59bf0af4ff9548e97b94e5461f69b2db12f (diff)
file: mp3 audio data detection by syncword, play: remote -t option as file now works for mp3 streams
Diffstat (limited to 'rc/bin/play')
-rwxr-xr-xrc/bin/play23
1 files changed, 8 insertions, 15 deletions
diff --git a/rc/bin/play b/rc/bin/play
index 0eabc9d9b..f000cd0ea 100755
--- a/rc/bin/play
+++ b/rc/bin/play
@@ -22,9 +22,9 @@ fn sigexit {
fn play1 {
if(~ $#* 0){
- tmp=/tmp/play.$pid.tmp
- dd -bs 64 -count 1 >$tmp >[2]/dev/null
- cat $tmp /fd/0 | play1 `{file -m $tmp} xxx
+ tmp=(/tmp/play.$pid.$#tmp.tmp $tmp)
+ dd -bs 1024 -count 1 >$tmp(1) >[2]/dev/null
+ cat $tmp(1) /fd/0 | play1 `{file -m $tmp(1)} xxx
cleanup
}
if not {
@@ -32,16 +32,12 @@ fn play1 {
case *plain*
sed 's/ //g' | while(j=`{read}){
echo $"j >[1=2]
- t=$typ
if(~ $"j http:* https:* HTTP:* HTTPS:*){
- if(~ $#t 0) t=mp3
- hget -r 'Icy-MetaData: 0' $j | play1 $t
+ hget -r 'Icy-MetaData: 0' $j | play1
}
if not {
- if(test -r $"j){
- if(~ $#t 0 && ~ $"j *mp3*) t=mp3
- play1 $t <$"j
- }
+ if(test -r $"j)
+ play1 <$"j
if not {
echo $argv0: 'can''t open file:' $"j >[1=2]
}
@@ -62,15 +58,12 @@ fn play1 {
}
fn usage {
- echo usage: $argv0 [ -t type ] [-o file ] [ file ... ] >[1=2]
+ echo usage: $argv0 [ -o file ] [ file ... ] >[1=2]
exit usage
}
while(~ $1 -*){
switch($1){
- case -t
- typ=$2
- shift
case -o
out=$2
shift
@@ -81,6 +74,6 @@ while(~ $1 -*){
}
>$out {
- if(~ $#* 0){play1 $typ; exit}
+ if(~ $#* 0){play1; exit}
for(i){echo $i} | play1 plain
}