#!/bin/zsh
-# Copyright 2014, 2015 Paul Hänsch
+# Copyright 2014 - 2016 Paul Hänsch
#
# This file is part of Serve0.
#
. $_EXEC/pages/common.sh
+LF='
+'
filters="${_GET[f]}"
debug "FILTERS: $filters"
quicklinks(){
output=''
- tac ${_DATA}/meta/recent |while [ "$(echo "$output" |wc -l)" -lt 10 ] && read line; do
+ tac ${_DATA}/meta/recent \
+ | while [ "$(printf %s "$output" |wc -l)" -lt 10 ] && read line; do
line="<a href="$line">$line</a>"
- echo "$output" |grep -qF "$line" || output="$output$line\n"
+ printf %s "$output" |grep -qF "$line" || output="$output$line$LF"
done
- echo $output
+ printf %s\\n "$output"
}
category_selected(){
[ -r "$meta" ] || genmeta "$videofile" "$meta"
head -n1 "$meta" |read length width height filename
- [ -z "$length" ] && length=0
- [ -z "$width" ] && width=0
- [ -z "$height" ] && height=0
+ length=$(validate "$length" '[0-9]+' 0)
+ width=$(validate "$width" '[0-9]+' 0)
+ height=$(validate "$height" '[0-9]+' 0)
tags="$(sed -n 2p "$meta")"
video="$(urlsafe "videos/$info")"