-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Early stage pipeline plugin functions #2814
Conversation
Got it! Thanks for explaining why it's nice for this to run first. I can see it being a good idea in general for It would be good to come up with a general way to prioritize import stages. We don't have to go crazy with anything too elaborate (such as a priority score), but how about just a mechanism for asking to be inserted at the beginning of the list? For example, we could add an |
So if I understand correctly, plugins would be either 'regular' or 'early' and 'early' ones would always run before 'regular' ones but other than that the order would be still non-deterministic? That's very similar to what I was trying with the priority groups, except I had three and this only has two. I'll have a go at it tomorrow. |
Yeah, you got it exactly. I could also see three groups, but two might suffice—I don't quite see a use case at the moment for running as late as possible. |
It can always be added later if the need arises. |
257a557
to
3a15d3c
Compare
3a15d3c
to
d4625bc
Compare
I've added functionality for early stage functions, decided it might be even better because plugins can now request to have part of their functions ran early and the rest at the normal time. I think it might be worthwhile to add a test for this as well, have a plugin with 1 early and 1 normal function in the pipeline and check that they run in the correct order. I'll add one after we agree on the final implementation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks perfect! To finish this off, could you please document the new API in the plugin docs (and add a quick changelog entry)?
beets/plugins.py
Outdated
plugin: specifically, the logging level is adjusted to WARNING. | ||
""" | ||
return [self._set_log_level_and_params(logging.WARNING, import_stage) | ||
for import_stage in self.early_import_stages] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps the logging wrapper code (here and in the function below) can be factored out into a helper function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure.
Done, though I haven't written a test as I initially planned because unfortunately I don't know how. |
Early stage pipeline plugin functions
Awesome; thank you! ✨ 🐟 🌹 Merged. |
This is a bug report together with a PR because I like to scratch my own itch :)
Something has been bugging me for quite some time after switching to Opus - some of the albums I've imported didn't have replaygain calculated, even though the replaygain plugin did definitely run. After lots of debugging the issue seems to be as follows:
replaygain
calculated again, manuallyI've added a (quite ugly) hack to always convert the file first, which from my testing seems to reliably solve the issue. If you have better idea how to solve this (I've considered dividing the plugins into groups by 'priority' but that felt like an overkill), I'll happily implement it.