]> git.plutz.net Git - serve0/blobdiff - pages/list.sh
retain only final dot in fake mp4 file names (e.g. for Android compatibility)
[serve0] / pages / list.sh
index c376d686194359d617d35237478458e6d3f9a710..7dbe2d0bcfb449e42ebbec44f2008b07bc6850f9 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/zsh
 
-# Copyright 2014 - 2016 Paul Hänsch
+# Copyright 2014 - 2017 Paul Hänsch
 #
 # This file is part of Serve0.
 # 
@@ -17,6 +17,8 @@
 # You should have received a copy of the GNU Affero General Public License
 # along with Serve0.  If not, see <http://www.gnu.org/licenses/>. 
 
+page_link="p=list&"
+
 . $_EXEC/pages/common.sh
 
 LF='
@@ -95,9 +97,9 @@ VIDEOend
 
 genlist(){
   case "$order" in
-    Date)   stat -c '%Y %n' "${_DATA}"/videos/* |sort -r |sed -r 's;^.*/;;;' |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;^.*/;;;' |egrep -i "$file_pattern";;
+    Name)   find "${_DATA}"/videos/ -maxdepth 1 -mindepth 1 -printf     '%f\n' |sort -f |egrep -i "$file_pattern";;
   esac
 }