예제 #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 []
예제 #2
0
파일: lastfm.py 프로젝트: tb0hdan/voiceplay
 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
예제 #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
예제 #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)