Open Hawke opened 11 years ago
Parsing ISRCs from cue sheets is not a big deal.
The problem is getting the Disc ID from the cuesheet. The official library (libdiscid) does only support creating these from physical discs. It might be possible to calculate the disc id with the track times, but that might also be out of scope for the script and error-prone. (quite easy in general, but there are some pitfalls). There are possibly also bugs/problems that led to a wrong cuesheet (i.e. problems with data tracks).
On the pro side: cuesheets are somewhat widespread.
Do you have many cuesheets lying around?
The calculation is defined in http://musicbrainz.org/doc/Disc_ID_Calculation
This would need a couple of tests, that the resulting ids are the same using libdiscid (the reference) and our implementation.
I tend to have cue sheets + EAC logs (the latter is sufficient to generate a discID of course). Is it necessary to have a discID to submit ISRCs?
Technically ISRCs are a property of recordings and submission works over tracks entities. However, how would you match to the correct recording or release where this recording is attached to?
You could provide the release mbid
or recording mbid
at the command line,
but when you are that far, adding more code to your own script (that gathers this information) might be a better option.
Searching with the artist/title/track information from the cuesheet (if present) and then giving a choice is an option, but not the first.
I also want to note, that this won't be fully automatic. You will be given a choice which is the correct release quite often (for popular releases) and then it is better to have the disc/case at hand to check for barcodes and release dates. (though the correct release dates are not the same as production dates at the cover) Again, if you need the disc/case anyways..
I will see if I can add disc id calculation when I have time, but this isn't high priority.
By the way, if you do want to create a script for your use case, isrcsubmit-cdrdao (ngs) might be a better start. That script uses a newer musicbrainz backend, reading a cdrdao toc is very similar to reading a cue sheet and it doesn't include much code you don't need :-)
However, that script also is missing the matching part from the cue to the recordings/releases. You might want to try and extract mbids from the actual files (which would be much better in your case).
Another thing to note:
libdiscid itself includes a function that calculates a disc id when given the offsets (from a toc/cue): https://github.com/metabrainz/libdiscid/blob/master/include/discid/discid.h
It's just that the python library I am using (python-musicbrainz2) doesn't expose this interface in any way. Again, isrcsubmit 2 should use another musicbrainz library which should export this interface.
I started a libdiscid python binding: https://github.com/JonnyJD/python-discid
When that binding is done, calculating the disc id should only be a couple of lines in isrcsubmit.
@kepstin indicated in #musicbrainz that cue files alone are not enough for disc IDs (missing overall length)
There is a C library to wrap CUE+WAV and other formats: http://cdemu.sourceforge.net/pkg_libmirage.php
Kepstin also has a library that might already help you (uses libdiscid and libmirage): http://www.kepstin.ca/projects/image-id
It might be possible to add ISRC reading in my tool via the libmirage interfaces, I might take a look at that at some point. Opened kepstin/image-id#1 for this.
image-id does have ISRC output now. Isrcsubmit version 2 can possibly support submitting from cue files with the help of image-id.
My current idea would be to haven an --image parameter that, if given an image file, would get ID and ISRCs from the image-id output, store this in some Disc object (or similar?) and then go on asking which MB release should be chosen.
I plan to make an actual release of image-id shortly, so you can have a version to refer to in docs, etc.
image-id 1.0.1 is released now. I'll implement this when I have some time.
@LordSputnik implemented a small script that submits ISRCs from cue files to musicbrainz. The mbid/discid isn't yet found/calculated. That part could be done with the help of @kepstin's http://www.kepstin.ca/projects/image-id.
Not really sure if I can implement this for 2.0. I'll see. I do take patches though ;-)
Still planned, but moved to 2.1.x, so I am hopefully able to release version 2 soon, since I already wanted to do that a long time ago.
It would be handy if isrcsubmit could read/submit ISRCs from .cue files which include them.