Hello - I am writing a script that converts an entire music library into a single desired output format. The source music library has a variety of music filetypes (flac, mp3, m4a, ogg, etc) and I am attempting to use mutagen (a music file tagging module, http://code.google.com/p/mutagen/) in order to handle the tagging.
I am struggling, on a theoretical level, on how to map the various filetype's tag/key naming conventions. I have already created my own MusicFile objects to handle each filetype (with functions for encoding/decoding) but I can't wrap my head around how to map the tags. Here is a relevant (I think) example from mutagen for three different filetypes all with the same tags (but different keys identifying them). >>> flac.keys() ['album', 'disctotal', 'artist', 'title', 'tracktotal', 'genre', 'composer', 'date', 'tracknumber', 'discnumber'] >>> mp3.keys() ['TPOS', u'APIC:', 'TDRC', 'TIT2', 'TPE2', 'TPE1', 'TALB', 'TCON', 'TCOM'] >>> mp4.keys() ['\xa9alb', 'tmpo', '\xa9ART', '\xa9cmt', '\xa9too', 'cpil', '----:com.apple.iTunes:iTunSMPB', '\xa9wrt', '\xa9nam', 'pgap', '\xa9gen', 'covr', 'disk', '----:com.apple.iTunes:Encoding Params', '----:com.apple.iTunes:iTunNORM'] And here is what I would need to do to find the song's TITLE text: >>> flac['title'] [u'Christmas Waltz'] >>> mp3['TIT2'].text #notice this one takes another additional step, as well, >>> by specifying text ! [u'Christmas Waltz'] >>> mp4['\xa9nam'] [u"Christmas Waltz"] In the end, after "the mapping", I would like to be able to do something along these approaches: [1] >>> target_file.tags = src_file.tags [2] >>> target_file.set_tags(src_file.get_tags()) However, none of the keys match, so I need to somehow map them to a central common source first ... and I am not sure about how to approach this. I know I could manually assign each key to a class property (using the @property tag) ... but this seems tedious: Any insight on where I can start with mapping all these together? Thanks, Damon _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor