3 # Copyright 2014 - 2016 Paul Hänsch
5 # This file is part of Serve0.
7 # Serve0 is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU Affero General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
12 # Serve0 is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU Affero General Public License for more details.
17 # You should have received a copy of the GNU Affero General Public License
18 # along with Serve0. If not, see <http://www.gnu.org/licenses/>.
22 order="${_GET[o]}" #validated
23 page="${_GET[pn]}" #validated
24 pagesize="${_COOKIE[pagesize]}" #validated
28 [ -n "$info" ] && page_link="${page_link}i=$(urlsafe "$info")&"
29 [ -n "$order" ] && page_link="${page_link}o=${order}&"
30 [ -n "$search" ] && page_link="${page_link}s=${search}&"
31 [ -n "$filter" ] && page_link="${page_link}f=${filter}&"
32 [ "$page" -le "$pagesize" ] && page_prev="${page_link}pn=1" || page_prev="${page_link}pn=$(($page - $pagesize))"
33 page_next="${page_link}pn=$(($page + $pagesize))"
34 page_this="${page_link}pn=$page"
37 if [ -r ${_DATA}/cache/taglist_set ]; then
38 cat ${_DATA}/cache/taglist_set
40 truncate -s0 ${_DATA}/cache/taglist_set
41 truncate -s0 ${_DATA}/cache/tagnorm
43 ( sed -sn '2s;|;\n;gp' "${_DATA}/meta/"*.meta \
46 ) | while read tag; do
47 if [ "$tag" = "$lasttag" ]; then
48 tagcount=$(( ${tagcount:-0} + 1 ))
50 [ -n "$lasttag" ] && printf '%s\t%s\n' "$tagcount" "$lasttag"
56 | while read x tag; do
57 topcnt=$(grep -c "${tag%%:*}" ${_DATA}/cache/taglist_set)
59 && printf %s\\n "$tag" >>${_DATA}/cache/taglist_set \
60 || printf %s\\n "$tag" >>${_DATA}/cache/tagnorm
63 cat ${_DATA}/cache/taglist_set
64 sort ${_DATA}/cache/tagnorm \
65 | tee -a ${_DATA}/cache/taglist_set
66 rm ${_DATA}/cache/tagnorm
71 if [ -r ${_DATA}/cache/taglist_filter ]; then
72 cat ${_DATA}/cache/taglist_filter
74 truncate -s0 ${_DATA}/cache/taglist_filter
75 truncate -s0 ${_DATA}/cache/tagnorm
77 sed -sn '2s;|;\n;gp' "${_DATA}/meta/"*.meta \
80 cnt="$(grep -cF "$tag" ${_DATA}/meta/recent)"
81 printf '%s\t%s\n' "$cnt" "$tag"
84 | while read x tag; do
85 topcnt=$(grep -c "${tag%%:*}" ${_DATA}/cache/taglist_filter)
87 && printf %s\\n "$tag" >>${_DATA}/cache/taglist_filter \
88 || printf %s\\n "$tag" >>${_DATA}/cache/tagnorm
91 cat ${_DATA}/cache/taglist_filter
92 sort ${_DATA}/cache/tagnorm \
93 | tee -a ${_DATA}/cache/taglist_filter
94 rm ${_DATA}/cache/tagnorm
100 printf %s "$taglist_filter" |sed -rn 's;^([^:]+):.*$;\1;p' |sort -u
107 nohup nice -10 "${_EXEC}"/helpers/genthumb.sh "$videofile" "$thumb" >/dev/null 2>/dev/null &
108 #printf '%s\n' "${_EXEC}/helpers/genthumb.sh '$videofile' '$thumb' >/dev/null 2>/dev/null" \
115 "${_EXEC}"/helpers/genmeta.sh "$videofile" "$meta" >/dev/null