Exemplo n.º 1
0
 def url(self):
     _url = 'https://ws.audioscrobbler.com/2.0?method=album.getinfo&' + \
            'api_key=107db6fd4c1c7f53b1526fafddab2c82&format=json&' + \
            'artist={artist}&album={album}&mbid={mbid}'
     song = self.song
     # This can work well for albums in Last.FM
     artists = self._album_artists_for(song) or 'Various Artists'
     song = self.song
     artist = escape_query_value(artists)
     album = escape_query_value(song.get('album', ''))
     mbid = escape_query_value(song.get('musicbrainz_albumid', ''))
     if (artist and album) or mbid:
         return _url.format(artist=artist, album=album, mbid=mbid)
     else:
         return None  # Not enough data
Exemplo n.º 2
0
 def url(self):
     _url = ('https://api.discogs.com/database/search?' + self.credentials +
             '&format=CD&per_page=5'
             '&type=release' + '&artist={artist}' +
             '&release_title={album}')
     # Discogs seems to use 'Various' almost exclusively for compilations
     artists = self._album_artists_for(self.song) or 'Various'
     if 'various artists' in artists.lower():
         artists = 'Various'
     artist = escape_query_value(artists)
     album = escape_query_value(self.song.get('album', ''))
     if artist and album:
         return _url.format(artist=artist, album=album)
     else:
         return None  # Not enough data
Exemplo n.º 3
0
 def url(self):
     _url = 'https://ws.audioscrobbler.com/2.0?method=album.getinfo&' + \
            'api_key=107db6fd4c1c7f53b1526fafddab2c82&format=json&' + \
            'artist={artist}&album={album}&mbid={mbid}'
     song = self.song
     # This can work well for albums in Last.FM
     artists = self._album_artists_for(song) or 'Various Artists'
     song = self.song
     artist = escape_query_value(artists)
     album = escape_query_value(song.get('album', ''))
     mbid = escape_query_value(song.get('musicbrainz_albumid', ''))
     if (artist and album) or mbid:
         return _url.format(artist=artist, album=album, mbid=mbid)
     else:
         return None  # Not enough data
Exemplo n.º 4
0
 def url(self):
     _url = ('https://api.discogs.com/database/search?' +
             self.credentials +
             '&format=CD&per_page=5'
             '&type=release' +
             '&artist={artist}' +
             '&release_title={album}')
     # Discogs seems to use 'Various' almost exclusively for compilations
     artists = self._album_artists_for(self.song) or 'Various'
     if 'various artists' in artists.lower():
         artists = 'Various'
     artist = escape_query_value(artists)
     album = escape_query_value(self.song.get('album', ''))
     if artist and album:
         return _url.format(artist=artist, album=album)
     else:
         return None   # Not enough data
Exemplo n.º 5
0
 def test_escape(self):
     assert escape_query_value("foo bar") == "foo%20bar"
     assert escape_query_value("foo?") == "foo%3F"
     assert escape_query_value("foo&bar") == "foo%26bar"
Exemplo n.º 6
0
 def test_escape(self):
     assert escape_query_value("foo bar") == "foo%20bar"
     assert escape_query_value("foo?") == "foo%3F"
     assert escape_query_value("foo&bar") == "foo%26bar"