コード例 #1
0
    def search_url(self, artist, album):
        # Remove variants of Disc/CD [1-9] from album title before search
        for exp in DISC_NUMBER_REGEXS:
            p = re.compile(exp, re.IGNORECASE)
            album = p.sub('', album)

        album.strip()

        print("searching for (%s, %s)" % (artist, album))
        url = SPOTIFY_API_URL + "search?query="
        url = url + "album:%s" % (rb3compat.quote_plus(album))
        if artist:
            url = url + " artist:%s" % (rb3compat.quote_plus(artist))
        url = url + "&offset=0&limit=10&type=album"
        print("spotify query url = %s" % url)
        return url
コード例 #2
0
 def search_url (self, artist):
     
     print(("searching for (%s)" % (artist)))
     url = API_URL + "?method=artist.getinfo&"
     url = url + "artist=%s&" % (rb3compat.quote_plus(artist))
     url = url + "format=json&"
     url = url + "api_key=%s" % API_KEY
     print(("last.fm query url = %s" % url))
     return url
コード例 #3
0
    def search_url(self, artist, album, album_mbid):
        # Remove variants of Disc/CD [1-9] from album title before search
        orig_album = album
        for exp in DISC_NUMBER_REGEXS:
            p = re.compile(exp, re.IGNORECASE)
            album = p.sub('', album)

        album.strip()

        print("searching for (%s, %s, %s)" % (artist, album, album_mbid))
        url = API_URL + "?method=album.getinfo&"
        if artist != None:
            url = url + "artist=%s&" % (rb3compat.quote_plus(artist))
        if album != None:
            url = url + "album=%s&" % (rb3compat.quote_plus(album))
        if album_mbid != None:
            url = url + "mbid=%s&" % (rb3compat.quote_plus(album_mbid))

        url = url + "api_key=%s" % API_KEY
        print("last.fm query url = %s" % url)
        return url