X-Git-Url: http://git.plutz.net/?a=blobdiff_plain;f=pages%2Fplayctl.sh;h=f8247e02d33cbf1278b96ab7c35ee434929dac6b;hb=c59fd5a4946c4d13fc1692e4561878a9bb2b3e17;hp=723d37f8897924b08e1a338f1417f19bd39f7b1f;hpb=ff8b54fea63a05cceab0a2f834f22b0db92e8bdf;p=serve0 diff --git a/pages/playctl.sh b/pages/playctl.sh index 723d37f..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))" "$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 }