]> git.plutz.net Git - serve0/blobdiff - pages/common.sh
mplayer command line compatibility with older versions
[serve0] / pages / common.sh
index cf054910b384245ec03eed2d6914f2bc13f63030..6b597d5abeb1d6b84cdb4f662462067632ff1fee 100755 (executable)
@@ -40,11 +40,18 @@ taglist=$(
 )
 
 genthumb(){
-  videofile="$(printf %s "$1" |sed -r "s;';'\\'';g")"
-      thumb="$(printf %s "$2" |sed -r "s;';'\\'';g")"
+  videofile="$1"
+  thumb="$2"
 
-  printf '%s\n' "${_EXEC}/helpers/genthumb.sh '$videofile' '$thumb' >/dev/null 2>/dev/null" \
-  | batch
+  nohup nice -10 "${_EXEC}"/helpers/genthumb.sh "$videofile" "$thumb" >/dev/null 2>/dev/null &
+  #printf '%s\n' "${_EXEC}/helpers/genthumb.sh '$videofile' '$thumb' >/dev/null 2>/dev/null" \
+  #| batch
+}
+genmeta(){
+  videofile="$1"
+  meta="$2"
+
+  "${_EXEC}"/helpers/genmeta.sh "$videofile" "$meta" >/dev/null
 }
 
 _printVideo(){
@@ -58,7 +65,7 @@ _printVideo(){
     videofile="${_DATA}/videos/$info"
     thumb="${_DATA}/thumbs/${info}.jpg"
     [ -r "$thumb" ] || genthumb "$videofile" "$thumb"
-    [ -r "$meta"  ] || "${_EXEC}/helpers/genmeta.sh" "$videofile" "$meta" >/dev/null
+    [ -r "$meta"  ] || genmeta "$videofile" "$meta"
 
     head -n1 "$meta" |read length width height filename
     [ -z "$length" ] && length=0
@@ -112,13 +119,16 @@ thumblist() {
       
     genlist \
     | if [ -n "$search" ] ; then
+      debug "Applying search: ${search}"
       xargs -d '\n' printf "${_DATA}/meta/%s.meta\n" \
       | xargs -d '\n' egrep -sil "$search" \
       | sed -r 's;^.*/;;;s;\.meta$;;'
-    elif [ "$filterex" != "q0" ]; then
+    elif [ -n "$filter" ]; then
+      debug "Applying filters: ${filter} ++ ${filterex}"
       xargs -d '\n' printf "${_DATA}/meta/%s.meta\n" \
       | xargs -d '\n' sed -srn ":a;N;2!ba;{${filterex}}"
     else
+      debug "No search or filtering"
       cat
     fi \
     | sed -n "$page,$(($page + $pagesize - 1))p" \