From: paul Date: Sat, 15 Jul 2017 10:55:44 +0000 (+0000) Subject: retain only final dot in fake mp4 file names (e.g. for Android compatibility) X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=c33f3dc315822ac102a7d5783827a5b9a1a4214f;p=serve0 retain only final dot in fake mp4 file names (e.g. for Android compatibility) svn path=/trunk/; revision=186 --- diff --git a/actions/watch.sh b/actions/watch.sh index f796009..4e42ed2 100755 --- a/actions/watch.sh +++ b/actions/watch.sh @@ -21,9 +21,12 @@ 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")" + fi elif [ -n "$foreign" ]; then _COOKIE[watch]=server videourl="${_GET[url]}"