3 . "$_EXEC/indexmeta.sh"
7 local name path length width height tags comment n
9 path="$(URL "$ITEM/$1")"
10 qry=$(HTML "$QUERY_STRING")
12 if [ -d "$_DATA/$ITEM/$1" ]; then
13 printf '[a .list .dir href="%s" %s]' "${path}?${qry}" "$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
54 meta="$_DATA/$ITEM/$base/.index/meta"
55 meta_dir "$_DATA/$ITEM/$base"
57 if [ $ORDER = Name ]; then
59 elif [ $ORDER = Length ]; then
64 | if [ "$FILTER" ]; then
66 elif [ "${SEARCH#!}" != "${SEARCH}" ]; then
67 grep -viE "$(STRING "${SEARCH#!}")"
69 grep -iE "$(STRING "${SEARCH}")"
72 | while read -r fn; do
73 file="$(printf '%s' "$_DATA/$ITEM/$base/${fn%${CR}}".*)"
75 [ -e "$_DATA/$ITEM/$base/${file}" ] \
76 && printf '%s\n' "${base}/${file}"
83 find ./ -path '*/.index/meta'
84 ) | while meta="$(line)"; do
85 list_filemeta "${meta%/.index/meta}"
91 mode="$(COOKIE mode |grep -m1 -xE 'index|browse' || printf browse )"
93 [ "$mode" = browse -a "$ITEM" ] && printf '..\n'
95 if [ "$mode" = browse -a "$ORDER" = Date ]; then
98 | xargs -rd'\n' stat -c '%Y %n' \
99 | sort -rn |cut -d/ -f2-
100 elif [ "$mode" = browse ]; then
103 elif [ "$mode" = index -a "$ORDER" = Date ]; then
105 | xargs -rd'\n' stat -c '%Y %n' \
106 | sort -rn | cut -d/ -f2-
107 elif [ "$mode" = index ]; then
114 page="$(GET p |grep -xE '[0-9]+' || printf 1)"; c=1
115 end=$((page + LISTSIZE))
117 printf '[div .itemlist '
119 [ $c -ge $page -a $c -lt $end ] \
125 printf '[div .pagination'
126 for n in $( seq 1 $((c / LISTSIZE + 1)) ); do
127 printf '[a .page href="%s" %s]' \
128 "?p=$(( (n - 1) * LISTSIZE + 1))" "$n"
133 printf 'Content-Type: text/html;charset=utf-8\r\n\r\n'
137 [html [head [title Listing]
138 [meta name="viewport" content="width=device-width"]
139 [link rel=stylesheet href="/style.css" ]
142 [a #t_bookmarks href="#bookmarks" ★]'
145 [a #t_avsearch href="#advsearch" Advanced]
146 [a #t_prefs href="#prefs" ⚙]
151 [form method=POST action="?a=multitag"'
156 [a href="#multitag" Add Tags]'
163 '; } | "$_EXEC/cgilite/html-sh.sed"