thumb="$(urlsafe "thumbs/$info.jpg")"
linkinfo="$(urlsafe "$info")"
htmlinfo="$(htmlsafe "$info")"
+ attrinfo="$(attribsafe "$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">
- <a class="watchlink" name="${linkinfo}" href="?action=watch&i=${linkinfo}">
+ <li id="$attrinfo" class="thumb">
+ <button class="watchlink" name="${linkinfo}" formaction="?action=watch&i=${linkinfo}">
<img src="$thumb" alt="Preview not yet available">
- </a>
- <h2>${htmlinfo}</h2>
+ </button>
+ <h2><a href="?action=watch&i=${linkinfo}">${htmlinfo}</a></h2>
<input type="checkbox" name="tagsel" value="${htmlinfo}">
<span class="info property">${minutes}min</span>
genlist(){
case "$order" in
- Date) ls -c "${_DATA}"/videos/ |egrep -i "$file_pattern";;
+ Date) find "${_DATA}"/videos/ -maxdepth 1 -mindepth 1 -printf '%T@ %f\n' |sort -r |cut -d\ -f2- |egrep -i "$file_pattern";;
Length) sed -sn 1p "${_DATA}"/meta/*.meta |sort -n |sed -r 's;^[0-9\t]+\t;;';;
- Name) printf '%s\n' "${_DATA}"/videos/* |sed -r 's;^.*/;;;';;
+ Name) find "${_DATA}"/videos/ -maxdepth 1 -mindepth 1 -printf '%f\n' |sort |egrep -i "$file_pattern";;
esac
}
selectionlist() {
cachebase="?o=${order}&s=${search//\//}&f=${filter//\//}"
cache="${_DATA}/cache/${cachebase}"
- if [ "$cache" -nt ${_DATA}/videos -a "$cache" -nt ${_DATA}/meta ]; then
+ if [ -s "$cache" -a "$cache" -nt ${_DATA}/videos -a "$cache" -nt ${_DATA}/meta ]; then
cat "$cache"
else
filterex="s;^([0-9]+\t){3}(.+)\n.*$;\2;p"
done
}
-pagecount="$(( $(selectionlist | wc -l) / $pagesize + 1 ))"
+pagecount() {
+ printf "$(( $(selectionlist | wc -l) / $pagesize + 1 ))"
+}