Spotify2MusicBrainz.py (pre-?)alpha testing release

Hello!

I mentioned some time ago that I was working on a couple of scripts to help feed data into MusicBrainz. The first of these is actually usable now:

Once you’ve downloaded it and installed its dependency, you can call it using ./spotify2musicbrainz.py spotify:album:0QScw4gpLu1w9au1Mcf3FL (replacing the Spotify URI at the end with the one for the album you want to add).

It’s still in very early development, but hey, “release early, release often”. This is at least the “release early” part, no promises on the “often”. :slight_smile:

7 Likes

Version 0.3.0 was just pushed which now authenticates against the Spotify Web API, so it should work again.

Spotify2MusicBrainz has just been added to PyPI:
https://pypi.python.org/pypi/spotify2musicbrainz

This means it can now be installed via pip on any reasonable Python (3) installation:

pip install spotify2musicbrainz

Command "/usr/bin/python3.5 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-9jgxlt8e/musicbrainzngs/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-uik8_10h-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-9jgxlt8e/musicbrainzngs/

What did I break?

… I have no idea. It seems like it’s an error in musicbrainzngs though, somehow. Does it work if you just do pip install musicbrainzngs (ie., install directly instead of as a dependency)?

Whoo! Managed to get it to work (permissions issues, duh). Added my first release with it. Seems to have worked fine :smile:. Of course since I’m only using it as a basis to add a CD I had to unset a lot of the digital bits, but eh :slight_smile:

Well, now you can run the script again to add the Digital Media streamable release version. :wink:

hi, cannot make it work. any hint/steps?

thanks

Hi @ertert. The script is fairly basic and may require some knowledge of Linux/Unix commandline and/or Python to get working. That said, I can’t really help you if you don’t provide more information. Sorry.

2 Likes

Hi @Freso, is there any reason why we can’t just run this through a bunch of playlists to pull out all the information from each song (and album) and add it to the MusicBrainz database? I’m very new here, but I was exploring the Spotify API and I don’t think it is that hard to pull lots of information from their database. If we asked some people to run this (the more the better), we could add thousands (millions?) of track and album information to the database. Does adding redundant information to the MusicBrainz database cause problems? Or are there errors in Spotify’s data?

Yeah - at the very least somebody will have to merge the duplicates by hand later.

It’s not too bad, although dates can be completely wrong sometimes. It’s also not ideal (and especially for classical music it looks nothing like the format we’d like to have).

That said, the main reasons are that a) it’s probably against the API’s TOS and b) it’s impossible for people to check the additions for errors if we add thousands per day. I definitely wouldn’t be against letting users import directly from the Spotify site with a button like with other importing userscripts though, so that the user is responsible for checking that the data is correct and not a duplicate :slight_smile:

We generally frown on fully-automated adding of data to the database. See e.g.,

I’ve found Spotify’s release dates to be pretty hit and miss. For most current/modern releases (where digital and physical editions are released simultaneously (if they have a physical manifestation!)), it will likely be correct, but Spotify stores the oldest release date, and it’s unlikely that a digital media online streaming album was released in, say, 1978… (This is also the reason my importer—that this topic is about—doesn’t include release date information.)

1 Like

could you add this into the plugins ?

Of… ? Picard? Spotify2MusicBrainz.py is not a Picard plugin and doesn’t make sense to run from a Picard context. The script is for copying data from Spotify into MusicBrainz (similar to what many userscripts do), not for assisting to tag music you already have.

2 Likes

@Freso I have just used your plugin and it was amazingly simple! Thanks a lot to save so much time!!! :beers: :clap:

2 Likes

how am i supposed to use this- as a complete newbie- from A t o Z pls

Here is what I did on Linux, Windows must be very similar:

install
pip install spotify2musicbrainz

try importing 1 album
spotify2musicbrainz https://open.spotify.com/album/4ozK6tMkDnawcF3VN2PMfa

This process creates an html form that when opened by browser will present you with MB import dialog. In my case, my default browser is Opera and it can not open files in /tmp folder, so I had to copy to my home and open it there with the browser (CTRL+O).

And that’s it, the rest is just standard import process in MB.

I find this script great, especially that unlike a-tisket, the source code is available. I’m importing mostly Classical and the script needs some improvements to follow Classical Style Guide, which shouldn’t be difficult to do (I assume this is GPL’d).

Edit. one can set an environment variable TMP (in my case in .bashrc) to a diff directory than \tmp, I’ve set it up to /home/user/tmp and browser opens the html form without further intervention.

2 Likes

The project is pretty much cancelled now. I don’t even use it myself. :slight_smile: I’d recommend you use atisket (forum thread: A multi‐source seeder for digital releases) instead. It has a lot more features and a lot more flexibility.

1 Like