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

#872: Tag change hooks #1499

Merged
merged 8 commits into from
Nov 7, 2015
Merged

#872: Tag change hooks #1499

merged 8 commits into from
Nov 7, 2015

Conversation

m-urban
Copy link
Contributor

@m-urban m-urban commented Jun 6, 2015

This PR adds the new hooks albuminfo_received and trackinfo_received for developers who would like to intercept fetched meta data, before they are applied in tag manipulation operations. See #872

@m-urban m-urban force-pushed the tag-change-hook branch 2 times, most recently from 89e38b7 to 678816f Compare June 6, 2015 10:58
@m-urban
Copy link
Contributor Author

m-urban commented Jun 6, 2015

FYI, although the tests completed successfully, I just noticed, that AppVeyor throws a ton of warnings for unloaded plugins, unrelated to this PR: https://ci.appveyor.com/project/sampsyo/beets/build/176

@sampsyo
Copy link
Member

sampsyo commented Jun 6, 2015

Don't worry about AppVeyor; the tests are broken on Windows (see #670). I set up AppVeyor so we can see how close we're getting to passing the tests there, so it's fine to just ignore it for now unless you're specifically working on Windows-related issues.

Thanks for opening the PR! I'll merge this as soon as a get a moment.

@m-urban
Copy link
Contributor Author

m-urban commented Jun 21, 2015

Any chance to merge this in? :)

@sampsyo
Copy link
Member

sampsyo commented Jun 22, 2015

Sorry for being slow on this; I'm finishing up a thesis. Should be done this week, after which my beets bandwidth should increase.

I've got a just a couple of small comments, after which we can hit the green button.

plugin_albums = plugins.album_for_id(album_id)
for a in plugin_albums:
plugins.send('trackinfo_received', info=a)
candidates.extend(plugin_albums)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we have a loop in this function anyway, let's make it go over the entire candidates list, and eliminate the event in the special _for_mbid functions. A little less code for a little more clarity.

@m-urban
Copy link
Contributor Author

m-urban commented Jun 22, 2015

No worries, I am sitting in the same thesis boat right now :)
All valid points - I'll let you know when I'll have factored in your thoughts.

@Kernald
Copy link
Contributor

Kernald commented Oct 26, 2015

I would love to see this merged. Can I help in any way?

@sampsyo
Copy link
Member

sampsyo commented Oct 26, 2015

It looks like the loose ends consist of one little code simplification and a couple of documentation clarity enhancements. If you're interested, you can beat one of us to it by opening a revised PR based on this one that adds a couple more commits! That would be awesome.

- Integrated support for plugins
- Added documentation
- Updated changelog
@m-urban
Copy link
Contributor Author

m-urban commented Nov 6, 2015

Finally found some spare time to finish up the loose ends of this PR. I'm on it!

@sampsyo
Copy link
Member

sampsyo commented Nov 6, 2015

Awesome! Thanks, @m-urban! ✨

- Fixed wrong event being emitted
…s are only called when searching for explicit IDs
@m-urban
Copy link
Contributor Author

m-urban commented Nov 7, 2015

Ok, let's give this another shot. I needed to find a new spot to emit the events because the hooks.*_for_id -methods are only called when searching for explicit IDs. Any objections, @sampsyo?

@m-urban
Copy link
Contributor Author

m-urban commented Nov 7, 2015

Darn, I forgot about mbsync and other plugins now - the current implementation in match.py doesn't work, then. I am afraid this makes my original approach from 1708939 the only viable option… any thoughts?

@m-urban
Copy link
Contributor Author

m-urban commented Nov 7, 2015

Ok, forget everything I said today. Quick summary: Concerning

https://github.com/sampsyo/beets/blob/6e980a977ec03dc46fb5fb9036666d9677ecf22e/beets/autotag/hooks.py#L514-L517

and

https://github.com/sampsyo/beets/blob/6e980a977ec03dc46fb5fb9036666d9677ecf22e/beets/autotag/hooks.py#L537-L540

your suggestion was:

Since we have a loop in this function anyway, let's make it go over the entire candidates list, and eliminate the event in the special _for_mbid functions. A little less code for a little more clarity.

The problem is that the *_for_mbid functions are sometimes called directly, in which case the events would not be triggered.

@sampsyo
Copy link
Member

sampsyo commented Nov 7, 2015

You're right, of course—thanks for catching that! Eventually, it wold be nice if everything went through a common interface, but that's clearly not the case now.

@sampsyo sampsyo merged commit 6e980a9 into beetbox:master Nov 7, 2015
sampsyo added a commit that referenced this pull request Nov 7, 2015
sampsyo added a commit that referenced this pull request Nov 7, 2015
sampsyo added a commit that referenced this pull request Nov 7, 2015
@sampsyo
Copy link
Member

sampsyo commented Nov 7, 2015

All merged up! Thank you for taking care of this. ✨

@m-urban
Copy link
Contributor Author

m-urban commented Nov 7, 2015

👍

@m-urban m-urban deleted the tag-change-hook branch November 7, 2015 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants