# You should have received a copy of the GNU Affero General Public License
# along with Serve0. If not, see <http://www.gnu.org/licenses/>.
+
alias _wiki="stx2any --no-template --link-abbrevs --quote -T html"
-[ -z "${_GET[p]}" ] && _GET[p]=list
file_pattern='^.*(mov|ts|mpg|mpeg|mp4|m4v|avi|mkv|flv|sfv|wmv|ogm|webm|iso|rmvb)$'
data_dirs cache meta mp4 videos thumbs trash by_length transcoded
+PAGE="${_GET[p]:-${PAGE:-list}}"
+
cgi_cookie
validate(){ printf '%s\n' "$1" |sed -rn '2q;/^('"$2"')$/{p;q};a'"$3"; }
+++ /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
-
| sed -rn 's;^(0|1) '"$cat"'([^:]+)$;\1 \2;p' \
| sed 's;^0 ;<option>;;s;^1 ;<option selected>;;s;$;</option>;'
}
-
-case "$1" in
- title)
- echo "Videos"
- ;;
- css)
- . ${_EXEC}/templates/common.css.sh
- ;;
- body)
- . ${_EXEC}/templates/list.html.sh
- ;;
-esac
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;')
video="videos/$info"
-
-case "$1" in
- title)
- echo "Videos"
- ;;
- css)
- . ${_EXEC}/templates/common.css.sh
- ;;
- body)
- . ${_EXEC}/templates/view.html.sh
- ;;
-esac
-# Copyright 2014 Paul Hänsch
+# Copyright 2014, 2015 Paul Hänsch
#
# This file is part of Serve0
#
<html>
<head>
<meta name="viewport" content="width=device-width">
- <title>$(. $PAGE title)</title>
+ <title>${PAGE}</title>
<style type="text/css">
<!--
- $(. $PAGE css)
+ $(. "${_EXEC}/templates/common.css.sh")
-->
</style>
</head>
<body>
- $(. $PAGE body)
+ $([ -x "${BODY}" ] && . "${BODY}" || printf %s Error)
</body>
</html>
EOF