def __init__(self, title, parent_id, item_id, restricted=True,
                 resources=None, desc='RINCON_AssociatedZPUDN', **kwargs):
        """
        Args:
            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.
            Default `None`.
            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.



        ..  autoattribute:: item_class

            str - the DIDL Lite class for this object.

        ..  autoattribute:: tag

            str - the XML element tag name used for this instance.

        ..  autoattribute:: _translation

            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.

        """
        # All didl objects *must* have a title, a parent_id and an item_id
        # so we specify these as required args in the constructor signature
        # to ensure that we get them. Other didl object properties are
        # optional, so can be passed as kwargs.
        # The content of _translation is adapted from the list in table C at
        # http://upnp.org/specs/av/UPnP-av-ContentDirectory-v2-Service.pdf
        # Not all properties referred to there are catered for, since Sonos
        # does not use some of them.

        # pylint: disable=super-on-old-class
        super(DidlObject, self).__init__()
        self.title = title
        self.parent_id = parent_id
        self.item_id = item_id
        # Restricted is a compulsory attribute, but is almost always True for
        # Sonos. (Only seen it 'false' when browsing favorites)
        self.restricted = restricted

        # Resources is multi-valued, and dealt with separately
        self.resources = [] if resources is None else resources

        # According to the spec, there may be one or more desc values. Sonos
        # only seems to use one, so we won't bother with a list
        self.desc = desc

        for key, value in kwargs.items():
            # For each attribute, check to see if this class allows it
            if key not in self._translation:
                raise ValueError(
                    'The key \'{0}\' is not allowed as an argument. Only '
                    'these keys are allowed: parent_id, item_id, title, '
                    'restricted, resources, desc'
                    ' {1}'.format(key, ', '.join(self._translation.keys())))
            # It is an allowed attribute. Set it as an attribute on self, so
            # that it can be accessed as Classname.attribute in the normal
            # way.
            setattr(self, key, value)
def __init__ ( self , title , parent_id , item_id , restricted = True , resources = None , desc = 'RINCON_AssociatedZPUDN' , ** kwargs ) : super ( DidlObject , self ) . __init__ ( ) self . title = title self . parent_id = parent_id self . item_id = item_id self . restricted = restricted self . resources = [ ] if resources is None else resources self . desc = desc for key , value in kwargs . items ( ) : if key not in self . _translation : raise ValueError ( 'The key \'{0}\' is not allowed as an argument. Only ' 'these keys are allowed: parent_id, item_id, title, ' 'restricted, resources, desc' ' {1}' . format ( key , ', ' . join ( self . _translation . keys ( ) ) ) ) setattr ( self , key , value )
Args:
            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.
            Default `None`.
            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.



        ..  autoattribute:: item_class

            str - the DIDL Lite class for this object.

        ..  autoattribute:: tag

            str - the XML element tag name used for this instance.

        ..  autoattribute:: _translation

            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.