def browse(self, ms_item=None):
        """Return the sub-elements of item or of the root if item is None

        :param item: Instance of sub-class of
            :py:class:`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
            :py:class:`soco.data_structures.MSFavorites` and
            :py:class:`soco.data_structures.MSCollection` elements.

        """
        # Check for correct service
        if ms_item is not None and ms_item.service_id != self._service_id:
            message = 'This music service item is not for this service'
            raise ValueError(message)

        # Form HTTP body and set parent_id
        if ms_item:
            body = self._browse_body(ms_item.item_id)
            parent_id = ms_item.extended_id
            if parent_id is None:
                parent_id = ''
        else:
            body = self._browse_body('root')
            parent_id = '0'

        # Get HTTP header and post
        headers = _get_header('get_metadata')
        response = _post(self._url, headers, body, **self._http_vars)

        # Check for errors and get XML
        self._check_for_errors(response)
        result_dom = XML.fromstring(really_utf8(response.text))
        # Find the getMetadataResult item ...
        xpath_search = './/' + _ns_tag('', 'getMetadataResult')
        metadata_result = list(result_dom.findall(xpath_search))
        # ... and make sure there is exactly 1
        if len(metadata_result) != 1:
            raise UnknownXMLStructure(
                'The results XML has more than 1 \'getMetadataResult\'. This '
                'is unexpected and parsing will dis-continue.'
            )
        metadata_result = metadata_result[0]

        # Browse the children of metadata result
        out = {'item_list': []}
        for element in ['index', 'count', 'total']:
            out[element] = metadata_result.findtext(_ns_tag('', element))
        for result in metadata_result:
            if result.tag in [_ns_tag('', 'mediaCollection'),
                              _ns_tag('', 'mediaMetadata')]:
                out['item_list'].append(get_ms_item(result, self, parent_id))
        return out
def browse ( self , ms_item = None ) : if ms_item is not None and ms_item . service_id != self . _service_id : message = 'This music service item is not for this service' raise ValueError ( message ) if ms_item : body = self . _browse_body ( ms_item . item_id ) parent_id = ms_item . extended_id if parent_id is None : parent_id = '' else : body = self . _browse_body ( 'root' ) parent_id = '0' headers = _get_header ( 'get_metadata' ) response = _post ( self . _url , headers , body , ** self . _http_vars ) self . _check_for_errors ( response ) result_dom = XML . fromstring ( really_utf8 ( response . text ) ) xpath_search = './/' + _ns_tag ( '' , 'getMetadataResult' ) metadata_result = list ( result_dom . findall ( xpath_search ) ) if len ( metadata_result ) != 1 : raise UnknownXMLStructure ( 'The results XML has more than 1 \'getMetadataResult\'. This ' 'is unexpected and parsing will dis-continue.' ) metadata_result = metadata_result [ 0 ] out = { 'item_list' : [ ] } for element in [ 'index' , 'count' , 'total' ] : out [ element ] = metadata_result . findtext ( _ns_tag ( '' , element ) ) for result in metadata_result : if result . tag in [ _ns_tag ( '' , 'mediaCollection' ) , _ns_tag ( '' , 'mediaMetadata' ) ] : out [ 'item_list' ] . append ( get_ms_item ( result , self , parent_id ) ) return out
Return the sub-elements of item or of the root if item is None

        :param item: Instance of sub-class of
            :py:class:`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
            :py:class:`soco.data_structures.MSFavorites` and
            :py:class:`soco.data_structures.MSCollection` elements.