From c33f3dc315822ac102a7d5783827a5b9a1a4214f Mon Sep 17 00:00:00 2001 From: paul Date: Sat, 15 Jul 2017 10:55:44 +0000 Subject: [PATCH] retain only final dot in fake mp4 file names (e.g. for Android compatibility) svn path=/trunk/; revision=186 --- actions/watch.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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]}" -- 2.39.2