X-Git-Url: http://git.plutz.net/?a=blobdiff_plain;f=pages%2Flist.sh;h=37f764e4bf15979d809a53d3bf91512929574ea7;hb=5667597778145b23dc04aa65e1e9ea3ac0b7fd97;hp=284b9185740897cde272e5cc4776dbc3c9c7d15e;hpb=a71c2f4849203931aa2437e3ff7d8c200c6f5239;p=serve0 diff --git a/pages/list.sh b/pages/list.sh index 284b918..37f764e 100755 --- a/pages/list.sh +++ b/pages/list.sh @@ -73,15 +73,16 @@ _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" < - +
  • + +

    ${htmlinfo}

    ${minutes}min @@ -94,16 +95,16 @@ 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 } selectionlist() { cachebase="?o=${order}&s=${search//\//}&f=${filter//\//}" cache="${_DATA}/cache/${cachebase}" - if [ "$cache" -nt ${_DATA}/videos -a "$cache" -nt ${_DATA}/meta ]; then + if [ -s "$cache" -a "$cache" -nt ${_DATA}/videos -a "$cache" -nt ${_DATA}/meta ]; then cat "$cache" else filterex="s;^([0-9]+\t){3}(.+)\n.*$;\2;p" @@ -140,4 +141,6 @@ thumblist() { done } -pagecount="$(( $(selectionlist | wc -l) / $pagesize + 1 ))" +pagecount() { + printf "$(( $(selectionlist | wc -l) / $pagesize + 1 ))" +}