Novice scripting - updating info from Musicbrainz
Posted: Thu Oct 26, 2017 8:11 am
I'm a complete novice at writing code and not sure what I'm doing. Am hoping that one or more folks here with more experience might be willing to point me in the right direction, maybe review the script as I'm writing it and provide feedback.
Thanks to the efforts of other users we have scripts that will find an AcoustID for a given track. We also have a script that will search Musicbrainz to find the earliest release date for a given track (which I would use if the below lookups don't return results). I'd like to build a script that will do the following:
1. Search AcoustID metadata to find a Musicbrainz recording ID (e.g., http://api.acoustid.org/v2/lookup?clien ... ee12d5718c)
2. For a given recording ID, store the Work ID (if available) in a custom field - this is both for the classical lookup mentioned below, as well as to allow me to find covers of tracks in my library
3. If the track is a classical work, find the composition date and store it in the year (if available, assuming work ID returned a result)
4. If the track is not a classical work, find the recording date and store it in the year (if available)
This query at Musicbrainz will return the recording date, work ID and composition date if they're accessible:
http://musicbrainz.org/ws/2/recording/3 ... place-rels
I'm looking at borrowing some code from either the MusicIP tagger (which was based on the now-deprecated PUID) or the MusicBrainz NGS tagger, or maybe both, but again, not really sure what I'm doing.
*******
First issue I'm looking to tackle is how to load the currently selected song list and, for each track in the list, query AcoustID to find the recording ID. I store the AcoustID in Custom5 but if the script is to be more broadly applicable I'd have to incorporate either fpcalc or allow a user to specify which field the AcoustID is stored in to perform the lookup.
I could use some pointers on how to do the above so I can get started - also not sure how to integrate debugging into the code to identify any problems that might come up.
*******
Next issue would be querying to find the Work ID (I'm not sure how to get this data from the query I posted above). Then storing that ID in a custom field (I use custom 4 but again, might need to make this user-defined).
I use the Grouping field to specify whether a track is classical, although others may use the newer functionality in MediaMonkey 4 to separate classical tracks from other tracks. That would be my next problem to solve, figuring out whether a track is classical and, if so, looking up and storing the composition date.
Final issue would be looking up and storing the recorded date if the track is not classical.
Thanks in advance for any help!
Thanks to the efforts of other users we have scripts that will find an AcoustID for a given track. We also have a script that will search Musicbrainz to find the earliest release date for a given track (which I would use if the below lookups don't return results). I'd like to build a script that will do the following:
1. Search AcoustID metadata to find a Musicbrainz recording ID (e.g., http://api.acoustid.org/v2/lookup?clien ... ee12d5718c)
2. For a given recording ID, store the Work ID (if available) in a custom field - this is both for the classical lookup mentioned below, as well as to allow me to find covers of tracks in my library
3. If the track is a classical work, find the composition date and store it in the year (if available, assuming work ID returned a result)
4. If the track is not a classical work, find the recording date and store it in the year (if available)
This query at Musicbrainz will return the recording date, work ID and composition date if they're accessible:
http://musicbrainz.org/ws/2/recording/3 ... place-rels
I'm looking at borrowing some code from either the MusicIP tagger (which was based on the now-deprecated PUID) or the MusicBrainz NGS tagger, or maybe both, but again, not really sure what I'm doing.
*******
First issue I'm looking to tackle is how to load the currently selected song list and, for each track in the list, query AcoustID to find the recording ID. I store the AcoustID in Custom5 but if the script is to be more broadly applicable I'd have to incorporate either fpcalc or allow a user to specify which field the AcoustID is stored in to perform the lookup.
I could use some pointers on how to do the above so I can get started - also not sure how to integrate debugging into the code to identify any problems that might come up.
*******
Next issue would be querying to find the Work ID (I'm not sure how to get this data from the query I posted above). Then storing that ID in a custom field (I use custom 4 but again, might need to make this user-defined).
I use the Grouping field to specify whether a track is classical, although others may use the newer functionality in MediaMonkey 4 to separate classical tracks from other tracks. That would be my next problem to solve, figuring out whether a track is classical and, if so, looking up and storing the composition date.
Final issue would be looking up and storing the recorded date if the track is not classical.
Thanks in advance for any help!