Skip to content

Commit

Permalink
Guard against slave players in create_sonos_playlist_from_queue
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian committed Jan 13, 2018
1 parent fdf61e7 commit b794e34
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions soco/playlists.py
Expand Up @@ -13,6 +13,7 @@
DidlPlaylistContainer
)
from .data_structures import to_didl_string
from .exceptions import SoCoSlaveException


class PlaylistManager(object):
Expand Down Expand Up @@ -88,6 +89,12 @@ def create_sonos_playlist_from_queue(self, title, player=None):
# but this has not been tested. This method is what the
# controller uses.
player = player or self.soco
if not player.is_coordinator:
message = 'The method "{0}" can only be used '\
'on the coordinator in a group'.format(
self.create_sonos_playlist_from_queue.__name__)
raise SoCoSlaveException(message)

response = player.avTransport.SaveQueue([
('InstanceID', 0),
('Title', title),
Expand Down

0 comments on commit b794e34

Please sign in to comment.