--- /dev/null
+#!/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 <http://www.gnu.org/licenses/>.
+
+case "$1" in
+ title)
+ ;;
+ css)
+ ;;
+ body)
+cat <<EOF
+Page not found or nevermore<br />
+Quoth the server: 404
+EOF
+ ;;
+esac
+
# You should have received a copy of the GNU Affero General Public License
# along with Serve0. If not, see <http://www.gnu.org/licenses/>.
+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
}
}
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(){