[ -n "$location" ] && playuri="${treeroot%/}/${location#/}"
[ -n "$info" ] && playuri="${_DATA}/videos/$info"
+ metafile="${_DATA}/meta/${info}.meta"
+
+ playmeta="${_DATA}/mplayer.meta"
fifofile="${_DATA}/mplayer.fifo"
statusfile="${_DATA}/mplayer.status"
volume="$(validate "$(cat "${_DATA}/mplayer.volume")" '[1-9]?[0-9]|100' 20)"
[ \! -p "$fifofile" ] && rm -f "$fifofile" && mkfifo -m 600 "$fifofile"
- debug PLAYURI $playuri
+ debug PLAYURI "$playuri"
+
+ [ -f "$metafile" ] && cp "$metafile" "$playmeta" \
+ || "${_EXEC}"/helpers/genmeta.sh "$playuri" "$playmeta" >/dev/null
DISPLAY=:0 XDG_RUNTIME_DIR=/run/user/1006 \
nohup /usr/bin/mplayer -ao pulse \
linkinfo="$(urlsafe "$info")"
htmlinfo="$(htmlsafe "$info")"
- [ "$(($length % 60))" -lt 10 ] && minutes="$(($length / 60)):0$(($length % 60))" \
- || minutes="$(($length / 60)):$(($length % 60))"
+ minutes="$(printf "%d:%02d" $(($length / 60)) $(($length % 60)) )"
tee "$cache" <<VIDEOend
<li class="thumb">
#!/bin/zsh
-# Copyright 2014 2016 Paul Hänsch
+# Copyright 2014, 2016 Paul Hänsch
#
# This file is part of Serve0.
#
directory="${location%/*}"
statusfile="$_DATA/mplayer.status"
-TITLE="$info"
-
-if [ -n "$info" ]; then
- video="${_DATA}/videos/$info"
- meta="${_DATA}/meta/$info.meta"
- tags="$(sed -n '2p' "$meta")"
- description="$(sed -n '3,$p' "$meta")"
- head -n1 "$meta" |read length width height x
-else
- video="${treeroot%/}/${location#/}"
- meta=''; tags=''; length=0; width=0; height=0;
- description=0
-fi
+[ -n "$info" ] && video="${_DATA}/videos/$info" \
+ || video="${treeroot%/}/${location#/}"
+
+meta="${_DATA}/mplayer.meta"
+tags="$(sed -n '2p' "$meta")"
+description="$(sed -n '3,$p' "$meta")"
+head -n1 "$meta" |read length width height TITLE
volume=$(validate "$(cat "$_DATA/mplayer.volume")" '[1-9]?[0-9]|100' 20)
<!--button type="submit" name="osd" value="progression">Progress</button -->
</form>
- <span class="info length">$(($length / 60)):$(($length % 60)) min</span>
+ <span class="info length">$(printf "%d:%02d min" $(($length / 60)) $(($length % 60)) )</span>
<span class="info width" >Width: $width</span>
<span class="info height">Height: $height</span><br>