X-Git-Url: http://git.plutz.net/?a=blobdiff_plain;f=pages%2Fplayctl.sh;h=f8247e02d33cbf1278b96ab7c35ee434929dac6b;hb=d716f2ce1fe64cf87f777490315bc51906001c72;hp=7ba717b5f29045911afd4395ec1cfb53cfeb2441;hpb=e5267e1298f4ffec140c5b3ef43be36079e63c3f;p=serve0 diff --git a/pages/playctl.sh b/pages/playctl.sh index 7ba717b..f8247e0 100755 --- a/pages/playctl.sh +++ b/pages/playctl.sh @@ -44,10 +44,10 @@ head -n1 "$meta" |read length width height TITLE debug VIDEO: $video if [ "$_COOKIE[watch]" = raspi ]; then - actionuri='//atoemchen/?action=playctl' - volume="$({ncat atoemchen 80 <<-EOF + actionuri="//${RHOST}:${RPORT}/?action=playctl" + volume="$({ncat "$RHOST" "$RPORT" <<-EOF GET /?action=playctl&api=volume HTTP/1.0${CR} - Host: atoemchen${CR} + Host: ${RHOST}${CR} ${CR} EOF } | sed -r '1,/^\r$/d')" @@ -71,9 +71,9 @@ printf 'Refresh: 1\r\n' progress(){ if [ "$_COOKIE[watch]" = raspi ]; then - { ncat atoemchen 80 <<-EOF + { ncat "$RHOST" "$RPORT" <<-EOF GET /?action=playctl&api=progress HTTP/1.0${CR} - Host: atoemchen${CR} + Host: ${RHOST}${CR} ${CR} EOF } | sed -ur '1,/^\r$/d' @@ -83,10 +83,10 @@ progress(){ [ "$line" = "BREAK" ] && exit 0 printf '%s\n' "$line" done \ - | sed -urn '1~12s;^.* V: *+([0-9]+)(\.[0-9]+) A-V:.*$;\1;p' \ - | while read m; do - [ "$m" != "$previous" ] && printf "%d %d\n" "$(($m * 100 / ${length:--1}))" "$m" - previous="$m" - done - fi + | sed -urn '1~12s;^.* V: *+([0-9]+)(\.[0-9]+) A-V:.*$;\1;p' + fi \ + | while read m; do + [ "$m" != "$previous" ] && printf "%d %d\n" "$(($m * 100 / ${length:--1}))" "$m" + previous="$m" + done }