added tool to fix deprecated id3 tags in flacs

This commit is contained in:
Luke Tidd
2023-05-19 10:26:43 -04:00
parent 831034bd14
commit fb39957c34
4 changed files with 145 additions and 5 deletions

View File

@@ -5,6 +5,7 @@
src_library="${HOME}/flac"
output_dir="${HOME}/opus"
log="${HOME}/encode_log_$(date '+%Y-%m-%d_%H:%M')"
function encode() {
file="$1"
@@ -14,6 +15,9 @@ function encode() {
file_name="$(basename "$file")"
final_dir="$(sed "s_${HOME}/flac_${HOME}/opus_" <<< "$src_dir")"
final_opus="$(sed -e 's/\.flac$/.opus/' -e "s_${HOME}/flac_${HOME}/opus_" <<< "$file")"
if [[ -f "$final_opus" ]]; then
return
fi
unset tags
unset dest_dir
@@ -39,17 +43,19 @@ function encode() {
[[ -d "$final_dir" ]] || mkdir -p "$final_dir"
if [[ -n "${tags[DISK]}" ]]; then
opusenc \
err="$(opusenc --quiet \
--title "${tags[TITLE]}" --artist "${tags[ARTIST]}" \
--album "${tags[ALBUM]}" --tracknumber "${tags[TRACKNUMBER]}" \
--date "${tags[DATE]}" --comment "DISK=${tags[DISK]}" "$file" "$final_opus"
--date "${tags[DATE]}" --comment "DISK=${tags[DISK]}" "$file" "$final_opus" 2>&1)"
else
opusenc \
err="$(opusenc --quiet \
--title "${tags[TITLE]}" --artist "${tags[ARTIST]}" \
--album "${tags[ALBUM]}" --tracknumber "${tags[TRACKNUMBER]}" \
--date "${tags[DATE]}" "$file" "$final_opus"
--date "${tags[DATE]}" "$file" "$final_opus" 2>&1)"
fi
if [[ -n "$err" ]]; then
printf '%s\n' "$err" >> "$log"
fi
}
time find "$src_library" -type f -name '*.flac' -print0 | env_parallel -P 0 -0 --bar encode {}