beets icon indicating copy to clipboard operation
beets copied to clipboard

Beatport plugin

Open willgrnr opened this issue 11 years ago • 21 comments

According to http://beets.readthedocs.org/en/v1.3.10/plugins/beatport.html?highlight=beatport Beatport shut down their API. I'm not sure if you may have done this already, however they have an early sign up for their new API. A beatport plugin would be incredible as I have a lot of EDM tracks, oddball remixes and so on that only Beatport recognizes or has proper tags for.

The sign up is: http://developers.beatport.com/

There is also some interesting information about using the old API here: https://groups.google.com/forum/#!topic/beatport-api/zntW_B00_CM

I can imagine this is a pretty dead plugin that most don't care about, however if you have some free time to look into this, that would be great.

I apologize that this is not an issue, and you can by all means delete this after you've read it - I just wasn't sure where else to ask.

willgrnr avatar Feb 03 '15 07:02 willgrnr

Thanks for the heads-up! I hadn't seen the new sign-up yet. I've now requested access. If I hear anything back, I'll reopen this ticket or create a new one and we can revive the plugin.

sampsyo avatar Feb 03 '15 17:02 sampsyo

I've make Python functions that gets informations from Beatport search. But I fail to implement correctly in a beets plugin. What can I do ?

tux-00 avatar Jun 10 '15 16:06 tux-00

How far have you gotten? Perhaps if you make your work public, we can pitch in and help.

Maybe the code for the old Beatport plugin would be a good starting point?

sampsyo avatar Jun 11 '15 03:06 sampsyo

Yes I have read the old Beatport plugin and make a repository with my code : https://github.com/tux-00/beets-beatport-plugin

The _search function parse data (url, title, artist, remixer, label, genre and release date) of a search result on classic.beatport.com. The _get_track_page_infos take url as parameter and retrieve bpm, key, album and length. But this function is not used at this time. The best solution sould be to use this function after the user choice because this function load one URL by track and it cant be done with all results (too slow).

This script use classic.beatport.com. The script gets informations into the table retrieved by a search on classic.beatport.com.

tux-00 avatar Jun 15 '15 10:06 tux-00

OK! Can you let us know when this seems ready to merge back into beets mainline?

sampsyo avatar Jun 15 '15 23:06 sampsyo

The plugin seems to run correctly but I need some informations.

When beets run in verbose mode I can't see if beets receives data from my plugin but he displays only MusicBrainz data.

Have I to display some text ? (For choices, data, ...)

tux-00 avatar Jun 16 '15 12:06 tux-00

You could consider logging some debug information (with self.log.debug('hello') in your plugin) to make sure it's working.

Your plugin does not need to print anything itself; the existing UI components take care of that.

sampsyo avatar Jun 17 '15 18:06 sampsyo

Ok nice. Must I use AlbumInfo class ? Because actually the plugin parse only track informations. I can't see bpm, key or genre tags in TrackInfo or AlbumInfo. Is it normal ?

tux-00 avatar Jun 19 '15 16:06 tux-00

Must I use AlbumInfo class ? Because actually the plugin parse only track informations.

