Easy CD AcoustID submit without ripping

Is there a way to deactivate multithreading in Picard?

Could be with secret command line option, a config file, a global Python option, or anything.

Or a command line solution for scanning (fpcalc?) CD tracks + submitting to release recordings?

It would be helpful for me because, at the moment, I have to manually drop CD tracks (virtual files) one by one in the left-hand pane and then scan them manually Ctrl+Y one by one for AcoustID.

Because I work directly on CD in CD drive to submit AcoustID without ripping.


Update

I am also exploring the fpcalc (from libchromaprint-tools) command line method:

This does scan tracks sequencially:

/run/user/1000/gvfs/cdda:host=sr0$
for i in {1..20}; do fpcalc Track\ $i.wav; done

But there are no options to submit AcoustID to MB release recordings, yet.

For the fpcalc approach, do you have a list of recording MBIDs, or only the release MBID? I don’t see release MBIDs mentioned in the API docs at Web Service | AcoustID.

I haven’t used it before, but https://github.com/beetbox/pyacoustid looks like it can submit AcoustIDs. If you have recording MBIDs, maybe you could do something like this (from a new script in the same directory as the pyacoustid repository):

#!/usr/bin/env python3

import acoustid

API_KEY = '...'
USER_KEY = '...'
MBIDS = [
    '1234-...',
    '5678-...',
    # etc.
]

for i, mbid in enumerate(MBIDS):
    fn = 'Track %d.wav' % (i+1)
    (dur, fp) = acoustid.fingerprint_file(fn)
    acoustid.submit(API_KEY, USER_KEY, {
        fingerprint: fp,
        duration: dur,
        mbid: mbid,
    })

Disclaimer: Untested and I haven’t written any Python code in a long time, so all bets are off.

Probably you could call the MB API first to get the recording IDs if needed.

2 Likes

Wow, thanks so much for all this info!

I will indeed have to call MB web service first to get recording MBID from release MBID.
I have never written or understood Python, yet.
I will keep this in mind and I will try, someday!

I rename the topic.

Here it is with some terrible, terrible code to fetch the recordings:

#!/usr/bin/env python3

import acoustid
import re
from urllib.request import urlopen

API_KEY = '...'
USER_KEY = '...'
RELEASE_MBID = '1234-...'

url = 'https://musicbrainz.org/ws/2/release/%s?inc=recordings' % RELEASE_MBID
page = urlopen(url).read().decode()
mbids = re.findall(r'(?<=recording id=")[^"]+', page)

for i, mbid in enumerate(mbids):
    fn = 'Track %d.wav' % (i+1)
    (dur, fp) = acoustid.fingerprint_file(fn)
    acoustid.submit(API_KEY, USER_KEY, {
        fingerprint: fp,
        duration: dur,
        mbid: mbid,
    })
2 Likes

Woaaw :scream: Superb!

Apparently, I could pass the MBID in the command line python3 myscript.py <MBID> and then get in in the code with something like:

url = 'https://musicbrainz.org/ws/2/release/%s?inc=recordings' % sys.argv[1]

Or using argparse could bring a professional touch.

And it seems you managed the iteration of i without having to give it the max!

  • And API_KEY seems to be a client key I have to obtain from https://acoustid.org/webservice
  • And USER_KEY seems to be the user key I already have in Picard options

Alternatively, in case I don’t manage to make or debug Python script (because I don’t know it at all), I could probably use curl, httpie or wget in a bash script (I have them 3 in my Debian 10 Xfce Linux, don’t know which one was pre-installed).

Maybe it would be hyper tedious but at least I know the syntax a little bit.

2 Likes

Run Picard from source and edit the file that creates the threadpool to change the size to 1. This should serialise all the disk I/O.

You might want to consider copying the files from CD to a temp directory first and then running acoustid on the disk copy - this is likely to be a lot faster overall.

To do the acoustid in batch, the steps would be:

  1. Run fpcalc on the file.
  2. Associate the file with a MB recording
  3. Submit the acoustid

The first and last of these are easy. The second isn’t as it requires human judgement and a decent UI - which Picard provides. IMO the best way to do this might be:

  1. Copy CD to a temp directory
  2. Tag the files in the temp directory with Picard
  3. Submit the acoustids
  4. Delete the files.

Only you will be able to decide whether this is faster overall than your current workflow.

3 Likes