{"action":"created","issue":{"url":"https://api.github.com/repos/mopidy/mopidy/issues/937","labels_url":"https://api.github.com/repos/mopidy/mopidy/issues/937/labels{/name}","comments_url":"https://api.github.com/repos/mopidy/mopidy/issues/937/comments","events_url":"https://api.github.com/repos/mopidy/mopidy/issues/937/events","html_url":"https://github.com/mopidy/mopidy/issues/937","id":54571756,"number":937,"title":"Deleting local playlist does not delete corresponding M3U file","user":{"login":"tkem","id":2833077,"avatar_url":"https://avatars.githubusercontent.com/u/2833077?v=3","gravatar_id":"","url":"https://api.github.com/users/tkem","html_url":"https://github.com/tkem","followers_url":"https://api.github.com/users/tkem/followers","following_url":"https://api.github.com/users/tkem/following{/other_user}","gists_url":"https://api.github.com/users/tkem/gists{/gist_id}","starred_url":"https://api.github.com/users/tkem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tkem/subscriptions","organizations_url":"https://api.github.com/users/tkem/orgs","repos_url":"https://api.github.com/users/tkem/repos","events_url":"https://api.github.com/users/tkem/events{/privacy}","received_events_url":"https://api.github.com/users/tkem/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-01-16T12:45:40Z","updated_at":"2015-01-16T13:17:37Z","closed_at":null,"body":"Calling `LocalPlaylistsProvider.delete(uri)` in Mopidy 0.19.5 effectively removes the playlist only from `self._playlists`, but does not delete the underlying M3U file. Therefore, the playlist will re-appear after a restart or a `PlaylistsController.refresh()`.\r\n\r\nLooking into `local/playlists.py`, there seems to be an issue with the mapping of file names to URIs. For example, the file `radio.m3u` in my playlists directory will be assigned the URI `local:playlist:radio`, i.e. without extension, but AFAICS the extension will not be re-added by `LocalPlaylistsProvider._m3u_uri_to_path()`, so `LocalPlaylistsProvider._delete_m3u()` will silently(!) fail.\r\n\r\nI guess this does not only affect deletion of playlists, but probably other playlist API functions that need to access the underlying M3U files, too.\r\n\r\nRegarding local playlist URIs, I also noted that the file \"Radio Österreich.m3u\" is given the URI 'local:playlist:Radio \\xd6sterreich', which is not properly percent-encoded. So, may I suggest refactoring the whole URI-related stuff in `local/playlists.py`, maybe reusing or adapting some of the URI encoding/decoding functions already used for local tracks ;-)"},"comment":{"url":"https://api.github.com/repos/mopidy/mopidy/issues/comments/70251957","html_url":"https://github.com/mopidy/mopidy/issues/937#issuecomment-70251957","issue_url":"https://api.github.com/repos/mopidy/mopidy/issues/937","id":70251957,"user":{"login":"tkem","id":2833077,"avatar_url":"https://avatars.githubusercontent.com/u/2833077?v=3","gravatar_id":"","url":"https://api.github.com/users/tkem","html_url":"https://github.com/tkem","followers_url":"https://api.github.com/users/tkem/followers","following_url":"https://api.github.com/users/tkem/following{/other_user}","gists_url":"https://api.github.com/users/tkem/gists{/gist_id}","starred_url":"https://api.github.com/users/tkem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tkem/subscriptions","organizations_url":"https://api.github.com/users/tkem/orgs","repos_url":"https://api.github.com/users/tkem/repos","events_url":"https://api.github.com/users/tkem/events{/privacy}","received_events_url":"https://api.github.com/users/tkem/received_events","type":"User","site_admin":false},"created_at":"2015-01-16T13:17:37Z","updated_at":"2015-01-16T13:17:37Z","body":"Update: As somewhat expected, when trying to save an existing playlist with another `playlist.name`, I get\r\n```\r\n[Errno 2] No such file or directory: u'/home/tkemmer/.local/share/mopidy/local/playlists/radio'\r\n```\r\nfor M3U file \"radio.m3u\"."}}