]> git.plutz.net Git - serve0/blobdiff - pages/list.sh
improved browse page (code improvements, page enumeration)
[serve0] / pages / list.sh
index a9eeb331720e45d97c1ce2e8d183287fc12c6c31..37f764e4bf15979d809a53d3bf91512929574ea7 100755 (executable)
@@ -73,11 +73,12 @@ _printVideo(){
     thumb="$(urlsafe "thumbs/$info.jpg")"
     linkinfo="$(urlsafe "$info")"
     htmlinfo="$(htmlsafe "$info")"
+    attrinfo="$(attribsafe "$info")"
 
     minutes="$(printf "%d:%02d" $(($length / 60)) $(($length % 60)) )"
 
     tee "$cache" <<VIDEOend
-      <li class="thumb">
+      <li id="$attrinfo" class="thumb">
         <button class="watchlink" name="${linkinfo}" formaction="?action=watch&i=${linkinfo}">
           <img src="$thumb" alt="Preview not yet available">
         </button>
@@ -94,9 +95,9 @@ VIDEOend
 
 genlist(){
   case "$order" in
-    Date)   ls -c "${_DATA}"/videos/ |egrep -i "$file_pattern";;
+    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)   printf '%s\n' "${_DATA}"/videos/* |sed -r 's;^.*/;;;';;
+    Name)   find "${_DATA}"/videos/ -maxdepth 1 -mindepth 1 -printf     '%f\n' |sort |egrep -i "$file_pattern";;
   esac
 }