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
Fix playlist not found for disambiguated MPD playlists #415
Fix playlist not found for disambiguated MPD playlists #415
Conversation
… MPD playlist names to mopidy playlists in all MPD playlist handling commands. Also make playlist_uri_from_name map private.
""" | ||
Helper function to retrieve a playlist from it's unique MPD name. | ||
""" | ||
if len(self._playlist_uri_from_name) == 0: |
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.
Just checking if self._playlist_uri_from_name:
is preferred from a python style point of view.
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.
Yep, good point.
I have some more feedback, I just need to think some things over a bit so I don't send you off in the wrong direction with bad advice. |
self.playlist_name_from_uri[playlist.uri] = name | ||
logger.info("Refreshed name mappings for %u playlists" % len(self.playlist_name_from_uri)) |
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.
This was not meant to make it into the changes, I shall remove this.
So path I was heading down in my head was if we should never rest the naming's. Instead simply having a lazy mechanism where we check Otherwise the Beyond those questions I think this is more or less ready. |
Thanks for taking a look, I know you're busy with the other changes. But I'm not sure I quite follow you, what do you mean by "never rest the namings"? Never store the mapping structures? I'm not sure how that could work. Unless I've misunderstood, the scheme you describe sounds exactly like what we've already got in I don't know why I did consider making the opposite helper function, I'm not sure why I didn't bother, might as well do it (and use it once!). |
Also: nicer check that empty _playlist_uri_from_name is empty
if not self._playlist_uri_from_name: | ||
self.refresh_playlists_mapping() | ||
if name not in self._playlist_uri_from_name: | ||
return None; |
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.
No semicolon, please :-)
I'd say, ignore @adamcik's inconsitent ramblings for now and let's keep this pull request to fixing the broken commands instead of redoing #396. That can wait for later if @adamcik can explain his thinking. :-) I've added two minor comments, and agree that:
If you fix these four things, I'll merge. If you don't have the time, just say so, and I'll fix it myself. I want this in for 0.14. :-) |
Sure, I'll get on it now. |
Just to clarify, not something you should act on for this PR: I actually meant «never reset the namings», that's what I get for not reading over before firing this off when tired :-) So basically more or less as is, just get rid of the |
…st-not-found Fix playlist not found for disambiguated MPD playlists
Thanks :-) |
Oh I see, that does make a lot more sense! Anyway, hopefully this is good enough for now. |
As part of the fix for #114 the following MPD commands don't work for playlists with disambiguated names.
This pull request builds on the work in #396 with a generic MPD playlist lookup helper function and some additional tests.