593 shaares
Un "oneliner" pour détecter des fichiers musicaux sans tag dans un répertoire.
awk > * stout.
Je paste tout ça ici, au cas où...
find . -type f -name '*.[Mm][Pp]3' -exec id3 -Rl {} + -o \
-name '*.[Ff][Ll][Aa][Cc]' -exec metaflac --show-md5sum \
--with-filename --export-tags-to=- {} + -o \
-name '*.[Oo][Gg][Gg]' -exec sh -c 'echo "$0";vorbiscomment -lRe "$0"' {} \; |
awk 'BEGIN {
id3n = split("album artist title track", id3_tags)
vorbisn = split("album artist title tracknumber", vorbis_tags)
vorbisfile = "\\.([Ff][Ll][Aa][Cc]|[Oo][Gg][Gg])$"
ignorepatt = "^ *(unknown|track *[0-9]*)* *$"
}
/^Filename/ || $1 ~ vorbisfile {
if (fn)
fn ~ vorbisfile ? check_tags(vorbisn, vorbis_tags) : check_tags(id3n, id3_tags)
fn = /^Filename/ ? $2 : $1; f = x
}
{
if (split($0, tmp, "=") == 2) { $1 = tmp[1]; $2 = tmp[2] }
tags[tolower($1)] = $2
}
END { fn ~ vorbisfile ? check_tags(vorbisn, vorbis_tags) : check_tags(id3n, id3_tags)
printf "\n"
}
func check_tags(limit, tagarray, f) {
for (i = 1; i <= limit; i++) {
if (tolower(tags[tagarray[i]]) ~ ignorepatt) {
invalid_tags[tagarray[i]] = tags[tagarray[i]]; f || f++
}
}
if (f) {
printf "%s%s *** missing/invalid tags: ", RS, fn
for (t in invalid_tags)
printf "[%s=\"%s\"]", t, invalid_tags[t]
printf " ***"
}
split(x, tags); split(x, invalid_tags)
}' FS=:
awk > * stout.
Je paste tout ça ici, au cas où...
find . -type f -name '*.[Mm][Pp]3' -exec id3 -Rl {} + -o \
-name '*.[Ff][Ll][Aa][Cc]' -exec metaflac --show-md5sum \
--with-filename --export-tags-to=- {} + -o \
-name '*.[Oo][Gg][Gg]' -exec sh -c 'echo "$0";vorbiscomment -lRe "$0"' {} \; |
awk 'BEGIN {
id3n = split("album artist title track", id3_tags)
vorbisn = split("album artist title tracknumber", vorbis_tags)
vorbisfile = "\\.([Ff][Ll][Aa][Cc]|[Oo][Gg][Gg])$"
ignorepatt = "^ *(unknown|track *[0-9]*)* *$"
}
/^Filename/ || $1 ~ vorbisfile {
if (fn)
fn ~ vorbisfile ? check_tags(vorbisn, vorbis_tags) : check_tags(id3n, id3_tags)
fn = /^Filename/ ? $2 : $1; f = x
}
{
if (split($0, tmp, "=") == 2) { $1 = tmp[1]; $2 = tmp[2] }
tags[tolower($1)] = $2
}
END { fn ~ vorbisfile ? check_tags(vorbisn, vorbis_tags) : check_tags(id3n, id3_tags)
printf "\n"
}
func check_tags(limit, tagarray, f) {
for (i = 1; i <= limit; i++) {
if (tolower(tags[tagarray[i]]) ~ ignorepatt) {
invalid_tags[tagarray[i]] = tags[tagarray[i]]; f || f++
}
}
if (f) {
printf "%s%s *** missing/invalid tags: ", RS, fn
for (t in invalid_tags)
printf "[%s=\"%s\"]", t, invalid_tags[t]
printf " ***"
}
split(x, tags); split(x, invalid_tags)
}' FS=: