]> git.plutz.net Git - serve0/blobdiff - actions/watch.sh
extending cooperation functions
[serve0] / actions / watch.sh
index e473ac4755d1479bb537272e2972090546effc8a..cc47088c0bebc5e73c1b13895a307db1dd51e896 100755 (executable)
@@ -2,6 +2,7 @@
 
 cgi_refdata
 info="${_GET[i]}"
+watch="${_GET[w]:-${_COOKIE[watch]}}"
 location="$(invalidate "${_GET[l]}" '(.*/)?\.\.(/.*)?|' /)"
 order="${_POST[o]}"
 search="${_POST[s]}"
@@ -33,11 +34,10 @@ else
   videourl="$(urlsafe "videos/$info")"
 fi
 
-case "${_COOKIE[watch]}" in
+case "$watch" in
   raspi)
-    rpiaddr="http://pfostenpanne.helmchyn.no-ip.biz/?player=play&path="
-    [ $height -gt 480 -a $width -gt 480 ] && redirect "${rpiaddr}$(urlsafe "http://jupiter:8000/?action=transcode&i=${linkinfo}&t=480")" \
-                                          || redirect "${rpiaddr}$(urlsafe "http://jupiter:8000/${videourl}")"
+    rpiaddr="http://atoemchen.helmchyn.no-ip.biz/?action=watch&w=server&i="
+    redirect "${rpiaddr}$(urlsafe "http://jupiter:8000/${videourl}")"
   ;;
   480p)
     [ $height -gt 480 ] && redirect "?action=transcode&i=${linkinfo}&t=480" \
@@ -75,18 +75,19 @@ case "${_COOKIE[watch]}" in
     export DISPLAY=":0"
     uid="$(id |sed -rn '1s;.*uid=([0-9]+)[^0-9].*;\1;p')"
     export XDG_RUNTIME_DIR="/run/user/$uid"  # required for Pulseaudio
+    xrandr >/dev/null  # helps enable all screens
 
-    nohup /usr/bin/mplayer -ao pulse \
-      -slave -input file="$fifofile" \
-      -volume "$volume" \
-      "$playuri" >"$statusfile" 2>/dev/null &
-
-    # # MPlayer2:
-    # nohup /usr/bin/mplayer -ao pulse \
-    #   --slave --input=file="$fifofile" \
-    #   --volume="$volume" \
+    # nohup /usr/bin/mplayer \
+    #   -slave -input file="$fifofile" \
+    #   -volume "$volume" \
     #   "$playuri" >"$statusfile" 2>/dev/null &
 
+    # MPlayer2: (statusline on stderr)
+    nohup /usr/bin/mplayer \
+      --slave --input=file="$fifofile" \
+      --volume="$volume" \
+      "$playuri" 2>"$statusfile" >/dev/null &
+
     chmod 600 "$statusfile"
 
     redirect "?p=playctl&${watch_link}"