How to use the soco.xml.XML.SubElement function in soco

To help you get started, we’ve selected a few soco examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SoCo / SoCo / soco / didl_lite.py View on Github external
def to_didl_element(self):
        """ Create element for this AudioBroadcast.
        """
        root = AudioItem.to_didl_element(self)

        if self.region:
            ElementTree.SubElement(root, 'upnp:region').text = self.region
        if self.radio_call_sign:
            ElementTree.SubElement(root, 'upnp:radioCallSign').text =\
                self.radio_call_sign
        if self.radio_station_id:
            ElementTree.SubElement(root, 'upnp:radioStationId').text =\
                self.radio_station_id
        if self.radio_band:
            ElementTree.SubElement(root, 'upnp:radioBand').text = \
                self.radio_band
        if self.channel_nr:
            ElementTree.SubElement(root, 'upnp:channelNr').text = \
                self.channel_nr

        return root
github SoCo / SoCo / soco / didl_lite.py View on Github external
def to_didl_element(self):
        """ Returns an Element based on this Resource.
        """
        root = Album.to_didl_element(self)

        for a in self.artists:
            ElementTree.SubElement(root, 'upnp:artist').text = a
        for g in self.genres:
            ElementTree.SubElement(root, 'upnp:genre').text = g
        for p in self.producers:
            ElementTree.SubElement(root, 'upnp:producer').text = p
        if self.album_art_uri:
            ElementTree.SubElement(root, 'upnp:albumArtURI').text = \
                self.album_art_uri
        if self.toc:
            ElementTree.SubElement(root, 'upnp:toc').text = self.toc

        return root
github SoCo / SoCo / soco / plugins / wimp.py View on Github external
.. code :: xml

         
           
             search_type
             search_term
             start
             max_items
           
         
        """
        xml = self._base_body()

        # Add the Body part
        XML.SubElement(xml, ns_tag('s', 'Body'))
        search = XML.SubElement(xml[1], ns_tag('', 'search'))
        XML.SubElement(search, 'id').text = search_type
        XML.SubElement(search, 'term').text = search_term
        XML.SubElement(search, 'index').text = str(start)
        XML.SubElement(search, 'count').text = str(max_items)

        return XML.tostring(xml)
github SoCo / SoCo / soco / plugins / wimp.py View on Github external
search_type
             search_term
             start
             max_items
           
         
        """
        xml = self._base_body()

        # Add the Body part
        XML.SubElement(xml, ns_tag('s', 'Body'))
        search = XML.SubElement(xml[1], ns_tag('', 'search'))
        XML.SubElement(search, 'id').text = search_type
        XML.SubElement(search, 'term').text = search_term
        XML.SubElement(search, 'index').text = str(start)
        XML.SubElement(search, 'count').text = str(max_items)

        return XML.tostring(xml)
github SoCo / SoCo / soco / didl_lite.py View on Github external
def to_didl_element(self):
        """ Returns an Element based on this instance.
        """
        root = ElementTree.Element(self.element_name)
        root.attrib['id'] = str(self.object_id)
        root.attrib['parentID'] = str(self.parent_id)
        ElementTree.SubElement(root, 'dc:title').text = self.title
        ElementTree.SubElement(root, 'upnp:class').text = self.upnp_class

        if self.restricted:
            root.attrib['restricted'] = 'true'
        else:
            root.attrib['restricted'] = 'false'

        if self.creator:
            ElementTree.SubElement(root, 'dc:creator').text = self.creator
        if self.write_status:
            ElementTree.SubElement(root, 'upnp:writeStatus').text = \
                self.write_status

        for r in self.resources:
            root.append(r.to_didl_element())
github SoCo / SoCo / soco / plugins / wimp.py View on Github external
search_type
             search_term
             start
             max_items
           
         
        """
        xml = self._base_body()

        # Add the Body part
        XML.SubElement(xml, ns_tag('s', 'Body'))
        search = XML.SubElement(xml[1], ns_tag('', 'search'))
        XML.SubElement(search, 'id').text = search_type
        XML.SubElement(search, 'term').text = search_term
        XML.SubElement(search, 'index').text = str(start)
        XML.SubElement(search, 'count').text = str(max_items)

        return XML.tostring(xml)
github SoCo / SoCo / soco / plugins / wimp.py View on Github external
search_type
             search_term
             start
             max_items
           
         
        """
        xml = self._base_body()

        # Add the Body part
        XML.SubElement(xml, ns_tag('s', 'Body'))
        search = XML.SubElement(xml[1], ns_tag('', 'search'))
        XML.SubElement(search, 'id').text = search_type
        XML.SubElement(search, 'term').text = search_term
        XML.SubElement(search, 'index').text = str(start)
        XML.SubElement(search, 'count').text = str(max_items)

        return XML.tostring(xml)
github SoCo / SoCo / soco / didl_lite.py View on Github external
def to_didl_element(self):
        """ Returns an Element based on this Resource.
        """
        root = Person.to_didl_element(self)

        for g in self.genres:
            ElementTree.SubElement(root, 'upnp:genre').text = g

        if self.artist_discography_uri:
            ElementTree.SubElement(root, 'upnp:artistDiscographyURI').text = \
                self.artist_discography_uri

        return root
github SoCo / SoCo / soco / didl_lite.py View on Github external
ElementTree.SubElement(root, 'upnp:longDescription').text = \
                self.long_description
        if self.rating:
            ElementTree.SubElement(root, 'upnp:rating').text = self.rating
        if self.description:
            ElementTree.SubElement(root, 'dc:description').text = \
                self.description
        if self.date:
            ElementTree.SubElement(root, 'dc:date').text = self.date

        for a in self.authors:
            ElementTree.SubElement(root, 'upnp:author').text = a
        for p in self.publishers:
            ElementTree.SubElement(root, 'dc:publisher').text = p
        for c in self.contributors:
            ElementTree.SubElement(root, 'dc:contributor').text = c
        for r in self.relations:
            ElementTree.SubElement(root, 'dc:relation').text = r
        for l in self.languages:
            ElementTree.SubElement(root, 'dc:language').text = l
        for r in self.rights:
            ElementTree.SubElement(root, 'dc:rights').text = r

        return root