Closed 0xtobit closed 9 years ago
Related to #41.
This isn't working for me as is. I can neither create a new playlist or overwrite an existing one.
I take that back. I can overwrite an existing one; I just can't create a new playlist.
Or rather, it does create the playlist but shows an error. It should check whether the playlist exists before trying to remove it.
Thank you, I'll try and make some time to look into this issue and fix it.
Hey @connermcd I added a fix but I'm not sure I'm happy with it. This will catch all exceptions, which isn't the best practice, so I can refine it if you'd like.
If you would like me to revise it, I was hoping you could give me a bit of a recommendation on what kind of exception I could specifically catch (I tried a std::string
and an mpd_error
to no avail. Alternatively if there's a function to check if a playlist already exists that I couldn't find, I think that would suit nicely.
Hey @0xtobit, thanks for following up on this. Unfortunately the solution still throws an error when trying to create a new playlist on top of not being best practices. I think the best solution is to first check if the playlist exists, and if so then remove it.
Right, do you know of any function already existing to check if a playlist exists?
Also that seems a little bit weird, I did not get an error anymore...
I only get the error when creating a playlist that does not already exist. It is trying to remove a playlist that is not there.
I don't know of an existing function.
Alright I'll keep digging, thanks!
I give up, I cannot figure out how to properly determine whether a playlist exists with mpd before removing it.
See #51 for my alternate solution.
As another note, I originally did these commits on master, but I didn't like that. I cleaned my master to reflect upstream and now this PR looks empty, for my code so far, please see the branch playlist_exists in my fork.
Issue #10, #11 and #12 describe the issue and fix for updating/saving a playlist that already exists. It appears that this was fixed, in 7d064482ba4379555cc6a068e4846f3e70269c96. However when I cloned, this commit seemed to be nowhere in the history. And HEAD was missing the line to remove the playlist before saving it. So I added it. I compiled and tested and it lets me overwrite playlists with saving.
Hope this helps, apologies if I've misunderstood something.