-
Notifications
You must be signed in to change notification settings - Fork 110
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
Implemented playlist save & delete #80
Conversation
If nothing else (haven't looked at the code yet, except it's relative short length), this is a nice kick in the but to have me fix this once and for all. Thanks :-) |
Just tested this functionality. Adding a new track to a new playlist seems to work in ncmpcpp, you end up with two playlists for the newly created playlist "mopidy" however: (as seen in ncmpcpp)
Adding another song to the playlist also works. Adding a song from the "playlists browser" in ncmpcpp shows an error, but does add the track to the playlist.
Deleting a song from the playlist also shows an error, but actually succeeds.
Renaming also works, but ncmpcpp's playlist view isn't being updated. I am not sure if this is a bug of mopidy or ncmpcpp though. (sonata also does not seem to update playlists) |
Getting rid of those errors is quite simple: just make sure to return the playlist from the input param at the end of the save method:
This is what save method in mopidy.core.playlists requires. Everything works like a charm after that change. |
And a comment on delete() method. It didn't work on my installation, here's an adjusted version with comments:
|
Another comment on the save method. The check that decides if a track has been added:
may break if there are some tracks in sp_playlist that are no longer available on Spotify. playlist doesn't include such tracks but sp_playlist does so this comparison will not always be correct. Solution: iterate through sp_playlist and ignore unavailable tracks when computing the count. Use that count instead:
|
To simplify the development setup I removed the With the recent porting of Mopidy to Python 3, the current |
It's pretty shitty but it adds rudimentary playlist saving. (As requested e.g. in #22 )
Needs unit tests.