[ -n "$filter" ] && watch_link="${watch_link}f=${filter}&"
[ -n "$page" ] && watch_link="${watch_link}p=${page}"
-echo -n "Location: ?${watch_link}\n\n"
+echo -n "Location: ?page=view&${watch_link}\n\n"
# along with Serve0. If not, see <http://www.gnu.org/licenses/>.
alias _wiki="stx2any --no-template --link-abbrevs --quote -T html"
-_GET["page"]=videoview
+[ -z "$_GET[\"page\"]" ] && _GET["page"]=list
pagesize=100
file_pattern='^.*(mov|ts|mpg|mpeg|mp4|m4v|avi|mkv|flv|sfv|wmv|ogm|webm|iso|rmvb)$'
#!/bin/zsh
-# Copyright 2014 Paul Hänsch
+# Copyright 2014, 2015 Paul Hänsch
#
# This file is part of Serve0.
#
# 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 -E "$_GET[\"o\"]" |egrep '^(Name|Date|Length)$')
page_next="${page_link}p=$(($page + 1))"
page_this="${page_link}p=$page"
-
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 ${_DATA}/cache/taglist
)
-
-filterdiag() {
- . ${_EXEC}/templates/filterdiag.html.sh
-}
-
-tagger() {
- n=foot
- hideall="$(sed -rn "s;^([^:]+):.*$;hide_inline('${n}_\\1')\\;;p" <<<"$taglist" |sort -u)hide_inline('${n}_none');"
-
- . ${_EXEC}/templates/tagger.html.sh
-}
-
-view() {
- 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;')
-
- video="videos/$info"
- . ${_EXEC}/templates/view.html.sh
- fi
-}
_printVideo(){
info="$1"
cache="${_DATA}/cache/$info.cache"
- video="${_DATA}/videos/$info"
meta="${_DATA}/meta/$info.meta"
+
if [ "$cache" -nt "$meta" ]; then
cat "$cache"
else
- tags="$(sed -n 2p "$meta")"
+ videofile="${_DATA}/videos/$info"
thumb="${_DATA}/thumbs/$info.jpg"
+ [ -r "$meta" ] || ${_EXEC}/helpers/genmeta.sh "$videofile" "$meta"
+ [ -r "$thumb" ] || ${_EXEC}/helpers/genthumb.sh "$videofile" "$thumb"
+
head -n1 "$meta" |read length width height filename
[ -z "$length" ] && length=0
- [ -z "$width" ] && width=0
+ [ -z "$width" ] && width=0
[ -z "$height" ] && height=0
- [ -r "$meta" ] || ". ${_EXEC}/helpers/genmeta.sh" "$video" "$meta"
- [ -r "$thumb" ] || ". ${_EXEC}/helpers/genthumb.sh" "$video" "$thumb"
+ tags="$(sed -n 2p "$meta")"
video="$(urlsave "videos/$info")"
thumb="$(urlsave "thumbs/$info.jpg")"
+ linkinfo="$(urlsave "$info")"
[ "$(($length % 60))" -lt 10 ] &&\
minutes="$(($length / 60)):0$(($length % 60))" ||\
minutes="$(($length / 60)):$(($length % 60))"
- linkinfo="$(urlsave "$info")"
-
rpiaddr="$(host pfostenpanne |sed -r 's;^.* ([0-9\.]+)$;\1;')"
rpidull="http://${rpiaddr}/?path=http://jupiter:8000/${video}"
rpicgi="http://${rpiaddr}/?path=$(urlsave "http://jupiter:8000/?action=transcode&i=${linkinfo}&t=480")"
_printVideo "$line"
done
}
-
-case "$1" in
- title)
- echo "Videos"
- ;;
- css)
- . ${_EXEC}/templates/videoview.css.sh
- ;;
- body)
- . ${_EXEC}/templates/videoview.html.sh
- ;;
-esac
-# Copyright 2014 Paul Hänsch
+#!/bin/zsh
+
+# Copyright 2014, 2015 Paul Hänsch
#
-# This file is part of Serve0
+# 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
# 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/>.
+# along with Serve0. If not, see <http://www.gnu.org/licenses/>.
-cat <<EOF
- $(filterdiag)
- $(view)
- <form action="?action=multitag&${page_this}" method="post" accept-charset="UTF-8">
- <ul id="thumblist">
- $(thumblist)
- </ul>
- $(tagger)
- </form>
-EOF
+. $_EXEC/pages/common.sh
-# vi:set filetype=html:
+case "$1" in
+ title)
+ echo "Videos"
+ ;;
+ css)
+ . ${_EXEC}/templates/common.css.sh
+ ;;
+ body)
+ . ${_EXEC}/templates/filter.html.sh
+ ;;
+esac
--- /dev/null
+#!/bin/zsh
+
+# Copyright 2014, 2015 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/>.
+
+. $_EXEC/pages/common.sh
+
+case "$1" in
+ title)
+ echo "Videos"
+ ;;
+ css)
+ . ${_EXEC}/templates/common.css.sh
+ ;;
+ body)
+ . ${_EXEC}/templates/list.html.sh
+ ;;
+esac
--- /dev/null
+#!/bin/zsh
+
+# Copyright 2014, 2015 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/>.
+
+. $_EXEC/pages/common.sh
+
+info="$_GET[\"i\"]"
+
+meta="${_DATA}/meta/$info.meta"
+video="${_DATA}/videos/$info"
+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;')
+video="videos/$info"
+
+case "$1" in
+ title)
+ echo "Videos"
+ ;;
+ css)
+ . ${_EXEC}/templates/common.css.sh
+ ;;
+ body)
+ . ${_EXEC}/templates/view.html.sh
+ ;;
+esac
}
#thumblist {
+ width: 100%;
padding: .5em 0 3em 0;
text-align: center;
}
.footer {
position: fixed;
+ min-height: 2em;
bottom: 0px;
border-style: solid none none none;
}
-#!/bin/zsh
+# 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/>.
-cat <<FilterEnd
- <form class="panel" id="search" style="display: block;"
- action="?" method="get" accept-charset="UTF-8">
- <input type="text" name="s" value="$search" placeholder="Search">
-
- <label for="o1" class="order">Order by:</label>
- <select class="order" size="1" name="o" id="o1">
- <option>Name</option>
- <option>Date</option>
- <option>Length</option>
- </select>
- <input type="submit" name="submit" value="Find">
-
- <a class="panel clearsearch" href="?">Clear All</a>
- <a class="panel advanced show" href="#" onclick="javascript:hide('search');show_block('advfilter');">Advanced</a>
-
- <div class="pagination_nav">
- <label>Page:</label>
- <a href="?${page_prev}"><<</a>
- <a href="?${page_this}">$(($page + 1))</a>
- <a href="?${page_next}">>></a>
- </div>
- </form>
-
- <form class="panel" id="advfilter" style="display: none;"
+cat <<EOF
+ <form class="panel" id="advfilter"
action="?action=filter" method="post" accept-charset="UTF-8">
<input disabled type="text" name="s" value="$search" placeholder="Search">
<label for="o2" class="order">Order by:</label>
<input disabled type="submit" name="submit" value="Find">
<a class="panel clearsearch" href="?">Clear All</a>
- <a class="panel advanced hide" href="#"
- onclick="javascript:hide('advfilter');$(for n in {1..9}; do echo "hide('filter$n');"; done)show_block('search')"
- >Hide</a>
+ <a class="panel advanced hide" href="?page=list">Hide</a>
<hr>
<p class="help">Up to <strong>10</strong> filter boxes will appear as you start selecting tags. You can select <strong>multiple</strong> tags in each box by holding down the <strong>Ctrl</strong>-key. Click the "<strong>Filter!</strong>" button when you are ready.</p>
)
</p>
</form>
-FilterEnd
-# vi:set filetype=html:
+ <form>
+ <ul id="thumblist">
+ $(thumblist)
+ </ul>
+ <div class="panel footer" id="foot">
+ <div class="pagination_nav">
+ <label>Page:</label>
+ <a href="?${page_prev}"><<</a>
+ <a href="?${page_this}">$(($page + 1))</a>
+ <a href="?${page_next}">>></a>
+ </div>
+ </div>
+ </form>
+EOF
+
+# vi:set filetype=html:
--- /dev/null
+# Copyright 2014, 2015 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/>.
+
+cat <<EOF
+ <form class="panel" id="search" style="display: block;"
+ action="?" method="get" accept-charset="UTF-8">
+ <input type="text" name="s" value="$search" placeholder="Search">
+
+ <label for="o1" class="order">Order by:</label>
+ <select class="order" size="1" name="o" id="o1">
+ <option>Name</option>
+ <option>Date</option>
+ <option>Length</option>
+ </select>
+ <input type="submit" name="submit" value="Find">
+
+ <a class="panel clearsearch" href="?">Clear All</a>
+ <a class="panel advanced show" href="?page=filter">Advanced</a>
+
+ <div class="pagination_nav">
+ <label>Page:</label>
+ <a href="?${page_prev}"><<</a>
+ <a href="?${page_this}">$(($page + 1))</a>
+ <a href="?${page_next}">>></a>
+ </div>
+ </form>
+
+ <form action="?action=multitag&${page_this}" method="post" accept-charset="UTF-8">
+ <ul id="thumblist">
+ $(thumblist)
+ </ul>
+ <div class="panel footer" id="foot">
+ <a class="panel tagger show" href="#foot" onclick="javascript:hide('foot');show_block('tagger');">Add Tags</a>
+
+ <div class="pagination_nav">
+ <label>Page:</label>
+ <a href="?${page_prev}"><<</a>
+ <a href="?${page_this}">$(($page + 1))</a>
+ <a href="?${page_next}">>></a>
+ </div>
+ </div>
+
+ <div class="panel footer" id="tagger" style="display: none;">
+ <a class="panel tagger hide" href="#"
+ onclick="javascript:hide('tagger');$(for n in $(seq 1 4); do echo "hide('filter$n');"; done)show_block('foot')"
+ >Hide</a>
+ <hr>
+ <p class="help">Add selectetd tags to selected videos.</p>
+ <p class="newtag">
+ <label class="category">None:</label>
+ <select name="ctag" size="12" multiple id="${n}_none">
+ $(echo "$taglist" |sed -rn 's;^([^:]+)$;<option value="\1">\1</option>;p')
+ </select>
+ </p>
+ $(echo "$taglist" |sed -rn 's;^([^:]+):.*$;\1;p' |sort -u |while read cat; do echo "
+ <p class=\"newtag\">
+ <label class=\"category\">${cat}:</label>
+ <input type=\"hidden\" name=\"category\" value=\"$cat\">
+ <select name=\"ctag\" size=\"12\" multiple id=\"${n}_$cat\">
+ $(echo "$taglist" |sed -rn "s;^${cat}:(.*)$;<option value=\"${cat}:\\1\">\\1</option>;p")
+ </select>
+ </p>"
+ done)
+ <p class="newtag additional">
+ <label class="additional">Additional Tags (one per line):</label>
+ <textarea name="tags" rows="2"></textarea>
+ </p>
+ <input type="submit" value="Add Tags!">
+ </div>
+ </form>
+EOF
+
+# vi:set filetype=html:
+++ /dev/null
-#!/bin/zsh
-
-cat <<LOCATIONend
- <div class="panel footer" id="foot">
- <a class="panel tagger show" href="#foot" onclick="javascript:hide('foot');show_block('tagger');">Add Tags</a>
-
- <div class="pagination_nav">
- <label>Page:</label>
- <a href="?${page_prev}"><<</a>
- <a href="?${page_this}">$(($page + 1))</a>
- <a href="?${page_next}">>></a>
- </div>
- </div>
-
-
- <div class="panel footer" id="tagger" style="display: none;">
- <a class="panel tagger hide" href="#"
- onclick="javascript:hide('tagger');$(for n in $(seq 1 4); do echo "hide('filter$n');"; done)show_block('foot')"
- >Hide</a>
- <hr>
- <p class="help">Add selectetd tags to selected videos.</p>
- <p class="newtag">
- <label class="category">None:</label>
- <select name="ctag" size="12" multiple id="${n}_none">
- $(echo "$taglist" |sed -rn 's;^([^:]+)$;<option value="\1">\1</option>;p')
- </select>
- </p>
- $(echo "$taglist" |sed -rn 's;^([^:]+):.*$;\1;p' |sort -u |while read cat; do echo "
- <p class=\"newtag\">
- <label class=\"category\">${cat}:</label>
- <input type=\"hidden\" name=\"category\" value=\"$cat\">
- <select name=\"ctag\" size=\"12\" multiple id=\"${n}_$cat\">
- $(echo "$taglist" |sed -rn "s;^${cat}:(.*)$;<option value=\"${cat}:\\1\">\\1</option>;p")
- </select>
- </p>"
- done)
- <p class="newtag additional">
- <label class="additional">Additional Tags (one per line):</label>
- <textarea name="tags" rows="2"></textarea>
- </p>
- <input type="submit" value="Add Tags!">
- </div>
-LOCATIONend
-
-# vi:set filetype=html:
-
-#!/bin/zsh
+# Copyright 2014, 2015 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/>.
+
+cat <<EOF
+ <form class="panel" id="search" style="display: block;"
+ action="?" method="get" accept-charset="UTF-8">
+ <input type="text" name="s" value="$search" placeholder="Search">
+
+ <label for="o1" class="order">Order by:</label>
+ <select class="order" size="1" name="o" id="o1">
+ <option>Name</option>
+ <option>Date</option>
+ <option>Length</option>
+ </select>
+ <input type="submit" name="submit" value="Find">
+
+ <a class="panel clearsearch" href="?">Clear All</a>
+ <a class="panel advanced show" href="?page=filter">Advanced</a>
+
+ <div class="pagination_nav">
+ <label>Page:</label>
+ <a href="?${page_prev}"><<</a>
+ <a href="?${page_this}">$(($page + 1))</a>
+ <a href="?${page_next}">>></a>
+ </div>
+ </form>
-cat <<viewEND
<div class="panel" id="videoview">
- <a href="#" onclick="javascript:hide('videoview');" class="panel">Dismiss</a>
+ <a href="?page=list" class="panel">Dismiss</a>
<div class="video">
- <a href="$video">Full</a> <!-- a href="$reenc">Mobile</a -->
- <!--iframe src="$video" width="100%" height="400px"-->
+ <a href="$video">Full</a>
<video controls>
- <!-- source src="$reenc" type='video/webm; codecs="vp8.0, mp3"' -->
<source src="$video" type='video/mp4; codecs="avc1.4D401E, mp3"'>"
- </video><!--/iframe-->
+ </video>
</div>
<div class="videoinfo" id="viewmeta">
<!-- input type="submit" name="cancel" value="Cancel" -->
</form>
</div>
-viewEND
-# vi:set filetype=html:
+ <form>
+ <ul id="thumblist">
+ $(thumblist)
+ </ul>
+ <div class="panel footer" id="foot">
+ <div class="pagination_nav">
+ <label>Page:</label>
+ <a href="?${page_prev}"><<</a>
+ <a href="?${page_this}">$(($page + 1))</a>
+ <a href="?${page_next}">>></a>
+ </div>
+ </div>
+ </form>
+EOF
+# vi:set filetype=html: