+++ /dev/null
-#!/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 <http://www.gnu.org/licenses/>.
-
-dir="$(dirname $0)"
-genmeta="$dir/genmeta.sh"
-genthumb="$dir/genthumb.sh"
-. "$dir/../constants.sh"
-
-addtag(){
- meta="$1"
- tag="$2"
-
- length=0; width=0; height=0;
- if [ -r "$meta" ]; then
- head -n1 "$meta" |read length width height info
- tags="$(sed -n 2p "$meta" |sed -r 's:^\|(.*)$:\1:')"
- description="$(sed -n '3,$p' "$meta")"
- fi
-
- egrep -q "(^|.*\|)$tag(\|.*|$)" <<<"$tags" || tags="$tag|$tags"
-
- cat >"$meta" <<EOF
-$length $width $height $info
-$tags
-$description
-EOF
-}
-
-
-for each in *; do
-if (egrep -q "$file_pattern" <<<"$each"); then
- printf %s "$each ... Thumb ..."
- $genthumb "$each" "${each}.jpg" >/dev/null 2>/dev/null
- printf %s ' Meta ...'
- $genmeta "$each" "${each}.meta" >/dev/null 2>/dev/null
- printf %s ' Tags ...'
- for tag in $*; do
- addtag "${each}.meta" "$tag"
- done
- printf 'Done!\n'
-fi; done
+++ /dev/null
-#!/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 <http://www.gnu.org/licenses/>.
-
-video="$1"
-meta="$2"
-
-if [ -r "$meta" ]; then
- tags="$(sed -n 2p "$meta")"
- description="$(sed -n '3,$p' "$meta")"
-fi
-
-printf '' |mplayer -input nodefault-bindings -nosound -vo null -identify -frames 0 "$video" \
-| sort \
-| sed -rn 's:ID_LENGTH=(.*)(\..*)$:\1:p;
- s:ID_VIDEO_HEIGHT=(.*):\1:p;
- s:ID_VIDEO_WIDTH=(.*):\1:p;' \
-| tr '\n' ' ' \
-| read length height width 2>/dev/null
-
-cat <<EOF >"$meta"
-${length:-0} ${width:-0} ${height:-0} ${video##*/}
-${tags:-|}
-${description}
-EOF
+++ /dev/null
-#!/bin/zsh
-# Copyright 2014 - 2017 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/>.
-
-video="$1"
-thumb="$2"
-
-if [ -e "$video" -a \! -e "$thumb" ]; then
- printf '' |mplayer -input nodefault-bindings -nosound -vo null -frames 0 -identify "$video" \
- | sort \
- | sed -rn 's:^.*ID_LENGTH=(.*)(\..*)$:\1:p;
- s:^.*ID_VIDEO_HEIGHT=(.*)$:\1:p;
- s:^.*ID_VIDEO_WIDTH=(.*)$:\1:p;' \
- | tr '\n' ' ' \
- | read length height width 2>/dev/null
-
- [ "$(($height * 1000 / $width))" -gt "750" ] && width="$((75 * $width / $height))" \
- || width=100
- [ -z $width ] && width=100
- chunk="$((${length:-0} / 5))"
-
- tmp="$(mktemp -d)"
- for cnt in 1 2 3 4; do
- printf '' |mplayer -input nodefault-bindings -nosound -vo jpeg:outdir="$tmp" -frames 1 \
- -benchmark -vf framestep=I,scale="$width":-2 -ss "$(($cnt*$chunk))" "$video" >/dev/null 2>/dev/null
- mv "$tmp/00000001.jpg" "${tmp}/_${cnt}.jpg"
- done
- montage "${tmp}"/_[1234].jpg -tile 2x2+0+0 -geometry 100x75+3+3 -background '#000000' -quality 50 "${thumb}" 2>/dev/null
- rm -r "${tmp}"
-fi
#!/bin/sh
-list_item(){
+list_item() {
name="$(HTML "$1")"
path="$(HTML "$ITEM/$1")"
meta="$_DATA/$ITEM/.index/meta"
read -r length width height tags comment n <<-EOF
$(grep -m1 -F " $1" "$meta")
EOF
- printf '[div .list .file
- [a href="%s" [img src="%s?a=thumbnail"] %s]
- [span .time %i:%imin] [span .dim %ix%i] %s
- ]' \
- "$path" "$path" "$name" \
- "$((length / 60))" "$((length % 60))" \
- "$width" "$height" \
- "$(printf %s\\n "${tags#tags=}" |tr , ' ' |xargs printf '[span .tag %s]')"
+ printf '[div .list .file
+ [a href="%s" [img src="%s?a=thumbnail"][label %s]]
+ [span .time %i:%imin] [span .dim %ix%i] %s
+ ]' \
+ "$path" "$path" "$name" \
+ "$((length / 60))" "$((length % 60))" \
+ "$width" "$height" \
+ "$(printf %s\\n "${tags#tags=}" |tr , ' ' |xargs printf '[span .tag %s]')"
else
- printf '[div .list .file [a href="%s" [img src="%s?a=thumbnail"] %s]]' \
+ printf '[div .list .file [a href="%s" [img src="%s?a=thumbnail"][label %s]]]' \
"$path" "$path" "$name"
fi
}
-list_items(){
+list_items() {
mode="$(COOKIE mode |grep -m1 -xE 'index|browse' || printf browse )"
[ "$mode" = browse -a "$ITEM" ] && printf '..\n'
Name) sort -k 2;;
esac \
| cut -d/ -f2-
-
}
-list_paginate(){
+list_paginate() {
page="$(GET p |grep -xE '[0-9]+' || printf 1)"
printf '[div .itemlist '
a { color: inherit; text-decoration: none;}
body {
+ position: relative;
color: white;
background-color: black;
}
max-width: 85%;
}
-.itemlist { overflow: hidden; }
+.itemlist { display: block; overflow: hidden; }
.list {
position: relative;
- display: block; float: left;
+ display: inline-block;
width: 25%;
min-width: 250px;
- padding: .5em 1em;
+ padding: .25em;
overflow: none;
word-wrap: break-word;
vertical-align: top;
+ color: black;
}
-.list, .list a { color: black; }
+.list.dir {
+ padding: .5em 1em;
+}
+
.list:before {
position: absolute;
top: .25em; left: .25em;
z-index: -2;
content: '';
}
-.list.file:first-of-type { clear: left; }
.list.dir:before { background-color: #CCF; }
.list.file:before { background-color: #FDD; }
+.list.file:first-of-type { clear: left; }
-.list.file img {
+.list.file a img{
display: block;
width: 100%;
+ min-height: 4em;
}
+.list.file a label{
+ position: absolute;
+ top: 0; padding: .25em .5em;
+ color: white;
+ background-color: rgba(0,0,0,.625);
+}
+
+.list.file .time,
+.list.file .dim {
+ color: white;
+ background-color: #004;
+ padding: .125em .5em;
+}
+
.pagination {
display: block;
text-align: center;
}
#editing {
- position: absolute;
width: 100%; bottom: 0;
background-color: #333;
border-top: 1px solid;