How to use the pylast.Tag function in pylast

To help you get started, we’ve selected a few pylast 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 pylast / pylast / tests / test_network.py View on Github external
def test_network_get_top_tags_with_limit(self):
        # Arrange
        # Act
        tags = self.network.get_top_tags(limit=1)

        # Assert
        self.helper_only_one_thing_in_top_list(tags, pylast.Tag)
github maxexcloo / LastDown / pylast.py View on Github external
def get_tags(self):
        """Returns a list of the tags set by the user to this object."""
        
        # Uncacheable because it can be dynamically changed by the user.
        params = self._get_params()
        
        doc = self._request(self.ws_prefix + '.getTags', False, params)
        tag_names = _extract_all(doc, 'name')
        tags = []
        for tag in tag_names:
            tags.append(Tag(tag, self.network))
        
        return tags
github pylast / pylast / pylast.py View on Github external
def get_similar(self):
        """Returns the tags similar to this one, ordered by similarity. """

        doc = self._request('tag.getSimilar', True)

        seq = []
        names = _extract_all(doc, 'name')
        for name in names:
            seq.append(Tag(name, self.network))

        return seq
github foobnix / foobnix / foobnix / gui / service / lastfm_service.py View on Github external
def search_top_tag_tracks(self, tag_name):
        logging.warn("search_top_tag tracks"+tag_name)
        if not self.connect():
            return None
        if not tag_name:
            logging.warn("search_top_tags TAG is empty")
            return []

        tag = Tag(tag_name, self.network)
        tracks = tag.get_top_tracks()

        beans = []

        for track in tracks:

            try:
                track_item = track.item
            except AttributeError:
                track_item = track['item']

            #LOG.info(track_item.get_duration())

            #bean = CommonBean(name=str(track_item), path="", type=CommonBean.TYPE_MUSIC_URL, parent=query);
            artist = track_item.get_artist().get_name()
            title = track_item.get_title()
github pylast / pylast / pylast.py View on Github external
def get_top_tags(self, limit=None):
        """Returns a list of the most frequently used Tags on this object."""

        doc = self._request(self.ws_prefix + '.getTopTags', True)

        elements = doc.getElementsByTagName('tag')
        seq = []

        for element in elements:
            tag_name = _extract(element, 'name')
            tagcount = _extract(element, 'count')

            seq.append(TopItem(Tag(tag_name, self.network), tagcount))

        if limit:
            seq = seq[:limit]

        return seq
github asermax / lastfm_extension / pylast.py View on Github external
def get_top_tags(self, limit=None):
        """Returns a list of the most frequently used Tags on this object."""
        
        doc = self._request(self.ws_prefix + '.getTopTags', True)
        
        elements = doc.getElementsByTagName('tag')
        seq = []
        
        for element in elements:
            tag_name = _extract(element, 'name')
            tagcount = _extract(element, 'count')
            
            seq.append(TopItem(Tag(tag_name, self.network), tagcount))
        
        if limit:
            seq = seq[:limit]
        
        return seq
github maxexcloo / LastDown / pylast.py View on Github external
def get_similar(self):
        """Returns the tags similar to this one, ordered by similarity. """
        
        doc = self._request('tag.getSimilar', True)
        
        seq = []
        names = _extract_all(doc, 'name')
        for name in names:
            seq.append(Tag(name, self.network))
        
        return seq
github asermax / lastfm_extension / pylast.py View on Github external
def get_next_page(self):
        """Returns the next page of results as a sequence of Tag objects."""
        
        master_node = self._retrieve_next_page()
        
        seq = []
        for node in master_node.getElementsByTagName("tag"):
            tag = Tag(_extract(node, "name"), self.network)
            tag.tag_count = _number(_extract(node, "count"))
            seq.append(tag)
        
        return seq
github pylast / pylast / pylast.py View on Github external
def get_tags(self):
        """Returns a list of the tags set by the user to this object."""

        # Uncacheable because it can be dynamically changed by the user.
        params = self._get_params()

        doc = self._request(self.ws_prefix + '.getTags', False, params)
        tag_names = _extract_all(doc, 'name')
        tags = []
        for tag in tag_names:
            tags.append(Tag(tag, self.network))

        return tags