From 3aace0c1bda8f5f2d5e52024d6643872c5655c6a Mon Sep 17 00:00:00 2001 From: paul Date: Sat, 6 Sep 2014 08:11:24 +0000 Subject: [PATCH] first adaptions svn path=/trunk/; revision=2 --- constants.sh | 4 +++- pages/error.sh | 32 +++++++++++++++++++++++++++++ pages/videoview.sh | 40 +++++++++++++++++++++++------------- templates/filterdiag.html.sh | 2 +- 4 files changed, 62 insertions(+), 16 deletions(-) create mode 100755 pages/error.sh diff --git a/constants.sh b/constants.sh index 84d7c7a..33cce96 100755 --- a/constants.sh +++ b/constants.sh @@ -17,4 +17,6 @@ # You should have received a copy of the GNU Affero General Public License # along with Serve0. If not, see . -_GET['page']=videoview +alias _wiki="stx2any --no-template --link-abbrevs --quote -T html" +_GET["page"]=videoview +pagesize=100 diff --git a/pages/error.sh b/pages/error.sh new file mode 100755 index 0000000..b842cf0 --- /dev/null +++ b/pages/error.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +# Copyright 2014 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 . + +case "$1" in + title) + ;; + css) + ;; + body) +cat < +Quoth the server: 404 +EOF + ;; +esac + diff --git a/pages/videoview.sh b/pages/videoview.sh index 0229b36..7e1d23d 100755 --- a/pages/videoview.sh +++ b/pages/videoview.sh @@ -17,6 +17,13 @@ # You should have received a copy of the GNU Affero General Public License # along with Serve0. If not, see . +info="$_GET[i]" +filter="$_GET[f]" +search="$_GET[s]" +order=$(echo "$_GET[o]" |egrep '^(Name|Date|Length)$') +page=$(echo "$_GET[p]" |egrep '^[0-9]+$') +[ -z "$page" ] && page=0 + filterdiag() { . ${_EXEC}/templates/filterdiag.html.sh } @@ -29,21 +36,26 @@ tagger() { } view() { - meta="${_DATA}/meta/$info.meta" - video="${_DATA}/videos/$info" - #reenc="vp8/$(sed -r 's:^(.*)\.[a-zA-Z0-9]{3,4}$:\1:' <<<"$info" )" - #[ -f "$reenc.mp4" ] && reenc="$reenc.mp4" || reenc="$reenc.mkv" - tags="$(sed -n '2p' "$meta")" - description="$(sed -n '3,$p' "$meta")" - length=0; width=0; height=0; - eval $(mplayer -noconsolecontrols -input file=/dev/null -slave -really-quiet -identify -frames 0 -ao null -vo null "$video" 2>/dev/null |sed -rn 's:ID_VIDEO_WIDTH=(.*):width=\1:p;s:ID_VIDEO_HEIGHT=(.*):height=\1:p;s:ID_LENGTH=(.*)(\..*)$:length=\1:p;') - - taglist=$( - for each in ${_DATA}/meta/*.meta; do - sed -n '2s:|:\n:gp' "$each" - done |sort -u |grep -xv '') - + if [ -n "$info" ]; then + meta="${_DATA}/meta/$info.meta" + video="${_DATA}/videos/$info" + #reenc="${_DATA}/vp8/$(sed -r 's:^(.*)\.[a-zA-Z0-9]{3,4}$:\1:' <<<"$info" )" + #[ -f "$reenc.mp4" ] && reenc="$reenc.mp4" || reenc="$reenc.mkv" + tags="$(sed -n '2p' "$meta")" + description="$(sed -n '3,$p' "$meta")" + length=0; width=0; height=0; + eval $(mplayer -noconsolecontrols -input file=/dev/null -slave -really-quiet -identify -frames 0 -ao null -vo null "$video" 2>/dev/null\ + | sed -rn 's:ID_VIDEO_WIDTH=(.*):width=\1:p;s:ID_VIDEO_HEIGHT=(.*):height=\1:p;s:ID_LENGTH=(.*)(\..*)$:length=\1:p;') + + taglist=$( + [ -r ${_DATA}/cache/taglist ] && cat ${_DATA}/cache/taglist ||\ + for each in ${_DATA}/meta/*.meta; do + sed -n '2s:|:\n:gp' "$each" + done |sort -u |grep -xv '' |tee cache/taglist + ) + . ${_EXEC}/templates/view.html.sh + fi } _printVideo(){ diff --git a/templates/filterdiag.html.sh b/templates/filterdiag.html.sh index f35e15e..006c876 100755 --- a/templates/filterdiag.html.sh +++ b/templates/filterdiag.html.sh @@ -62,7 +62,7 @@ cat <

Most recent

- $(uniq meta/recent |tail -n 10 |sed -r 's:^(.*)$:\1
:g') + $(uniq ${_DATA}/meta/recent |tail -n 10 |sed -r 's:^(.*)$:\1
:g') FilterEnd -- 2.39.2