X-Git-Url: http://git.plutz.net/?a=blobdiff_plain;f=pages%2Fcommon.sh;fp=pages%2Fcommon.sh;h=0000000000000000000000000000000000000000;hb=dfdfcfb7ac57a823e639a19d268436753385cbed;hp=75320556d326e92366c5a86515f067b8d0978be9;hpb=d716f2ce1fe64cf87f777490315bc51906001c72;p=serve0 diff --git a/pages/common.sh b/pages/common.sh deleted file mode 100755 index 7532055..0000000 --- a/pages/common.sh +++ /dev/null @@ -1,116 +0,0 @@ -#!/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 . - -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 -}