reread date tag as year in fallback reader (fixes .ape at least)

This commit is contained in:
2021-02-06 23:37:04 +01:00
parent c1a2669e9b
commit 04a30bc599

View File

@@ -113,17 +113,32 @@ function read_tag_id3 {
fi
}
function ffprobe_readtag {
local tag="$1"
local file="$2"
ffprobe -loglevel error -show_entries format_tags="$tag" -of default=noprint_wrappers=1:nokey=1 "$file"
}
function read_tag_fallback {
local tag="$1"
local file="$2"
local tag_original="$tag"
local result=$(ffprobe -loglevel error -show_entries format_tags="$tag" -of default=noprint_wrappers=1:nokey=1 "$file")
local result=
if [[ "$tag" == 'date' ]]; then
result=$(ffprobe_readtag "$tag" "$file")
if [[ -z $result ]]; then
tag='year'
fi
fi
result=$(ffprobe_readtag "$tag" "$file")
if [[ $? -ne 0 ]]; then
error "Reading tag \"$tag\" from \"$file\" failed (ffprobe failed)"
error "Reading tag \"$tag_original\" from \"$file\" failed (ffprobe failed)"
return
fi
if [[ -z $result ]]; then
error "Reading tag \"$tag\" from \"$file\" failed (result empty)"
error "Reading tag \"$tag_original\" from \"$file\" failed (result empty)"
return
fi
echo "$result"