From 287a7f72e4f5ce08b8ce900d5d560219c204541d Mon Sep 17 00:00:00 2001 From: paul Date: Sat, 29 Nov 2014 20:27:14 +0000 Subject: [PATCH] improve save url conversion svn path=/trunk/; revision=25 --- pages/videoview.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pages/videoview.sh b/pages/videoview.sh index fdc19c7..0ec440c 100755 --- a/pages/videoview.sh +++ b/pages/videoview.sh @@ -69,6 +69,8 @@ view() { fi } +alias urlsave="sed 's:%:\%25:g;s:\?:\%3F:g;s:&:\%26:g;s:'\'':\%27:g;s: :\%20:g'" + _printVideo(){ info="$1" cache="${_DATA}/cache/$info.cache" @@ -90,15 +92,15 @@ _printVideo(){ [ -r "$meta" ] || ". ${_EXEC}/helpers/genmeta.sh" "$video" "$meta" [ -r "$thumb" ] || ". ${_EXEC}/helpers/genthumb.sh" "$video" "$thumb" [ -L "$mpfake" ] || ln -s "../videos/$info" "$mpfake" - video="$(echo "videos/$info" |sed 's/\?/\%6F/g;s/&/\%26/g;s/'\''/%27/g')" - thumb="$(echo "thumbs/$info.jpg" |sed 's/\?/%6F/g')" - mpfake="$(echo "$info" |sed -r 's:^(.*)\.[a-zA-Z0-9]{3,4}$:mp4/\1.mp4:' |sed 's/\?/%6F/g')" + video="$(echo "videos/$info" |urlsave)" + thumb="$(echo "thumbs/$info.jpg" |urlsave)" + mpfake="$(echo "$info" |sed -r 's:^(.*)\.[a-zA-Z0-9]{3,4}$:mp4/\1.mp4:' |urlsave)" [ "$(($length % 60))" -lt 10 ] &&\ minutes="$(($length / 60)):0$(($length % 60))" ||\ minutes="$(($length / 60)):$(($length % 60))" - linkinfo="$(echo -n "$info" |sed -r 's:%:%25:g;s:\&:%26:g;')" + linkinfo="$(echo -n "$info" |urlsave)" tee "$cache" < -- 2.39.2