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
MPDStats Plugin: handle update_rating when item is None / start tests for mpdstats #1443
Conversation
@@ -203,6 +203,9 @@ def update_item(self, item, attribute, value=None, increment=None): | |||
def update_rating(self, item, skipped): | |||
"""Update the rating for a beets item. |
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.
Can you add a note to the docstring here? Something like
`item` can either be a beets `Item` or None, in which case nothing changes
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.
Good idea - done!
Awesome! Thanks for getting to the bottom of this, and even adding tests. 😃 ✨ 🐟 It looks like this case is already handled for the other events: |
Not a problem! I did see where |
Alright, squashed commits - and hopefully that fixes the tests! |
Great! Thank you! |
MPDStats Plugin: handle update_rating when item is None / start tests for mpdstats
I had a small issue where I would play a song with MPD that wasn't imported by beets. So, when mpdstats tried to update the rating it would throw up an AttributeError that looks like:
Obviously the better fix would be to import the song with beets ;) - but since MPD can play songs that beets may or may not have, it would be good to sanity check it and not kill the plugin.
Also started some tests for mpdstats which checks this!