Closed GoogleCodeExporter closed 9 years ago
Btw, I've found to my particular problem a simpler solution:
try:
easymp3 = MP3(filepath, ID3=EasyID3)
except HeaderNotFoundError:
raise IDv3Exception("Header not found")
EasyID3.RegisterTextKey("language", "TLAN")
languages = easymp3.get('language', [""]).pop(0)
Btw, that pop is also wrong, since it removes the item. Maybe someone should do
simpler access to MP3 objects like:
languages = easymp3.getfirst('language',
default_value_if_language_is_not_found_goes_here)
Original comment by jari.pennanen@gmail.com
on 19 Dec 2009 at 9:39
TLAN is not mapped to language because TLAN is not a freeform string.
The correct way to handle a missing key in any kind of Python map is to catch
KeyError. Mutagen is no different.
Original comment by joe.wreschnig@gmail.com
on 19 Dec 2009 at 9:52
Original issue reported on code.google.com by
jari.pennanen@gmail.com
on 19 Dec 2009 at 9:19