3 . "$_EXEC/indexmeta.sh"
7 local name path length width height tags comment n
9 path="$(HTML "$ITEM/$1")"
11 if [ -d "$_DATA/$ITEM/$1" ]; then
12 printf '[a .list .dir href="%s?%s" %s]' \
13 "$path" "$(HTML "$QUERY_STRING")" "$name"
15 read -r length width height tags comment n <<-EOF
16 $(meta_info "$_DATA/$ITEM/$1")
18 printf '[div .list .file
19 [a href="%s" [img src="%s?a=thumbnail"][label %s]]
20 [span .time %i:%imin] [span .dim %ix%i] %s
21 [checkbox "select" "%s" id="select_%s" form="multitag"][label for="select_%s" +]
23 "$path" "$path" "$name" \
24 "$((length / 60))" "$((length % 60))" \
26 "$(UNSTRING "${tags#tags=}" |tr , '\0' |xargs -r0 printf ' [span .tag %s]')" \
27 "$path" "$path" "$path"
33 find ./ -type d \! -name .index -mindepth 1 -maxdepth 1 \
34 ) | cut -d/ -f2- | sort
37 [ "$FILTER" ] && list_fex="$(
40 | sed -r 's;\^;\n;g; s;[]\/\(\)\\\^\$\?\.\+\*\;\[\{\}];\\&;g' \
42 [ ! "${f#~}" ] && continue
44 && fex="/(\ttags=([^\t]*,)?)(${f})((,[^\t]*)?\t)/{${fex}}" \
45 || fex="/(\ttags=([^\t]*,)?)(${f#~})((,[^\t]*)?\t)/d; ${fex}"
46 printf '%s\n' "${fex}"
52 local meta base f fn file
55 meta_dir "$_DATA/$ITEM/$base"
57 if [ "$FILTER" ]; then
58 sed -nr "$list_fex" "$_DATA/$ITEM/$meta"
59 elif [ "${SEARCH#!}" != "${SEARCH}" ]; then
60 grep -viE "$(STRING "${SEARCH#!}")" "$_DATA/$ITEM/$meta"
62 grep -iE "$(STRING "${SEARCH}")" "$_DATA/$ITEM/$meta"
64 | while f="$(line)"; do
65 fn="$(UNSTRING "${f#* }")"; fn="${fn%${CR}}";
66 file="$(printf '%s\n' "$_DATA/$ITEM/$base/${fn}".*)"
68 [ -e "$_DATA/$ITEM/$base/${file}" ] \
69 && printf '%s %s\n' "${f%% *}" "${base}/${file}"
76 find ./ -path '*/.index/meta'
77 ) | while meta="$(line)"; do
78 list_filemeta "${meta%/.index/meta}"
84 mode="$(COOKIE mode |grep -m1 -xE 'index|browse' || printf browse )"
86 [ "$mode" = browse -a "$ITEM" ] && printf '..\n'
88 if [ "$mode" = browse -a "$ORDER" = Date ]; then
90 list_filemeta . |cut -f2- \
91 | xargs -rd'\n' stat -c '%Y %n' \
92 | sort -rn |cut -d/ -f2-
93 elif [ "$mode" = browse -a "$ORDER" = Name ]; then
96 | sort -k 2 |cut -d/ -f2-
97 elif [ "$mode" = index -a "$ORDER" = Date ]; then
98 list_index |cut -f2- \
99 | xargs -rd'\n' stat -c '%Y %n' \
100 | sort -rn | cut -d/ -f2-
101 elif [ "$mode" = index -a "$ORDER" = Name ]; then
102 list_index | sort -k 2 | cut -d/ -f2-
103 elif [ "$mode" = browse -a "$ORDER" = Length ]; then
106 | sort -n |cut -d/ -f2-
107 elif [ "$mode" = index -a "$ORDER" = Length ]; then
109 | sort -n |cut -d/ -f2-
115 page="$(GET p |grep -xE '[0-9]+' || printf 1)"
117 printf '[div .itemlist '
118 while i="$(line)"; do
120 if [ $c -lt $page ]; then
122 elif [ $c -lt $((LISTSIZE + page)) ]; then
128 printf '[div .pagination'
129 for n in $(seq 1 $((c / LISTSIZE + 1)) ); do
130 printf '[a .page href="%s" %s]' \
131 "?p=$(( (n - 1) * LISTSIZE + 1))" "$n"
136 printf 'Content-Type: text/html;charset=utf-8\r\n\r\n'
138 "$_EXEC/cgilite/html-sh.sed" <<-EOF
140 [html [head [title Listing]
141 [link rel=stylesheet href="/style.css" ]
144 [a #t_bookmarks href="#bookmarks" ★]
146 [a #t_avsearch href="#advsearch" Advanced]
147 [a #t_prefs href="#prefs" ⚙]
152 [form method=POST action="?a=multitag"
157 [a href="#multitag" Add Tags] $(w_tagging)