]> git.plutz.net Git - serve0/blobdiff - pages/list.sh
styling for pagination links
[serve0] / pages / list.sh
index 7dbe2d0bcfb449e42ebbec44f2008b07bc6850f9..89576f833fe2e04bdc6f9645fe71a07dfbe89511 100755 (executable)
@@ -79,27 +79,47 @@ _printVideo(){
 
     minutes="$(printf "%d:%02d" $(($length / 60)) $(($length % 60)) )"
 
-    tee "$cache" <<VIDEOend
-      <li id="$attrinfo" class="thumb">
-        <button class="watchlink" name="${linkinfo}" formaction="?action=watch&i=${linkinfo}">
-          <img src="$thumb" alt="Preview not yet available">
-        </button>
-        <h2><a href="?action=watch&i=${linkinfo}">${htmlinfo}</a></h2>
-        
-        <input type="checkbox" name="tagsel" value="${htmlinfo}">
-        <span class="info property">${minutes}min</span>
-        <span class="info property">${width}x${height}</span>
-       $(printf %s "$tags" |sed -r 's:\|*([^|]+)\|*: <span class="info tag">\1</span>:g')
-      </li>
+    { tr -d '\n' |tee "$cache"; } <<-VIDEOend
+       <li id="$attrinfo" class="thumb">
+         <button class="watchlink" name="${linkinfo}" formaction="?action=watch&i=${linkinfo}">
+           <img src="$thumb" width="212" height="162" alt="Preview not yet available">
+         </button>
+         <h2><a href="?action=watch&i=${linkinfo}">${htmlinfo}</a></h2>
+         
+         <input type="checkbox" name="tagsel" value="${htmlinfo}">
+         <span class="info property">${minutes}min</span>
+         <span class="info property">${width}x${height}</span>
+         $(printf %s "$tags" |sed -r 's:\|*([^|]+)\|*: <span class="info tag">\1</span>:g')
+       </li>
 VIDEOend
   fi
 }
 
 genlist(){
   case "$order" in
-    Date)   find "${_DATA}"/videos/ -maxdepth 1 -mindepth 1 -printf '%T@ %f\n' |sort -r |cut -d\  -f2- |egrep -i "$file_pattern";;
-    Length) sed -sn 1p "${_DATA}"/meta/*.meta |sort -n |sed -r 's;^[0-9\t]+\t;;';;
-    Name)   find "${_DATA}"/videos/ -maxdepth 1 -mindepth 1 -printf     '%f\n' |sort -f |egrep -i "$file_pattern";;
+    Date)
+      find "${_DATA}"/videos/ -maxdepth 1 -mindepth 1 -printf '%i\t%p\n' \
+      | sort -n \
+      | while read i file; do printf '%s\000' "$file"; done \
+      | xargs -0 stat -c '%Y   %n' \
+      | sort -nr \
+      | cut -f2- \
+      | sed 's;^.*/;;g;' \
+      | egrep -i "$file_pattern"
+      ;;
+    Length)
+      sed -sn 1p "${_DATA}"/meta/*.meta \
+      | sort -n \
+      | sed -r 's;^[0-9\t]+\t;;' \
+      | while read file; do
+        [ -f "${_DATA}/videos/${file}" ] && printf '%s\n' "$file"
+      done
+      ;;
+    Name)
+      find "${_DATA}"/videos/ -maxdepth 1 -mindepth 1 -printf     '%f\n' \
+      | sort -f \
+      | egrep -i "$file_pattern"
+      ;;
   esac
 }