[chk_duplicate_imageid] Checks FLACs for duplicate IMAGEID
This commit is contained in:
parent
20cdce0e9d
commit
435d8c0319
1 changed files with 15 additions and 0 deletions
15
src/chk_duplicate_imageid
Normal file
15
src/chk_duplicate_imageid
Normal file
|
@ -0,0 +1,15 @@
|
|||
#!/bin/bash
|
||||
|
||||
chk_duplicate_imageid() {
|
||||
local TARGET_DIR="${1}"
|
||||
for flac in $(find ${TARGET_DIR} -name '*.flac'); do
|
||||
echo ${flac}
|
||||
local METADATA="$(print_meta_flac "${flac}")"
|
||||
imageidList=($(awk 'BEGIN{RS=";";FS="="}{if($1=="IMAGEID"){print $2}}' <<< ${METATATA}))
|
||||
if [[ ${#imageidList[@]} -ne 1 ]]; then
|
||||
local NEW_METADATA="$(echo ${METADATA} | sed 's|;|;\n|g' | sed 's/.*IMAGE.*;//' | awk 'NF' | tr -d '\n')"
|
||||
metaflac --remove-all-tags "${flac}"
|
||||
tr ';' \\n <<< ${NEW_METADATA}| metaflac --import-tags-from=- "${flac}"
|
||||
fi
|
||||
done
|
||||
}
|
Loading…
Reference in a new issue