coll_tags.set(tag, value, track)
for tag, values in all_tags.iteritems():
if len(values) == 1:
- # Only one value for this tag, so add it to global tags.
- coll_tags.set(tag, list(values)[0])
- # And now remove it from each track tags.
+ # Only one value for this tag, but does that one value appear on
+ # all tracks?
for track, tags in coll_tags._tracks.iteritems():
- del tags[tag]
+ if not tag in tags:
+ # Nope.
+ break
+ else:
+ # Yep, so add it to global tags.
+ coll_tags.set(tag, list(values)[0])
+ # And now remove it from each track tags.
+ for track, tags in coll_tags._tracks.iteritems():
+ del tags[tag]
print '\n'.join(coll_tags.all())
return 0
sys.stderr.write('expected %d flac files, got %d\n'
% (len(tags), len(args)))
return 2
- artist = tags.get_path_safe('ARTIST')
+ artist = tags.get_path_safe('ALBUMARTIST')
+ if not artist:
+ artist = tags.get_path_safe('ARTIST')
album = tags.get_path_safe('ALBUM')
+ if not album:
+ album = tags.get_path_safe('ALBUM', track=1)
try:
os.mkdir(artist)
except OSError, e: