info="$_GET[\"i\"]"
filter="$_GET[\"f\"]"
search="$_GET[\"s\"]"
-order=$(echo "$_GET[\"o\"]" |egrep '^(Name|Date|Length)$')
-page=$(echo "$_GET[\"p\"]" |egrep '^[0-9]+$')
+order=$(echo -E "$_GET[\"o\"]" |egrep '^(Name|Date|Length)$')
+page=$(echo -E "$_GET[\"p\"]" |egrep '^[0-9]+$')
[ -z "$page" ] && page=0
page_link=''
-[ -n "$info" ] && page_link="i=$(echo -n "$info" |sed -r 's:%:%25:g;s:\&:%26:g;')&"
+[ -n "$info" ] && page_link="i=$(echo -En "$info" |sed -r 's:%:%25:g;s:\&:%26:g;')&"
[ -n "$order" ] && page_link="${page_link}o=${order}&"
[ -n "$search" ] && page_link="${page_link}s=${search}&"
[ -n "$filter" ] && page_link="${page_link}f=${filter}&"
cache="${_DATA}/cache/$info.cache"
video="${_DATA}/videos/$info"
meta="${_DATA}/meta/$info.meta"
- if [ "$cache" -nt "$video" -a "$cache" -nt "$meta" ]; then
+ if [ "$cache" -nt "$meta" ]; then
cat "$cache"
else
tags="$(sed -n 2p "$meta")"
[ -z "$width" ] && width=0
[ -z "$height" ] && height=0
-# reenc="${_DATA}/vp8/$(sed -r 's:^(.*)\.[a-zA-Z0-9]{3,4}$:\1:' <<<"$info" )"
- mpfake="${_DATA}/mp4/$(sed -r 's:^(.*)\.[a-zA-Z0-9]{3,4}$:\1.mp4:' <<<"$info" )"
-# [ -f "$reenc.mp4" ] && reenc="$reenc.mp4" || reenc="$reenc.mkv"
[ -r "$meta" ] || ". ${_EXEC}/helpers/genmeta.sh" "$video" "$meta"
[ -r "$thumb" ] || ". ${_EXEC}/helpers/genthumb.sh" "$video" "$thumb"
- [ -L "$mpfake" ] || ln -s "../$video" "$mpfake"
- video="$(echo "videos/$info" |sed 's/\?/\%6F/g')"
- thumb="$(echo "thumbs/$info.jpg" |sed 's/\?/%6F/g')"
- mpfake="$(echo "$info" |sed -r 's:^(.*)\.[a-zA-Z0-9]{3,4}$:mp4/\1.mp4:' |sed 's/\?/%6F/g')"
+ video="$(urlsave "videos/$info")"
+ thumb="$(urlsave "thumbs/$info.jpg")"
[ "$(($length % 60))" -lt 10 ] &&\
minutes="$(($length / 60)):0$(($length % 60))" ||\
minutes="$(($length / 60)):$(($length % 60))"
- linkinfo="$(echo -n "$info" |sed -r 's:%:%25:g;s:\&:%26:g;')"
+ linkinfo="$(urlsave "$info")"
+
+ rpibase="http://pfostenpanne/?path=http://jupiter:8000/"
+
+ [ $height -gt 480 ] && \
+ raspi="<a class=\"videolink alt raspi\" href=\"${rpibase}?action=transcode&i=${linkinfo}&t=480\">RasPi</a>" \
+ || raspi="<a class=\"videolink alt raspi\" href=\"${rpibase}${video}\">RasPi</a>"
+ [ $height -gt 480 ] && \
+ alt480="<a class=\"videolink alt 480p\" href=\"?action=transcode&i=${linkinfo}&t=480\">480p</a>" \
+ ||unset alt480
+ [ $height -gt 240 ] && \
+ alt240="<a class=\"videolink alt 240p\" href=\"?action=transcode&i=${linkinfo}&t=240\">240p</a>" \
+ ||unset alt240
+
tee "$cache" <<VIDEOend
- <div class="thumb">
- <a class="watchlink" name="$linkinfo" href="?action=watch&i=$linkinfo">
+ <li class="thumb">
+ <a class="watchlink" name="${linkinfo}" href="?action=watch&i=${linkinfo}">
<img src="$thumb">
</a>
<a class="videolink" href="$video">$info</a>
- <!-- a href="$reenc">VP8</a -->
- <a class="videolink fake-mp4" href="$mpfake">fake-mp4</a>
+ ${alt480} ${alt320} ${alt240} ${raspi}<br>
+
<input type="checkbox" name="tagsel" value="$info">
<span class="info property">${minutes}min</span>
- <span class="info property">${width}x${height}</span><br>
- $(echo "$tags" |sed -r 's:\|*([^|]+)\|*:<span class="info tag">\1</span>:g')
+ <span class="info property">${width}x${height}</span>
+ $(echo -E "$tags" |sed -r 's:\|*([^|]+)\|*:<span class="info tag">\1</span>:g')
</div>
VIDEOend
fi
}
-_by_name(){ ls ${_DATA}/videos/ |egrep -i "$file_pattern" }
+_by_name(){ find ${_DATA}/videos/ -mindepth 1 -maxdepth 1 -printf '%f\n' |sort |egrep -i "$file_pattern" }
_by_date(){ ls -c ${_DATA}/videos/ |egrep -i "$file_pattern" }
-_by_length(){ ls ${_DATA}/by_length/ |sed -r 's:[0-9]{5} - ::g' }
+_by_length(){ find ${_DATA}/by_length/ -mindepth 1 -maxdepth 1 -printf '%f\n' |sort |sed -r 's:[0-9]{5} - ::' }
thumblist() {
cache="${_DATA}/cache/?o=${order}&s=${search}&f=${filter}&p=${page}"
$genlist |sed -rn 's:^(.+)$:'"${_DATA}"'/meta/\1'.meta':p' |xargs -d\\n egrep -sil "$search" |sed -rn 's:^(.*/)+([^/]+)\.meta$:\2:p'
elif [ "$filterex" != "q0" ]; then
$genlist |while read video; do
- [ -r "${_DATA}/meta/$video.meta" ] && sed -rn "2{$filterex;q1}" "${_DATA}/meta/$video.meta" && echo "$video"
+ [ -r "${_DATA}/meta/$video.meta" ] && sed -rn "2{$filterex;q1}" "${_DATA}/meta/$video.meta" && echo -E "$video"
done
else
$genlist