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)$'
11 fn="$1"; fn="${fn##*/}"; fn="${fn%.*}"
12 STRING "$fn"; printf '\r'
16 local video probe l w h
18 [ "${video%.part}" = "$video" -a -s "$video" ] || return 0
20 probe="$(printf \\n; ffprobe -show_entries format=duration:stream=width,height "$video" 2>&-)"
21 l="${probe#*duration=}" l="${l%%${BR}*}" l="${l%.*}"
22 w="${probe#*width=}" w="${w%%${BR}*}"
23 h="${probe#*height=}" h="${h%%${BR}*}"
25 printf '%i %i %i tags= comment= %s\n' \
26 "${l:-0}" "${w:-0}" "${h:-0}" "$(meta_name "$video")"
32 meta="${file%/*}/.index/meta"
33 name="$(meta_name "$file")"
35 if [ -d "${meta%/meta}" ] && LOCK "$meta"; then
36 grep -avF " ${name}" "$meta" >"$meta.tmp"
39 mv "$meta.tmp" "$meta"
47 meta="${file%/*}/.index/meta"
48 name="$(meta_name "$file")"
50 if [ -d "${meta%/meta}" ] && LOCK "$meta"; then
51 grep -avF " ${name}" "$meta" >"${meta}.tmp"
52 grep -aF " ${name}" "$meta" >>"${meta}.trash"
53 mv "${meta}.tmp" "$meta"
60 file="$1"; meta="${file%/*}/.index/meta"
62 if [ -d "${meta%/meta}" ]; then
63 grep -aF " $(meta_name "$file")" "$meta" \
64 | grep -m1 -axE '[0-9]+ [0-9]+ [0-9]+ tags=[^ ]* comment=[^ ]* .+' \
67 printf '0\t0\t0\ttags=\tcomment=\t%s\r' "$(meta_name "$file")"
74 meta="${dir}/.index/meta"
75 metat="${dir}/.index/meta.time"
77 [ -f "$metat" ] || touch -d @0 "$metat"
79 if [ -d "$dir/.index" -a \! -f "$meta" ] && LOCK "$meta"; then
80 touch "$meta" # preliminary touch to prevent concurrent generators
81 find -L "$dir" -type f -mindepth 1 -maxdepth 1 \
82 | grep -aE "$file_pattern" \
89 elif [ -d "$dir/.index" -a "$dir" -nt "$metat" ] && LOCK "$meta"; then
91 find -L "$dir" -type f -newer "$metat" \
92 -mindepth 1 -maxdepth 1 \
93 | grep -aE "$file_pattern" \
95 grep -qF " $(meta_name "$v")" "$meta" \