Standardising tag metadata across a large library

AVForums

Help Support AVForums:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.

Now Playing

AVForums Super Veteran
Joined
May 25, 2010
Messages
1,208
Reaction score
15
Location
South Africa
If you've a larger library than can reasonably be loaded into a single session in a tag editor (RAM quickly becomes a limitation) but want to standardise tag metadata across your entire collection, getting the metadata in a database is probably one of the easiest answers.  If you use Linux you're in luck.  Here's a Python script to import and export audio tags to/from a SQLite DB.  Run it from the root folder containing your music files and it'll read all tags other than artwork and write it to a SQLite database.  You can then edit the database using sqlitestudio or another SQLite editor.  When done the script can write the data held in the database back to the underlying files, giving effect to your changes.  You must have puddletag installed to be able to use this script as it leverages the puddletag codebase to read and write tag metadata to the underlying files.  File date and timestamps are preserved.  I've run it against 3800 files without any issues, however, use at your own risk (you have backups, right...?)

As the code writes all database records back to the underlying files (whether a field was changed or not) it's a good idea to modify the table by adding a boolean field I called dbedited and ensuring that I write 1 to it everytime I run an update query.  This way I can export the records that have actually been changed to a new table, copy it to another database and run the tag update script only against those files that have changed metadata.

https://github.com/keith-g/audiodb

Examples of SQL updates to remove unwanted crud from tags often included during the ripping process.  LMS 7.9 has exposed Composers and Album Artists as seperately browseable entities, so for me it's time to sort out composer and albumartist tags...

I may in time write a SQL script that removes all tags I've no interest in and standardises those I rely on using a rulebase. If there's any interest I'll post it here if/ when done.

Code:
UPDATE audio
   SET composer = REPLACE( composer, ' / ', '\\' ),
       albumartist = REPLACE( albumartist, ' / ', '\\' ),
       comment = NULL,
       totaltracks = NULL,
       discid = NULL,
       tracktotal = NULL,
       ensemble = NULL,
       [album artist] = NULL,
       totaldiscs = NULL,
       disctotal = NULL,
       replaygain_track_peak = NULL,
       replaygain_album_gain = NULL,
       replaygain_track_gain = NULL,
       replaygain_album_peak = NULL,
       isrc = NULL;

Whilst I've said above use at your own risk, the script was written by the developer of puddletag, so there's no need to be overly concerned with it screwing up your metadata.  Just be aware that if you make changes to the database and then export the changes back to your files there's no undo button.  An easy solution for this is simply to import the tags and keep an untouched copy of the db handy for backup purposes.
 
Top