]> git.plutz.net Git - serve0/commitdiff
retain only final dot in fake mp4 file names (e.g. for Android compatibility)
authorpaul <paul@plutz.net>
Sat, 15 Jul 2017 10:55:44 +0000 (10:55 +0000)
committerpaul <paul@plutz.net>
Sat, 15 Jul 2017 10:55:44 +0000 (10:55 +0000)
svn path=/trunk/; revision=186

actions/watch.sh

index f79600984ad4dc89a4afd57161f3969a88d96431..4e42ed216e65ae3002217b6f6bbc3500cbf79d1c 100755 (executable)
@@ -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]}"