+++ /dev/null
-#!/bin/zsh
-
-# Copyright 2014 - 2016 Paul Hänsch
-#
-# This file is part of Serve0.
-#
-# Serve0 is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Serve0 is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with Serve0. If not, see <http://www.gnu.org/licenses/>.
-
-filter="${_GET[f]}"
-search="${_GET[s]}"
-order="${_GET[o]}" #validated
-page="${_GET[pn]}" #validated
-pagesize="${_COOKIE[pagesize]}" #validated
-pagecount=0
-
-#page_link=''
-[ -n "$info" ] && page_link="${page_link}i=$(urlsafe "$info")&"
-[ -n "$order" ] && page_link="${page_link}o=${order}&"
-[ -n "$search" ] && page_link="${page_link}s=${search}&"
-[ -n "$filter" ] && page_link="${page_link}f=${filter}&"
-[ "$page" -le "$pagesize" ] && page_prev="${page_link}pn=1" || page_prev="${page_link}pn=$(($page - $pagesize))"
-page_next="${page_link}pn=$(($page + $pagesize))"
-page_this="${page_link}pn=$page"
-
-taglist_set=$(
- if [ -r ${_DATA}/cache/taglist_set ]; then
- cat ${_DATA}/cache/taglist_set
- else
- truncate -s0 ${_DATA}/cache/taglist_set
- truncate -s0 ${_DATA}/cache/tagnorm
-
- ( sed -sn '2s;|;\n;gp' "${_DATA}/meta/"*.meta \
- | sort
- printf \\n
- ) | while read tag; do
- if [ "$tag" = "$lasttag" ]; then
- tagcount=$(( ${tagcount:-0} + 1 ))
- else
- [ -n "$lasttag" ] && printf '%s\t%s\n' "$tagcount" "$lasttag"
- tagcount=1
- fi
- lasttag="$tag"
- done \
- | sort -rn \
- | while read x tag; do
- topcnt=$(grep -c "${tag%%:*}" ${_DATA}/cache/taglist_set)
- [ $topcnt -lt 10 ] \
- && printf %s\\n "$tag" >>${_DATA}/cache/taglist_set \
- || printf %s\\n "$tag" >>${_DATA}/cache/tagnorm
- done
-
- cat ${_DATA}/cache/taglist_set
- sort ${_DATA}/cache/tagnorm \
- | tee -a ${_DATA}/cache/taglist_set
- rm ${_DATA}/cache/tagnorm
- fi
-)
-
-taglist_filter=$(
- if [ -r ${_DATA}/cache/taglist_filter ]; then
- cat ${_DATA}/cache/taglist_filter
- else
- truncate -s0 ${_DATA}/cache/taglist_filter
- truncate -s0 ${_DATA}/cache/tagnorm
-
- sed -sn '2s;|;\n;gp' "${_DATA}/meta/"*.meta \
- | sort -u \
- | while read tag; do
- cnt="$(grep -cF "$tag" ${_DATA}/meta/recent)"
- printf '%s\t%s\n' "$cnt" "$tag"
- done \
- | sort -rn \
- | while read x tag; do
- topcnt=$(grep -c "${tag%%:*}" ${_DATA}/cache/taglist_filter)
- [ $topcnt -lt 10 ] \
- && printf %s\\n "$tag" >>${_DATA}/cache/taglist_filter \
- || printf %s\\n "$tag" >>${_DATA}/cache/tagnorm
- done
-
- cat ${_DATA}/cache/taglist_filter
- sort ${_DATA}/cache/tagnorm \
- | tee -a ${_DATA}/cache/taglist_filter
- rm ${_DATA}/cache/tagnorm
- fi
-)
-
-list_categories(){
- printf none\\n
- printf %s "$taglist_filter" |sed -rn 's;^([^:]+):.*$;\1;p' |sort -u
-}
-
-genthumb(){
- videofile="$1"
- thumb="$2"
-
- nohup nice -10 "${_EXEC}"/helpers/genthumb.sh "$videofile" "$thumb" >/dev/null 2>/dev/null &
- #printf '%s\n' "${_EXEC}/helpers/genthumb.sh '$videofile' '$thumb' >/dev/null 2>/dev/null" \
- #| batch
-}
-genmeta(){
- videofile="$1"
- meta="$2"
-
- "${_EXEC}"/helpers/genmeta.sh "$videofile" "$meta" >/dev/null
-}