Skip to content

Commit

Permalink
Merge pull request #93 from meeechelle/prevent-favorite-editing
Browse files Browse the repository at this point in the history
Don't error when trying to modify favorites
  • Loading branch information
mcarlton00 authored Oct 17, 2020
2 parents 8770b31 + 3a28e32 commit 3b710a3
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions mopidy_jellyfin/playlists.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,20 +102,26 @@ def delete(self, uri):
Deletes a playlist from the server and local cache
'''
playlist_id = uri.split(':')[-1]
result = self.backend.remote.delete_playlist(playlist_id)

# True if the delete succeeded, False if there was an error
if result:
del self._playlists[uri]
self.refresh()
return True
if 'favorite-' in playlist_id:
logger.warning('Favorite playlists are dynamically generated and cannot be deleted')
else:
result = self.backend.remote.delete_playlist(playlist_id)

# True if the delete succeeded, False if there was an error
if result:
del self._playlists[uri]
self.refresh()
return True
return False

def save(self, playlist):
'''
Update the remote playlist when it's modified locally
'''
playlist_id = playlist.uri.split(':')[-1]
if 'favorite-' in playlist_id:
logger.warning('Favorite playlists cannot be modified')
return None

# Get the list of Jellyfin Ids for each track of the playlist
new_track_ids = [
Expand Down

0 comments on commit 3b710a3

Please sign in to comment.