file_pattern='^.*\.(mov|ts|mpg|mpeg|mp4|m4v|avi|mkv|flv|sfv|wmv|ogm|ogv|webm|iso|rmvb)$'
meta_name() {
- local fn
- fn="$1"; fn="${fn##*/}"; fn="${fn%.*}"
- STRING "$fn"; printf '\r'
+ local fn="${1##*/}"
+ STRING "${fn%.*}"
}
meta_line() {
w="${probe#*width=}" w="${w%%${BR}*}"
h="${probe#*height=}" h="${h%%${BR}*}"
- printf '%i %i %i tags= comment= %s\n' \
+ printf '%i %i %i tags= comment= %s\r\n' \
"${l:-0}" "${w:-0}" "${h:-0}" "$(meta_name "$video")"
}
name="$(meta_name "$file")"
if [ -d "${meta%/meta}" ] && LOCK "$meta"; then
- grep -avF " ${name}" "$meta" >"$meta.tmp"
+ grep -avF " ${name}${CR}" "$meta" >"$meta.tmp"
meta_line "$file" \
| tee -a "$meta.tmp"
mv "$meta.tmp" "$meta"
name="$(meta_name "$file")"
if [ -d "${meta%/meta}" ] && LOCK "$meta"; then
- grep -avF " ${name}" "$meta" >"${meta}.tmp"
- grep -aF " ${name}" "$meta" >>"${meta}.trash"
+ grep -avF " ${name}${CR}" "$meta" >"${meta}.tmp"
+ grep -aF " ${name}${CR}" "$meta" >>"${meta}.trash"
mv "${meta}.tmp" "$meta"
RELEASE "$meta"
fi
file="$1"; meta="${file%/*}/.index/meta"
if [ -d "${meta%/meta}" ]; then
- grep -aF " $(meta_name "$file")" "$meta" \
+ grep -aF " $(meta_name "$file")${CR}" "$meta" \
| grep -m1 -axE '[0-9]+ [0-9]+ [0-9]+ tags=[^ ]* comment=[^ ]* .+' \
|| meta_file "$file"
else
- printf '0\t0\t0\ttags=\tcomment=\t%s\r' "$(meta_name "$file")"
+ printf '0\t0\t0\ttags=\tcomment=\t%s\r\n' "$(meta_name "$file")"
fi
}
-mindepth 1 -maxdepth 1 \
| grep -aE "$file_pattern" \
| while read -r v; do
- grep -qF " $(meta_name "$v")" "$meta" \
+ grep -qF " $(meta_name "$v")${CR}" "$meta" \
|| meta_line "$v"
done >>"$meta"
touch "$metat"