soco.data_structures module¶
This module contains classes for handling DIDL-Lite metadata.
DIDL is the Digital Item Declaration Language , an XML schema which is part of MPEG21. DIDL-Lite is a cut-down version of the schema which is part of the UPnP ContentDirectory specification. It is the XML schema used by Sonos for carrying metadata representing many items such as tracks, playlists, composers, albums etc. Although Sonos uses ContentDirectory v1, the document for v2 [pdf] is more helpful.
-
soco.data_structures.
to_didl_string
(*args)[source]¶ Convert any number of
DidlObjects
to a unicode xml string.Parameters: *args (DidlObject) – One or more DidlObject
(or subclass) instances.Returns: A unicode string representation of DIDL-Lite XML in the form '<DIDL-Lite ...>...</DIDL-Lite>'
.Return type: str
-
soco.data_structures.
from_didl_string
(string)[source]¶ Convert a unicode xml string to a list of
DIDLObjects
.Parameters: string (str) – A unicode string containing an XML representation of one or more DIDL-Lite items (in the form '<DIDL-Lite ...> ...</DIDL-Lite>'
)Returns: A list of one or more instances of DidlObject
or a subclassReturn type: list
-
class
soco.data_structures.
DidlResource
(uri, protocol_info, import_uri=None, size=None, duration=None, bitrate=None, sample_frequency=None, bits_per_sample=None, nr_audio_channels=None, resolution=None, color_depth=None, protection=None)[source]¶ Identifies a resource, typically some type of a binary asset, such as a song.
It is represented in XML by a
<res>
element, which contains a uri that identifies the resource.Parameters: - uri (str) – value of the
<res>
tag, typically a URI. It must be properly escaped (percent encoded) as described in RFC 3986 - protocol_info (str) – a string in the form a:b:c:d that identifies the streaming or transport protocol for transmitting the resource. A value is required. For more information see section 2.5.2 of the UPnP specification [ pdf]
- import_uri (str, optional) – uri locator for resource update.
- size (int, optional) – size in bytes.
- duration (str, optional) – duration of the playback of the res
at normal speed (
H*:MM:SS:F*
orH*:MM:SS:F0/F1
) - bitrate (int, optional) – bitrate in bytes/second.
- sample_frequency (int, optional) – sample frequency in Hz.
- bits_per_sample (int, optional) – bits per sample.
- nr_audio_channels (int, optional) – number of audio channels.
- resolution (str, optional) – resolution of the resource (X*Y).
- color_depth (int, optional) – color depth in bits.
- protection (str, optional) – statement of protection type.
Note
Not all of the parameters are used by Sonos. In general, only
uri
,protocol_info
andduration
seem to be important.-
uri
= None¶ (str): a percent encoded URI
-
protocol_info
= None¶ (str): protocol information.
-
duration
= None¶ str: playback duration
-
classmethod
from_element
(element)[source]¶ Set the resource properties from a
<res>
element.Parameters: element (Element) – The <res>
element
-
to_element
()[source]¶ Return an ElementTree Element based on this resource.
Returns: an Element. Return type: Element
-
to_dict
(remove_nones=False)[source]¶ Return a dict representation of the
DidlResource
.Parameters: remove_nones (bool, optional) – Optionally remove dictionary elements when their value is None
.Returns: a dict representing the DidlResource
Return type: dict
-
classmethod
from_dict
(content)[source]¶ Create an instance from a dict.
An alternative constructor. Equivalent to
DidlResource(**content)
.Parameters: content (dict) – a dict containing metadata information. Required. Valid keys are the same as the parameters for DidlResource
.
- uri (str) – value of the
-
class
soco.data_structures.
DidlObject
(title, parent_id, item_id, restricted=True, resources=None, desc='RINCON_AssociatedZPUDN', **kwargs)[source]¶ Abstract base class for all DIDL-Lite items.
You should not need to instantiate this. Its XML representation looks like this:
<DIDL-Lite xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:r="urn:schemas-rinconnetworks-com:metadata-1-0/" xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/"> <item id="...self.item_id..." parentID="...cls.parent_id..." restricted="true"> <dc:title>...self.title...</dc:title> <upnp:class>...self.item_class...</upnp:class> <desc id="cdudn" nameSpace="urn:schemas-rinconnetworks-com:metadata-1-0/"> RINCON_AssociatedZPUDN </desc> </item> </DIDL-Lite>
Parameters: - title (str) – the title for the item.
- parent_id (str) – the parent ID for the item.
- item_id (str) – the ID for the item.
- restricted (bool) – whether the item can be modified. Default
True
- resources (list, optional) – a list of resources for this object.
- None. (Default) –
- desc (str) – A DIDL descriptor, default
'RINCON_AssociatedZPUDN'
. This is not the same as “description”. It is used for identifying the relevant third party music service. - **kwargs – Extra metadata. What is allowed depends on the
_translation
class attribute, which in turn depends on the DIDL class.
-
item_class
= 'object'¶ str - the DIDL Lite class for this object.
-
tag
= 'item'¶ str - the XML element tag name used for this instance.
-
_translation
= {'creator': ('dc', 'creator'), 'write_status': ('upnp', 'writeStatus')}¶ dict - A dict used to translate between instance attribute names and XML tags/namespaces. It also serves to define the allowed tags/attributes for this instance. Each key an attribute name and each key is a
(namespace, tag)
tuple.
-
classmethod
from_element
(element)[source]¶ Create an instance of this class from an ElementTree xml Element.
An alternative constructor. The element must be a DIDL-Lite <item> or <container> element, and must be properly namespaced.
Parameters: xml (Element) – An Element
object.
-
classmethod
from_dict
(content)[source]¶ Create an instance from a dict.
An alternative constructor. Equivalent to
DidlObject(**content)
.Parameters: content (dict) – a dict containing metadata information. Required. Valid keys are the same as the parameters for DidlObject
.
-
__eq__
(playable_item)[source]¶ Compare with another
playable_item
.Returns: True
if all items are equal, elseFalse
.Return type: (bool)
-
__ne__
(playable_item)[source]¶ Compare with another
playable_item
.Returns: True
if any items is unequal, elseFalse
.Return type: (bool)
-
__repr__
()[source]¶ Get the repr value for the item.
Returns: A string representation of the instance in the form <class_name 'middle_part[0:40]' at id_in_hex>
where middle_part is either the title item in content, if it is set, orstr(content)
. The output is also cleared of non-ascii characters.Return type: str
-
__str__
()[source]¶ Get the str value for the item.
Returns: a string representation in the form <class_name 'middle_part[0:40]' at id_in_hex>
where middle_part is either the title item in content, if it is set, orstr(content)
. The output is also cleared of non-ascii characters.Return type: str
-
class
soco.data_structures.
DidlItem
(title, parent_id, item_id, restricted=True, resources=None, desc='RINCON_AssociatedZPUDN', **kwargs)[source]¶ A basic content directory item.
Parameters: - title (str) – the title for the item.
- parent_id (str) – the parent ID for the item.
- item_id (str) – the ID for the item.
- restricted (bool) – whether the item can be modified. Default
True
- resources (list, optional) – a list of resources for this object.
- None. (Default) –
- desc (str) – A DIDL descriptor, default
'RINCON_AssociatedZPUDN'
. This is not the same as “description”. It is used for identifying the relevant third party music service. - **kwargs – Extra metadata. What is allowed depends on the
_translation
class attribute, which in turn depends on the DIDL class.
-
item_class
= 'object.item'¶ str - the DIDL Lite class for this object.
-
tag
= 'item'¶ str - the XML element tag name used for this instance.
-
_translation
= {'stream_content': ('r', 'streamContent'), 'album_art_uri': ('upnp', 'albumArtURI'), 'radio_show': ('r', 'radioShowMd'), 'creator': ('dc', 'creator'), 'write_status': ('upnp', 'writeStatus')}¶ dict - A dict used to translate between instance attribute names and XML tags/namespaces. It also serves to define the allowed tags/attributes for this instance. Each key an attribute name and each key is a
(namespace, tag)
tuple.
-
class
soco.data_structures.
DidlAudioItem
(title, parent_id, item_id, restricted=True, resources=None, desc='RINCON_AssociatedZPUDN', **kwargs)[source]¶ An audio item.
Parameters: - title (str) – the title for the item.
- parent_id (str) – the parent ID for the item.
- item_id (str) – the ID for the item.
- restricted (bool) – whether the item can be modified. Default
True
- resources (list, optional) – a list of resources for this object.
- None. (Default) –
- desc (str) – A DIDL descriptor, default
'RINCON_AssociatedZPUDN'
. This is not the same as “description”. It is used for identifying the relevant third party music service. - **kwargs – Extra metadata. What is allowed depends on the
_translation
class attribute, which in turn depends on the DIDL class.
-
item_class
= 'object.item.audioItem'¶ str - the DIDL Lite class for this object.
-
tag
= 'item'¶ str - the XML element tag name used for this instance.
-
_translation
= {'long_description': ('upnp', 'longDescription'), 'creator': ('dc', 'creator'), 'radio_show': ('r', 'radioShowMd'), 'stream_content': ('r', 'streamContent'), 'rights': ('dc', 'rights'), 'genre': ('upnp', 'genre'), 'language': ('dc', 'language'), 'album_art_uri': ('upnp', 'albumArtURI'), 'description': ('dc', 'description'), 'write_status': ('upnp', 'writeStatus'), 'relation': ('dc', 'relation'), 'publisher': ('dc', 'publisher')}¶ dict - A dict used to translate between instance attribute names and XML tags/namespaces. It also serves to define the allowed tags/attributes for this instance. Each key an attribute name and each key is a
(namespace, tag)
tuple.
-
class
soco.data_structures.
DidlMusicTrack
(title, parent_id, item_id, restricted=True, resources=None, desc='RINCON_AssociatedZPUDN', **kwargs)[source]¶ Class that represents a music library track.
Parameters: - title (str) – the title for the item.
- parent_id (str) – the parent ID for the item.
- item_id (str) – the ID for the item.
- restricted (bool) – whether the item can be modified. Default
True
- resources (list, optional) – a list of resources for this object.
- None. (Default) –
- desc (str) – A DIDL descriptor, default
'RINCON_AssociatedZPUDN'
. This is not the same as “description”. It is used for identifying the relevant third party music service. - **kwargs – Extra metadata. What is allowed depends on the
_translation
class attribute, which in turn depends on the DIDL class.
-
item_class
= 'object.item.audioItem.musicTrack'¶ str - the DIDL Lite class for this object.
-
tag
= 'item'¶ str - the XML element tag name used for this instance.
-
_translation
= {'long_description': ('upnp', 'longDescription'), 'artist': ('upnp', 'artist'), 'creator': ('dc', 'creator'), 'radio_show': ('r', 'radioShowMd'), 'stream_content': ('r', 'streamContent'), 'album': ('upnp', 'album'), 'rights': ('dc', 'rights'), 'write_status': ('upnp', 'writeStatus'), 'contributor': ('dc', 'contributor'), 'language': ('dc', 'language'), 'original_track_number': ('upnp', 'originalTrackNumber'), 'album_art_uri': ('upnp', 'albumArtURI'), 'description': ('dc', 'description'), 'playlist': ('upnp', 'playlist'), 'genre': ('upnp', 'genre'), 'date': ('dc', 'date'), 'relation': ('dc', 'relation'), 'publisher': ('dc', 'publisher')}¶ dict - A dict used to translate between instance attribute names and XML tags/namespaces. It also serves to define the allowed tags/attributes for this instance. Each key an attribute name and each key is a
(namespace, tag)
tuple.
-
class
soco.data_structures.
DidlAudioBroadcast
(title, parent_id, item_id, restricted=True, resources=None, desc='RINCON_AssociatedZPUDN', **kwargs)[source]¶ Class that represents an audio broadcast.
Parameters: - title (str) – the title for the item.
- parent_id (str) – the parent ID for the item.
- item_id (str) – the ID for the item.
- restricted (bool) – whether the item can be modified. Default
True
- resources (list, optional) – a list of resources for this object.
- None. (Default) –
- desc (str) – A DIDL descriptor, default
'RINCON_AssociatedZPUDN'
. This is not the same as “description”. It is used for identifying the relevant third party music service. - **kwargs – Extra metadata. What is allowed depends on the
_translation
class attribute, which in turn depends on the DIDL class.
-
item_class
= 'object.item.audioItem.audioBroadcast'¶ str - the DIDL Lite class for this object.
-
tag
= 'item'¶ str - the XML element tag name used for this instance.
-
_translation
= {'long_description': ('upnp', 'longDescription'), 'creator': ('dc', 'creator'), 'radio_show': ('r', 'radioShowMd'), 'stream_content': ('r', 'streamContent'), 'radio_station_id': ('upnp', 'radioStationID'), 'rights': ('dc', 'rights'), 'write_status': ('upnp', 'writeStatus'), 'channel_nr': ('upnp', 'channelNr'), 'language': ('dc', 'language'), 'album_art_uri': ('upnp', 'albumArtURI'), 'description': ('dc', 'description'), 'genre': ('upnp', 'genre'), 'radio_call_sign': ('upnp', 'radioCallSign'), 'relation': ('dc', 'relation'), 'publisher': ('dc', 'publisher'), 'region': ('upnp', 'region')}¶ dict - A dict used to translate between instance attribute names and XML tags/namespaces. It also serves to define the allowed tags/attributes for this instance. Each key an attribute name and each key is a
(namespace, tag)
tuple.
-
class
soco.data_structures.
DidlAudioBroadcastFavorite
(title, parent_id, item_id, restricted=True, resources=None, desc='RINCON_AssociatedZPUDN', **kwargs)[source]¶ Class that represents an audio broadcast Sonos favorite.
Parameters: - title (str) – the title for the item.
- parent_id (str) – the parent ID for the item.
- item_id (str) – the ID for the item.
- restricted (bool) – whether the item can be modified. Default
True
- resources (list, optional) – a list of resources for this object.
- None. (Default) –
- desc (str) – A DIDL descriptor, default
'RINCON_AssociatedZPUDN'
. This is not the same as “description”. It is used for identifying the relevant third party music service. - **kwargs – Extra metadata. What is allowed depends on the
_translation
class attribute, which in turn depends on the DIDL class.
-
item_class
= 'object.item.audioItem.audioBroadcast.sonos-favorite'¶ str - the DIDL Lite class for this object.
-
tag
= 'item'¶ str - the XML element tag name used for this instance.
-
_translation
= {'long_description': ('upnp', 'longDescription'), 'creator': ('dc', 'creator'), 'radio_show': ('r', 'radioShowMd'), 'stream_content': ('r', 'streamContent'), 'radio_station_id': ('upnp', 'radioStationID'), 'rights': ('dc', 'rights'), 'write_status': ('upnp', 'writeStatus'), 'channel_nr': ('upnp', 'channelNr'), 'language': ('dc', 'language'), 'album_art_uri': ('upnp', 'albumArtURI'), 'description': ('dc', 'description'), 'genre': ('upnp', 'genre'), 'radio_call_sign': ('upnp', 'radioCallSign'), 'relation': ('dc', 'relation'), 'publisher': ('dc', 'publisher'), 'region': ('upnp', 'region')}¶ dict - A dict used to translate between instance attribute names and XML tags/namespaces. It also serves to define the allowed tags/attributes for this instance. Each key an attribute name and each key is a
(namespace, tag)
tuple.
-
class
soco.data_structures.
DidlContainer
(title, parent_id, item_id, restricted=True, resources=None, desc='RINCON_AssociatedZPUDN', **kwargs)[source]¶ Class that represents a music library container.
Parameters: - title (str) – the title for the item.
- parent_id (str) – the parent ID for the item.
- item_id (str) – the ID for the item.
- restricted (bool) – whether the item can be modified. Default
True
- resources (list, optional) – a list of resources for this object.
- None. (Default) –
- desc (str) – A DIDL descriptor, default
'RINCON_AssociatedZPUDN'
. This is not the same as “description”. It is used for identifying the relevant third party music service. - **kwargs – Extra metadata. What is allowed depends on the
_translation
class attribute, which in turn depends on the DIDL class.
-
item_class
= 'object.container'¶ str - the DIDL Lite class for this object.
-
tag
= 'container'¶ str - the XML element tag name used for this instance.
-
_translation
= {'creator': ('dc', 'creator'), 'write_status': ('upnp', 'writeStatus')}¶ dict - A dict used to translate between instance attribute names and XML tags/namespaces. It also serves to define the allowed tags/attributes for this instance. Each key an attribute name and each key is a
(namespace, tag)
tuple.
-
class
soco.data_structures.
DidlAlbum
(title, parent_id, item_id, restricted=True, resources=None, desc='RINCON_AssociatedZPUDN', **kwargs)[source]¶ A content directory album.
Parameters: - title (str) – the title for the item.
- parent_id (str) – the parent ID for the item.
- item_id (str) – the ID for the item.
- restricted (bool) – whether the item can be modified. Default
True
- resources (list, optional) – a list of resources for this object.
- None. (Default) –
- desc (str) – A DIDL descriptor, default
'RINCON_AssociatedZPUDN'
. This is not the same as “description”. It is used for identifying the relevant third party music service. - **kwargs – Extra metadata. What is allowed depends on the
_translation
class attribute, which in turn depends on the DIDL class.
-
item_class
= 'object.container.album'¶ str - the DIDL Lite class for this object.
-
tag
= 'container'¶ str - the XML element tag name used for this instance.
-
_translation
= {'long_description': ('upnp', 'longDescription'), 'creator': ('dc', 'creator'), 'contributor': ('dc', 'contributor'), 'rights': ('dc', 'rights'), 'description': ('dc', 'description'), 'write_status': ('upnp', 'writeStatus'), 'date': ('dc', 'date'), 'relation': ('dc', 'relation'), 'publisher': ('dc', 'publisher')}¶ dict - A dict used to translate between instance attribute names and XML tags/namespaces. It also serves to define the allowed tags/attributes for this instance. Each key an attribute name and each key is a
(namespace, tag)
tuple.
-
class
soco.data_structures.
DidlMusicAlbum
(title, parent_id, item_id, restricted=True, resources=None, desc='RINCON_AssociatedZPUDN', **kwargs)[source]¶ Class that represents a music library album.
Parameters: - title (str) – the title for the item.
- parent_id (str) – the parent ID for the item.
- item_id (str) – the ID for the item.
- restricted (bool) – whether the item can be modified. Default
True
- resources (list, optional) – a list of resources for this object.
- None. (Default) –
- desc (str) – A DIDL descriptor, default
'RINCON_AssociatedZPUDN'
. This is not the same as “description”. It is used for identifying the relevant third party music service. - **kwargs – Extra metadata. What is allowed depends on the
_translation
class attribute, which in turn depends on the DIDL class.
-
item_class
= 'object.container.album.musicAlbum'¶ str - the DIDL Lite class for this object.
-
tag
= 'container'¶ str - the XML element tag name used for this instance.
-
_translation
= {'long_description': ('upnp', 'longDescription'), 'artist': ('upnp', 'artist'), 'creator': ('dc', 'creator'), 'radio_show': ('r', 'radioShowMd'), 'stream_content': ('r', 'streamContent'), 'rights': ('dc', 'rights'), 'write_status': ('upnp', 'writeStatus'), 'language': ('dc', 'language'), 'album_art_uri': ('upnp', 'albumArtURI'), 'description': ('dc', 'description'), 'genre': ('upnp', 'genre'), 'producer': ('upnp', 'producer'), 'relation': ('dc', 'relation'), 'publisher': ('dc', 'publisher'), 'toc': ('upnp', 'toc')}¶ dict - A dict used to translate between instance attribute names and XML tags/namespaces. It also serves to define the allowed tags/attributes for this instance. Each key an attribute name and each key is a
(namespace, tag)
tuple.
-
class
soco.data_structures.
DidlMusicAlbumFavorite
(title, parent_id, item_id, restricted=True, resources=None, desc='RINCON_AssociatedZPUDN', **kwargs)[source]¶ Class that represents a Sonos favorite music library album.
This class is not part of the DIDL spec and is Sonos specific.
Parameters: - title (str) – the title for the item.
- parent_id (str) – the parent ID for the item.
- item_id (str) – the ID for the item.
- restricted (bool) – whether the item can be modified. Default
True
- resources (list, optional) – a list of resources for this object.
- None. (Default) –
- desc (str) – A DIDL descriptor, default
'RINCON_AssociatedZPUDN'
. This is not the same as “description”. It is used for identifying the relevant third party music service. - **kwargs – Extra metadata. What is allowed depends on the
_translation
class attribute, which in turn depends on the DIDL class.
-
item_class
= 'object.container.album.musicAlbum.sonos-favorite'¶ str - the DIDL Lite class for this object.
-
tag
= 'item'¶ str - the XML element tag name used for this instance.
-
_translation
= {'long_description': ('upnp', 'longDescription'), 'creator': ('dc', 'creator'), 'contributor': ('dc', 'contributor'), 'rights': ('dc', 'rights'), 'description': ('dc', 'description'), 'write_status': ('upnp', 'writeStatus'), 'date': ('dc', 'date'), 'relation': ('dc', 'relation'), 'publisher': ('dc', 'publisher')}¶ dict - A dict used to translate between instance attribute names and XML tags/namespaces. It also serves to define the allowed tags/attributes for this instance. Each key an attribute name and each key is a
(namespace, tag)
tuple.
-
class
soco.data_structures.
DidlMusicAlbumCompilation
(title, parent_id, item_id, restricted=True, resources=None, desc='RINCON_AssociatedZPUDN', **kwargs)[source]¶ Class that represents a Sonos favorite music library compilation.
This class is not part of the DIDL spec and is Sonos specific.
Parameters: - title (str) – the title for the item.
- parent_id (str) – the parent ID for the item.
- item_id (str) – the ID for the item.
- restricted (bool) – whether the item can be modified. Default
True
- resources (list, optional) – a list of resources for this object.
- None. (Default) –
- desc (str) – A DIDL descriptor, default
'RINCON_AssociatedZPUDN'
. This is not the same as “description”. It is used for identifying the relevant third party music service. - **kwargs – Extra metadata. What is allowed depends on the
_translation
class attribute, which in turn depends on the DIDL class.
-
item_class
= 'object.container.album.musicAlbum.compilation'¶ str - the DIDL Lite class for this object.
-
tag
= 'container'¶ str - the XML element tag name used for this instance.
-
_translation
= {'long_description': ('upnp', 'longDescription'), 'creator': ('dc', 'creator'), 'contributor': ('dc', 'contributor'), 'rights': ('dc', 'rights'), 'description': ('dc', 'description'), 'write_status': ('upnp', 'writeStatus'), 'date': ('dc', 'date'), 'relation': ('dc', 'relation'), 'publisher': ('dc', 'publisher')}¶ dict - A dict used to translate between instance attribute names and XML tags/namespaces. It also serves to define the allowed tags/attributes for this instance. Each key an attribute name and each key is a
(namespace, tag)
tuple.
-
class
soco.data_structures.
DidlPerson
(title, parent_id, item_id, restricted=True, resources=None, desc='RINCON_AssociatedZPUDN', **kwargs)[source]¶ A content directory class representing a person.
Parameters: - title (str) – the title for the item.
- parent_id (str) – the parent ID for the item.
- item_id (str) – the ID for the item.
- restricted (bool) – whether the item can be modified. Default
True
- resources (list, optional) – a list of resources for this object.
- None. (Default) –
- desc (str) – A DIDL descriptor, default
'RINCON_AssociatedZPUDN'
. This is not the same as “description”. It is used for identifying the relevant third party music service. - **kwargs – Extra metadata. What is allowed depends on the
_translation
class attribute, which in turn depends on the DIDL class.
-
item_class
= 'object.container.person'¶ str - the DIDL Lite class for this object.
-
tag
= 'item'¶ str - the XML element tag name used for this instance.
-
_translation
= {'creator': ('dc', 'creator'), 'language': ('dc', 'language'), 'write_status': ('upnp', 'writeStatus')}¶ dfdf
dict - A dict used to translate between instance attribute names and XML tags/namespaces. It also serves to define the allowed tags/attributes for this instance. Each key an attribute name and each key is a
(namespace, tag)
tuple.
-
class
soco.data_structures.
DidlComposer
(title, parent_id, item_id, restricted=True, resources=None, desc='RINCON_AssociatedZPUDN', **kwargs)[source]¶ Class that represents a music library composer.
Parameters: - title (str) – the title for the item.
- parent_id (str) – the parent ID for the item.
- item_id (str) – the ID for the item.
- restricted (bool) – whether the item can be modified. Default
True
- resources (list, optional) – a list of resources for this object.
- None. (Default) –
- desc (str) – A DIDL descriptor, default
'RINCON_AssociatedZPUDN'
. This is not the same as “description”. It is used for identifying the relevant third party music service. - **kwargs – Extra metadata. What is allowed depends on the
_translation
class attribute, which in turn depends on the DIDL class.
-
item_class
= 'object.container.person.composer'¶ str - the DIDL Lite class for this object.
-
tag
= 'item'¶ str - the XML element tag name used for this instance.
-
_translation
= {'creator': ('dc', 'creator'), 'language': ('dc', 'language'), 'write_status': ('upnp', 'writeStatus')}¶ dict - A dict used to translate between instance attribute names and XML tags/namespaces. It also serves to define the allowed tags/attributes for this instance. Each key an attribute name and each key is a
(namespace, tag)
tuple.
-
class
soco.data_structures.
DidlMusicArtist
(title, parent_id, item_id, restricted=True, resources=None, desc='RINCON_AssociatedZPUDN', **kwargs)[source]¶ Class that represents a music library artist.
Parameters: - title (str) – the title for the item.
- parent_id (str) – the parent ID for the item.
- item_id (str) – the ID for the item.
- restricted (bool) – whether the item can be modified. Default
True
- resources (list, optional) – a list of resources for this object.
- None. (Default) –
- desc (str) – A DIDL descriptor, default
'RINCON_AssociatedZPUDN'
. This is not the same as “description”. It is used for identifying the relevant third party music service. - **kwargs – Extra metadata. What is allowed depends on the
_translation
class attribute, which in turn depends on the DIDL class.
-
item_class
= 'object.container.person.musicArtist'¶ str - the DIDL Lite class for this object.
-
tag
= 'item'¶ str - the XML element tag name used for this instance.
-
_translation
= {'genre': ('upnp', 'genre'), 'artist_discography_uri': ('upnp', 'artistDiscographyURI'), 'creator': ('dc', 'creator'), 'language': ('dc', 'language'), 'write_status': ('upnp', 'writeStatus')}¶ dict - A dict used to translate between instance attribute names and XML tags/namespaces. It also serves to define the allowed tags/attributes for this instance. Each key an attribute name and each key is a
(namespace, tag)
tuple.
-
class
soco.data_structures.
DidlAlbumList
(title, parent_id, item_id, restricted=True, resources=None, desc='RINCON_AssociatedZPUDN', **kwargs)[source]¶ Class that represents a music library album list.
Parameters: - title (str) – the title for the item.
- parent_id (str) – the parent ID for the item.
- item_id (str) – the ID for the item.
- restricted (bool) – whether the item can be modified. Default
True
- resources (list, optional) – a list of resources for this object.
- None. (Default) –
- desc (str) – A DIDL descriptor, default
'RINCON_AssociatedZPUDN'
. This is not the same as “description”. It is used for identifying the relevant third party music service. - **kwargs – Extra metadata. What is allowed depends on the
_translation
class attribute, which in turn depends on the DIDL class.
-
item_class
= 'object.container.albumlist'¶ str - the DIDL Lite class for this object.
-
tag
= 'container'¶ str - the XML element tag name used for this instance.
-
_translation
= {'creator': ('dc', 'creator'), 'write_status': ('upnp', 'writeStatus')}¶ dict - A dict used to translate between instance attribute names and XML tags/namespaces. It also serves to define the allowed tags/attributes for this instance. Each key an attribute name and each key is a
(namespace, tag)
tuple.
-
class
soco.data_structures.
DidlPlaylistContainer
(title, parent_id, item_id, restricted=True, resources=None, desc='RINCON_AssociatedZPUDN', **kwargs)[source]¶ Class that represents a music library play list.
Parameters: - title (str) – the title for the item.
- parent_id (str) – the parent ID for the item.
- item_id (str) – the ID for the item.
- restricted (bool) – whether the item can be modified. Default
True
- resources (list, optional) – a list of resources for this object.
- None. (Default) –
- desc (str) – A DIDL descriptor, default
'RINCON_AssociatedZPUDN'
. This is not the same as “description”. It is used for identifying the relevant third party music service. - **kwargs – Extra metadata. What is allowed depends on the
_translation
class attribute, which in turn depends on the DIDL class.
-
item_class
= 'object.container.playlistContainer'¶ str - the DIDL Lite class for this object.
-
tag
= 'item'¶ str - the XML element tag name used for this instance.
-
_translation
= {'long_description': ('upnp', 'longDescription'), 'artist': ('upnp', 'artist'), 'creator': ('dc', 'creator'), 'description': ('dc', 'description'), 'rights': ('dc', 'rights'), 'genre': ('upnp', 'genre'), 'language': ('dc', 'language'), 'contributor': ('dc', 'contributor'), 'write_status': ('upnp', 'writeStatus'), 'date': ('dc', 'date'), 'producer': ('dc', 'producer')}¶ dict - A dict used to translate between instance attribute names and XML tags/namespaces. It also serves to define the allowed tags/attributes for this instance. Each key an attribute name and each key is a
(namespace, tag)
tuple.
-
item_class
= 'object.container.playlistContainer'
-
class
soco.data_structures.
DidlSameArtist
(title, parent_id, item_id, restricted=True, resources=None, desc='RINCON_AssociatedZPUDN', **kwargs)[source]¶ Class that represents all tracks by a single artist.
This type is returned by browsing an artist or a composer
Parameters: - title (str) – the title for the item.
- parent_id (str) – the parent ID for the item.
- item_id (str) – the ID for the item.
- restricted (bool) – whether the item can be modified. Default
True
- resources (list, optional) – a list of resources for this object.
- None. (Default) –
- desc (str) – A DIDL descriptor, default
'RINCON_AssociatedZPUDN'
. This is not the same as “description”. It is used for identifying the relevant third party music service. - **kwargs – Extra metadata. What is allowed depends on the
_translation
class attribute, which in turn depends on the DIDL class.
-
item_class
= 'object.container.playlistContainer.sameArtist'¶ str - the DIDL Lite class for this object.
-
tag
= 'item'¶ str - the XML element tag name used for this instance.
-
_translation
= {'long_description': ('upnp', 'longDescription'), 'artist': ('upnp', 'artist'), 'creator': ('dc', 'creator'), 'description': ('dc', 'description'), 'rights': ('dc', 'rights'), 'genre': ('upnp', 'genre'), 'language': ('dc', 'language'), 'contributor': ('dc', 'contributor'), 'write_status': ('upnp', 'writeStatus'), 'date': ('dc', 'date'), 'producer': ('dc', 'producer')}¶ dict - A dict used to translate between instance attribute names and XML tags/namespaces. It also serves to define the allowed tags/attributes for this instance. Each key an attribute name and each key is a
(namespace, tag)
tuple.
-
class
soco.data_structures.
DidlGenre
(title, parent_id, item_id, restricted=True, resources=None, desc='RINCON_AssociatedZPUDN', **kwargs)[source]¶ A content directory class representing a general genre.
Parameters: - title (str) – the title for the item.
- parent_id (str) – the parent ID for the item.
- item_id (str) – the ID for the item.
- restricted (bool) – whether the item can be modified. Default
True
- resources (list, optional) – a list of resources for this object.
- None. (Default) –
- desc (str) – A DIDL descriptor, default
'RINCON_AssociatedZPUDN'
. This is not the same as “description”. It is used for identifying the relevant third party music service. - **kwargs – Extra metadata. What is allowed depends on the
_translation
class attribute, which in turn depends on the DIDL class.
-
item_class
= 'object.container.genre'¶ str - the DIDL Lite class for this object.
-
tag
= 'container'¶ str - the XML element tag name used for this instance.
-
_translation
= {'description': ('dc', 'description'), 'long_description': ('upnp', 'longDescription'), 'genre': ('upnp', 'genre'), 'creator': ('dc', 'creator'), 'write_status': ('upnp', 'writeStatus')}¶ dict - A dict used to translate between instance attribute names and XML tags/namespaces. It also serves to define the allowed tags/attributes for this instance. Each key an attribute name and each key is a
(namespace, tag)
tuple.
-
class
soco.data_structures.
DidlMusicGenre
(title, parent_id, item_id, restricted=True, resources=None, desc='RINCON_AssociatedZPUDN', **kwargs)[source]¶ Class that represents a music genre.
Parameters: - title (str) – the title for the item.
- parent_id (str) – the parent ID for the item.
- item_id (str) – the ID for the item.
- restricted (bool) – whether the item can be modified. Default
True
- resources (list, optional) – a list of resources for this object.
- None. (Default) –
- desc (str) – A DIDL descriptor, default
'RINCON_AssociatedZPUDN'
. This is not the same as “description”. It is used for identifying the relevant third party music service. - **kwargs – Extra metadata. What is allowed depends on the
_translation
class attribute, which in turn depends on the DIDL class.
-
item_class
= 'object.container.genre.musicGenre'¶ str - the DIDL Lite class for this object.
-
tag
= 'item'¶ str - the XML element tag name used for this instance.
-
_translation
= {'description': ('dc', 'description'), 'long_description': ('upnp', 'longDescription'), 'genre': ('upnp', 'genre'), 'creator': ('dc', 'creator'), 'write_status': ('upnp', 'writeStatus')}¶ dict - A dict used to translate between instance attribute names and XML tags/namespaces. It also serves to define the allowed tags/attributes for this instance. Each key an attribute name and each key is a
(namespace, tag)
tuple.
-
class
soco.data_structures.
ListOfMusicInfoItems
(items, number_returned, total_matches, update_id)[source]¶ Abstract container class for a list of music information items.
-
__getitem__
(key)[source]¶ Legacy get metadata by string key or list item(s) by index.
Deprecated since version 0.8: This overriding form of __getitem__ will be removed in the 3rd release after 0.8. The metadata can be fetched via the named attributes.
-
number_returned
¶ str: the number of returned matches.
-
total_matches
¶ str: the number of total matches.
-
update_id
¶ str: the update ID.
-