X-Git-Url: http://git.plutz.net/?a=blobdiff_plain;f=actions%2Fwatch.sh;h=5b4119f7612f6b51c32f367f9b4655e5d4531be2;hb=7325a10deded9a135b354e77d231a0ab38e13925;hp=e473ac4755d1479bb537272e2972090546effc8a;hpb=0f55cabbc9beca8fce0bddc74f48d4d0fd52250b;p=serve0 diff --git a/actions/watch.sh b/actions/watch.sh index e473ac4..5b4119f 100755 --- a/actions/watch.sh +++ b/actions/watch.sh @@ -3,6 +3,7 @@ cgi_refdata info="${_GET[i]}" location="$(invalidate "${_GET[l]}" '(.*/)?\.\.(/.*)?|' /)" +foreign="$(validate "${_GET[url]}" 'https?://.*' '')" order="${_POST[o]}" search="${_POST[s]}" filter="${_POST[f]}" @@ -27,17 +28,19 @@ linkinfo="$(urlsafe "$info")" if [ "${_COOKIE[fakemp4]}" = yes ] && [ "${info##*.}" != mp4 ]; then [ -e "${_DATA}/videos/${info%.*}.mp4" ] || ln -s "${_DATA}/videos/$info" "${_DATA}/mp4/${info%.*}.mp4" videourl="$(urlsafe "mp4/${info%.*}.mp4")" +elif [ -n "$foreign" ]; then + _COOKIE[watch]=server + videourl="${_GET[url]}" elif [ -z "$info" ]; then videourl="$(urlsafe "${location#/}")" else videourl="$(urlsafe "videos/$info")" fi -case "${_COOKIE[watch]}" in +case "$_COOKIE[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&url=" + redirect "${rpiaddr}$(urlsafe "http://jupiter:8000/${videourl}")" ;; 480p) [ $height -gt 480 ] && redirect "?action=transcode&i=${linkinfo}&t=480" \ @@ -75,18 +78,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}"