Hi,
(using Mac OSX)
I have my own python SW to manage my CD data base while I am not a major SW expert. I’d like to use the tag information from Picard to organize my Music better. is there a possibility to export the tag information into a text or xml file via some scripting command?
thanks for your help!
I use a python script with mutagen to read the tag info from the music files to write to my local sqlite database.
Thank you for fast response! I do the same using audio tools. unfortunately audio tools does only provide a limited setof tags for r/w. I am not hacker enough to extend. will check mutagen.
Mutagen is actually the library that is used in Picard, so it should be able to do what you need. Here is a small extract from my script to help get you started.
flac_file = os.path.join(dir_name, file_name)
mdata = mutagen.File(flac_file)
if mdata:
track_length = mdata.info.length
track_bitrate = mdata.info.bitrate
album_title = '' if 'album' not in mdata.keys() else mdata['album'][0]
if not album_title:
album_title = '' if 'TALB' not in mdata.keys() else mdata['TALB']
album_id = '' if 'musicbrainz_albumid' not in mdata.keys() else mdata['musicbrainz_albumid'][0]
if not album_id:
album_id = '' if 'TXXX:MusicBrainz Album Id' not in mdata.keys() else mdata['TXXX:MusicBrainz Album Id']
album_artist = '' if 'albumartist' not in mdata.keys() else mdata['albumartist'][0]
if not album_artist:
album_artist = '' if 'TPE1' not in mdata.keys() else mdata['TPE1']
You might also want to review the Picard Tag Mappings for some additional information.
3 Likes
thanks for the quick start help. will look into installing mutagen. have a great weekend!
installed and test script working - thanks a lot!
Werner
2 Likes