Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

acousticbrainz: Submit analyses upstream to AB #2253

Closed
Freso opened this issue Nov 2, 2016 · 5 comments
Closed

acousticbrainz: Submit analyses upstream to AB #2253

Freso opened this issue Nov 2, 2016 · 5 comments
Labels
feature features we would like to implement

Comments

@Freso
Copy link
Member

Freso commented Nov 2, 2016

Originally planned for being part of #1629 (which was resolved with #1787), the feature for the "acousticbrainz" plugin to run the analysis locally and submit results back to AcousticBrainz never made it in. It would still be a neat thing to have though. :)

@Freso Freso added the feature features we would like to implement label Nov 2, 2016
@sampsyo sampsyo changed the title Allow acousticbrainz plugin to submit analyses upstream to AB acousticbrainz: Submit analyses upstream to AB Nov 2, 2016
@sampsyo
Copy link
Member

sampsyo commented Nov 2, 2016

Yes; thanks for opening a reminder ticket!

@inytar
Copy link
Contributor

inytar commented Dec 15, 2016

I'd like to pick this u if possible.

@sampsyo
Copy link
Member

sampsyo commented Dec 15, 2016

Wonderful! Let's do it. This task has two parts: running the analysis program to get data and submitting the results to the web service API. Both start with information gathering: you'll want to look into the details for how to go both things and discuss your findings here. Sound good?

@inytar
Copy link
Contributor

inytar commented Dec 21, 2016

Sound perfect! Here's my research:
Analysis:

Uploading:

  • Uploading should be done by using POST to the url https://acousticbrainz.org/api/v1/<MBID>/low-level.
  • MBID is called recording id in different places, but all code uses the musicbrainz_trackid.
  • The output file from the extractor and the sha1sum of the extractor program set to metadata: version: essentia_build_sha are send to the server (if you do not add the sha1sum the server responds with the error { "message": "Key 'metadata : version : essentia_build_sha' was not found in submitted data."})
  • Content type header should be set to application\json else the server will respond with the error: { "message": "Cannot parse JSON document: No JSON object could be decoded"}.

@sampsyo
Copy link
Member

sampsyo commented Dec 21, 2016

Really awesome; thank you for looking into it! This all checks out, and it sounds like it should make the implementation relatively straightforward. We can just run the extractor agains the files and use requests to hit the AB API.

The only tricky part is that we'll need to compute the hash of the extractor executable, which we can do in a way similar to this: https://github.com/MTG/acousticbrainz-client/blob/c135a557c61984effcdb9d7a0c2686a64829b217/abz/config.py#L115-L118

Not too hard!

So I think the next step is to start making the plugin skeleton. Maybe a good place to start would be to look at the keyfinder plugin, which is quite small and also needs to invoke an external tool to do its work. The key API is util.command_output, which is used to run another tool and collect its stdout.

Let us know if any other advice would be helpful!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature features we would like to implement
Projects
None yet
Development

No branches or pull requests

3 participants