3 [ -n "$include_indexmeta" ] && return 0
6 . "$_EXEC/cgilite/storage.sh"
7 file_pattern='^.*\.(mov|ts|mpg|mpeg|mp4|m4v|avi|mkv|flv|sfv|wmv|ogm|ogv|webm|iso|rmvb)$'
15 local video probe l w h
17 [ "${video%.part}" = "$video" -a -s "$video" ] || return 0
19 probe="$(printf \\n; ffprobe -show_entries format=duration:stream=width,height "$video" 2>&-)"
20 l="${probe#*duration=}" l="${l%%${BR}*}" l="${l%.*}"
21 w="${probe#*width=}" w="${w%%${BR}*}"
22 h="${probe#*height=}" h="${h%%${BR}*}"
24 printf '%i %i %i tags= comment= %s\r\n' \
25 "${l:-0}" "${w:-0}" "${h:-0}" "$(meta_name "$video")"
31 meta="${file%/*}/.index/meta"
32 name="$(meta_name "$file")"
34 if [ -d "${meta%/meta}" ] && LOCK "$meta"; then
35 grep -avF " ${name}${CR}" "$meta" >"$meta.tmp"
38 mv "$meta.tmp" "$meta"
46 meta="${file%/*}/.index/meta"
47 name="$(meta_name "$file")"
49 if [ -d "${meta%/meta}" ] && LOCK "$meta"; then
50 grep -avF " ${name}${CR}" "$meta" >"${meta}.tmp"
51 grep -aF " ${name}${CR}" "$meta" >>"${meta}.trash"
52 mv "${meta}.tmp" "$meta"
59 file="$1"; meta="${file%/*}/.index/meta"
61 if [ -d "${meta%/meta}" ]; then
62 grep -aF " $(meta_name "$file")${CR}" "$meta" \
63 | grep -m1 -axE '[0-9]+ [0-9]+ [0-9]+ tags=[^ ]* comment=[^ ]* .+' \
66 printf '0\t0\t0\ttags=\tcomment=\t%s\r\n' "$(meta_name "$file")"
73 meta="${dir}/.index/meta"
74 metat="${dir}/.index/meta.time"
76 [ -f "$metat" ] || touch -d @0 "$metat"
78 if [ -d "$dir/.index" -a \! -f "$meta" ] && LOCK "$meta"; then
79 touch "$meta" # preliminary touch to prevent concurrent generators
80 find -L "$dir" -type f -mindepth 1 -maxdepth 1 \
81 | grep -aE "$file_pattern" \
88 elif [ -d "$dir/.index" -a "$dir" -nt "$metat" ] && LOCK "$meta"; then
90 find -L "$dir" -type f -newer "$metat" \
91 -mindepth 1 -maxdepth 1 \
92 | grep -aE "$file_pattern" \
94 grep -qF " $(meta_name "$v")${CR}" "$meta" \