import mutagen
AlbumArtist = "Somebody" # An Album artist to write to the appropriate tag
mfile = mutagen.File(path)filetype = type(mfile).__name__if filetype == "ASF":# Save the Album Artist here ("WM/AlbumArtist")# ... do something, what?mfile.save()elif filetype == "MP3":# Save the Album Artist here ("TPE2")# ... do something, what?mfile.save()elif filetype == "MP4":# Save the Album Artist here ("aART")# ... do something, what?mfile.save()
import mutagen
path = "Some file or other" # A file to set set the album artist
AlbumArtist = "Somebody" # An Album artist to write to the appropriate tag
mfile = mutagen.File(path)filetype = type(mfile).__name__
if filetype == "ASF": tag = "WM/AlbumArtist" mfile.tags[tag] = AlbumArtist mfile.save()elif filetype == "MP3":
tag = "TPE2"
mfile.tags.setall(tag, [mutagen.id3.TPE2(3, [AlbumArtist])])
mfile.save()elif filetype == "MP4":tag = "aART" mfile.tags[tag] = AlbumArtist mfile.save()
import mutagen
The question is how to remove the duplicates thus found and moreover can duplicates be found in ASF and MP4 files too? hasattr(mtag, "text") is false for those with filetype of ASF or MP4.filetype = type(mfile).__name__
if filetype == "MP3" and tag in mfile.tags:
mtag = mfile.tags[tag]
has_dupes = hasattr(mtag, "text") and isinstance(mtag.text, list) and len(mtag.text) > 1
if has_dupes:
print("Tag values:")
for val in tags[tag].text:
print(val)
--
---
You received this message because you are subscribed to the Google Groups "Quod Libet Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to quod-libet-develo...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.