Exemplo n.º 1
0
 def artists_by_country(self, country):
     try:
         tag = pylast.Tag(country.name.lower(), self.network)
         results = tag.get_top_artists()
         return [result[0] for result in results]
     except Exception as exc:
         print "Something went wrong for last.fm: %s" % exc
         return []
Exemplo n.º 2
0
 def get_station(self, query):
     """
     Get station based on artist/tag
     """
     if self.get_query_type(query) != 'artist':
         aobj = pylast.Tag(query, self.network)
         tracks = self.trackarize(aobj.get_top_tracks())
     else:
         tracks = []
         for artist in self.get_similar_artists(query):
             tracks += self.get_top_tracks(artist)
     return tracks
Exemplo n.º 3
0
    def test_remove_tag_of_type_tag(self):
        # Arrange
        tag = pylast.Tag("testing", self.network)  # Tag
        artist = self.network.get_artist("Test Artist")
        artist.add_tag(tag)

        # Act
        artist.remove_tag(tag)

        # Assert
        tags = artist.get_tags()
        found = any(tag.name == "testing" for tag in tags)
        assert not found
Exemplo n.º 4
0
    def test_remove_tag_of_type_tag(self):
        # Arrange
        tag = pylast.Tag("testing", self.network)  # Tag
        artist = self.network.get_artist("Test Artist")
        artist.add_tag(tag)

        # Act
        artist.remove_tag(tag)

        # Assert
        tags = artist.get_tags()
        found = False
        for tag in tags:
            if tag.name == "testing":
                found = True
                break
        self.assertFalse(found)