X-Git-Url: http://git.plutz.net/?a=blobdiff_plain;f=actions%2Fwatch.sh;h=1ba0954192943b07529c80d842b9670b3639cdf5;hb=c59fd5a4946c4d13fc1692e4561878a9bb2b3e17;hp=5e0281986541be2e99b7736652e2f1eb9671a22c;hpb=c803beed2a68b45802a3463ac956cbd98496cf95;p=serve0 diff --git a/actions/watch.sh b/actions/watch.sh index 5e02819..1ba0954 100755 --- a/actions/watch.sh +++ b/actions/watch.sh @@ -21,13 +21,18 @@ head -n1 "$meta" |read length width height filename 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")" +if [ "${_COOKIE[fakemp4]}" = yes ]; then + fakename="$(printf %s "${info}" |sed -r 's;.*/;;g; s;.[^.]+$;;; s;\.;_;g;')" + if [ "$info" != "${fakename}.mp4" ]; then + [ -e "${_DATA}/mp4/${fakename}.mp4" ] || ln -s "${_DATA}/videos/$info" "${_DATA}/mp4/${fakename}.mp4" + videourl="$(urlsafe "mp4/${fakename}.mp4")" + else + videourl="$(urlsafe "videos/$info")" + fi elif [ -n "$foreign" ]; then _COOKIE[watch]=server videourl="${_GET[url]}" - watch_link="${_GET[return]}" + watch_link="w=$(urlsafe "${_GET[return]}")" elif [ -z "$info" ]; then videourl="$(urlsafe "${location#/}")" else @@ -36,8 +41,12 @@ fi case "$_COOKIE[watch]" in raspi) - rpiaddr="http://atoemchen.helmchyn.no-ip.biz/?action=watch" - redirect "${rpiaddr}&url=$(urlsafe "http://${HTTP_HOST}/${videourl}")&return=$(urlsafe "http://${HTTP_HOST}/?${_POST[page]}")" + ncat "$RHOST" "$RPORT" >&- <<-EOF + GET /?action=watch&url=$(urlsafe "http://${HTTP_HOST}/${videourl}") HTTP/1.1$(printf \\r) + Host: ${RHOST}$(printf \\r) + $(printf \\r) + EOF + redirect "?p=playctl&${watch_link}w=$(urlsafe "${_POST[page]}#${_GET[i]}")" ;; 480p) [ $height -gt 480 ] && redirect "?action=transcode&i=${linkinfo}&t=480" \