X-Git-Url: http://git.plutz.net/?a=blobdiff_plain;ds=sidebyside;f=pages%2Flist.sh;h=37f764e4bf15979d809a53d3bf91512929574ea7;hb=dfdaf2aee35b9b1ae112df2828b6ab7fa380a7a8;hp=063bf40893e1b67e74e29ac6f61f6069318eb7dd;hpb=5fcbb630ca5ed443e0cabe0c96a31e14dd413ab3;p=serve0
diff --git a/pages/list.sh b/pages/list.sh
index 063bf40..37f764e 100755
--- a/pages/list.sh
+++ b/pages/list.sh
@@ -39,25 +39,12 @@ else
TITLE="List by $order"
fi
-quicklinks(){
- output=''
- tac ${_DATA}/meta/recent \
- | while [ "$(printf %s "$output" |wc -l)" -lt 10 ] && read line; do
- printf %s "$output" |grep -qF "$line" || output="$output$line$LF"
- done
- printf %s "$output" |while read line; do
- linef=$(printf %s "$line" |sed -r 's;^.*(\?|&)f=([^&]+)&?.*$;\2;g')
- lineo=$(printf %s "$line" |sed -r 's;^.*(\?|&)o=([^&]+)&?.*$;\2;g')
- printf %s "by ${lineo}: $(present_filter "$linef")"
- done
-}
-
category_selected(){
cat="${1}:"
filter="$2"
[ "$cat" = "none:" ] && cat=''
- printf %s "$taglist" \
+ printf %s "$taglist_filter" \
| sed -r 's;^('"$filter"')$;1 &;;t;s;^;0 ;' \
| sed -rn 's;^(0|1) '"$cat"'([^:]+)$;\1 \2;p' \
| sed 's;^0 ;;'
@@ -86,16 +73,16 @@ _printVideo(){
thumb="$(urlsafe "thumbs/$info.jpg")"
linkinfo="$(urlsafe "$info")"
htmlinfo="$(htmlsafe "$info")"
+ attrinfo="$(attribsafe "$info")"
- [ "$(($length % 60))" -lt 10 ] && minutes="$(($length / 60)):0$(($length % 60))" \
- || minutes="$(($length / 60)):$(($length % 60))"
+ minutes="$(printf "%d:%02d" $(($length / 60)) $(($length % 60)) )"
tee "$cache" <
-
+
+
- ${htmlinfo}
+
+
${minutes}min
@@ -108,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"
@@ -154,4 +141,6 @@ thumblist() {
done
}
-pagecount="$(( $(selectionlist | wc -l) / $pagesize + 1 ))"
+pagecount() {
+ printf "$(( $(selectionlist | wc -l) / $pagesize + 1 ))"
+}