If you only match per-track information, then beets will only be able to tag individual tracks (i.e., in the importer's --singletons mode). That's probably fine for a 1.0 effort, but eventually it would be great to match entire albums.

I can't see bpm, key or genre tags in TrackInfo or AlbumInfo. Is it normal ?

Yes, you're right—at the moment, no source can provide that information, so we haven't added it to TrackInfo and AlbumInfo. But we could definitely do that if Beatport can provide that data.

sampsyo avatar Jun 19 '15 16:06 sampsyo

Ok, thanks! It works. But where can I get the query ? Because beatport founds the exact track but beets doesn't display the corresponding tracks.

Example: File: Ben Sims - The Afterparty (Original Mix) Item search terms: Ben Sims - The Afterparty (Original Mix) My plugin search query: Ben Sims The Afterparty (Original Mix) My plugin search function return: title: The Afterparty (Original Mix) artist: Ben Sims

Search URL: http://classic.beatport.com/search?query=Ben+Sims+-+The+Afterparty+%28Original+Mix%29

The first track that beets displays is a track from MusicBrainz with 94% of similarity. If I want more results there is only one entry from beatport:

Simon Shaw - Ushuaia Ibiza Summer Edition 2014 - The Afterparty Mix (Original Mix) (47.6%) (title, artist, source) (Beatport)

tux-00 avatar Jun 20 '15 19:06 tux-00

Hmm, it's a little hard to tell what's going wrong without doing some debugging. Is the plugin at https://github.com/tux-00/beets-beatport-plugin in a state that I can try installing it and running this query in my own import?

sampsyo avatar Jun 20 '15 21:06 sampsyo

Yes, I have updated the plugin and normally it can be run.

tux-00 avatar Jun 22 '15 19:06 tux-00

Awesome. I'll take a look soon.

sampsyo avatar Jun 23 '15 18:06 sampsyo

I think I found the problem: beets tries to de-duplciate matches with the same ID. That means that, if two TrackInfo object have the same track_id field, only one will show up as a final match. So this problem should go away if you provide a unique value for track_id when constructing your TrackInfo objects.

Woohoo!

sampsyo avatar Jul 01 '15 21:07 sampsyo

Ok I will take a look as soon as possible!

tux-00 avatar Jul 04 '15 22:07 tux-00

Ok, it works (test with a variable incremented by 1).

But what track_id should I send ?

When I look at beets/autotag/hooks.py, I can see: "- track_id: MusicBrainz ID; UUID fragment only"

Should I send the ISRC of the track ?

Why beets founds 90.6% for Benjamin Damage - 010x while the search is Benjamin Damage - 010x (Original Mix) ? :

Finding tags for track "Benjamin Damage - 010x (Original Mix)".
Candidates:
1. Benjamin Damage - 010x (90.6%) (title)
2. Benjamin Damage - 010x (Original Mix) (85.7%) (source) (Beatport)

tux-00 avatar Jul 05 '15 18:07 tux-00

Awesome!

But what track_id should I send ?

Good question—is there some Beatport-specific ID, perhaps a URL fragment, that one could (hypothetically) use to look up the track again later?

Why beets founds 90.6% for Benjamin Damage - 010x while the search is Benjamin Damage - 010x (Original Mix) ? :

I'm not totally sure, but some of it is probably from the source penalty, i.e., this line: https://github.com/tux-00/beets-beatport-plugin/blob/master/beatport.py#L22

sampsyo avatar Jul 06 '15 02:07 sampsyo

Do you have any news from the beatport API ? Can we know if this API will be open ?

Good question—is there some Beatport-specific ID, perhaps a URL fragment, that one could (hypothetically) use to look up the track again later?

Maybe the track URL ? Else there is nothing except numbers like "285282" but when I search on beatport he returns nothing.

I'm not totally sure, but some of it is probably from the source penalty, i.e., this line: https://github.com/tux-00/beets-beatport-plugin/blob/master/beatport.py#L22

Yes, I have removed this line and now beets send 100%. Nice! I need to add some options.

Is there a way to disable MusicBrainz ?

Can I send tags informations to beets after the user choice or before the process of tagging ? Maybe with the "write" section here: https://github.com/sampsyo/beets/blob/master/docs/dev/plugins.rst#listen-for-events ? Because I can't load 2 web pages by track result due to performance.

Maybe the issue can be reopen ?

tux-00 avatar Jul 06 '15 06:07 tux-00

I'm not 100% sure! but can we find out somehow what ID is used in the API?

Is there a way to disable MusicBrainz ?

Not currently, no.

Can I send tags informations to beets after the user choice or before the process of tagging ?

No, beets needs the full information about each track before it performs the weighting and then presents data to the user. Sorry!

Perhaps we should actually open a new issue for the new plugin!

sampsyo avatar Jul 06 '15 16:07 sampsyo

@tux-00 any recent updates on this? This would be an amazing plugin.

willgrnr avatar Jul 26 '15 06:07 willgrnr