soco.plugins.wimp module
Plugin for the Wimp music service (Service ID 20)
- class soco.plugins.wimp.Wimp(soco, username, retries=3, timeout=3.0)[source]
Class that implements a Wimp plugin.
Note
There is an (apparent) in-consistency in the use of one data type from the Wimp service. When searching for playlists, the XML returned by the Wimp server indicates, that the type is an ‘album list’, and it thus suggest, that this type is used for a list of tracks (as expected for a playlist), and this data type is reported to be playable. However, when browsing the music tree, the Wimp server will return items of ‘album list’ type, but in this case it is used for a list of albums and it is not playable. This plugin maintains this (apparent) in-consistency to stick as close to the reported data as possible, so search for playlists returns MSAlbumList that are playable and while browsing the content tree the MSAlbumList items returned to you are not playable.
Note
Wimp in some cases lists tracks that are not available. In these cases, while it will correctly report these tracks as not being playable, the containing data structure like e.g. the album they are on may report that they are playable. Trying to add one of these to the queue will return a SoCoUPnPException with error code ‘802’.
Initialize the plugin.
- Parameters
soco – The soco instance to retrieve the session ID for the music service
username (str) – The username for the music service
retries (int) – The number of times to retry before giving up
timeout (float) – The time to wait for the post to complete, before timing out. The Wimp server seems either slow to respond or to make the queries internally, so the timeout should probably not be shorter than 3 seconds.
- Type
soco.SoCo
Note
If you are using a phone number as the username and are experiencing problems connecting, then try to prepend the area code (no + or 00). I.e. if your phone number is 12345678 and you are from denmark, then use 4512345678. This must be set up the same way in the Sonos device. For details see here (In Danish)
- property name
Return the human read-able name for the plugin
- property username
Return the username.
- property service_id
Return the service id.
- property description
Return the music service description for the DIDL metadata on the form
'SA_RINCON5127_...self.username...'
- get_tracks(search, start=0, max_items=100)[source]
Search for tracks.
See get_music_service_information for details on the arguments
- get_albums(search, start=0, max_items=100)[source]
Search for albums.
See get_music_service_information for details on the arguments
- get_artists(search, start=0, max_items=100)[source]
Search for artists.
See get_music_service_information for details on the arguments
- get_playlists(search, start=0, max_items=100)[source]
Search for playlists.
See get_music_service_information for details on the arguments.
Note
Un-intuitively this method returns MSAlbumList items. See note in class doc string for details.
- get_music_service_information(search_type, search, start=0, max_items=100)[source]
Search for music service information items.
- Parameters
Note
Un-intuitively the playlist search returns MSAlbumList items. See note in class doc string for details.
- browse(ms_item=None)[source]
Return the sub-elements of item or of the root if item is None
- Parameters
item – Instance of sub-class of
soco.data_structures.MusicServiceItem
. This object must have item_id, service_id and extended_id properties
Note
Browsing a MSTrack item will return itself.
Note
This plugin cannot yet set the parent ID of the results correctly when browsing
soco.data_structures.MSFavorites
andsoco.data_structures.MSCollection
elements.
- static id_to_extended_id(item_id, item_class)[source]
Return the extended ID from an ID.
- Parameters
item_id (str) – The ID of the music library item
cls (Sub-class of
soco.data_structures.MusicServiceItem
) – The class of the music service item
The extended id can be something like 00030020trackid_22757082 where the id is just trackid_22757082. For classes where the prefix is not known returns None.