Fixed bug.
This commit is contained in:
parent
0c4826fb08
commit
ceb09f4334
|
@ -13,7 +13,10 @@ http_re = (r'(open\.spotify\.com\/(track|album|artist|user)\/'
|
||||||
def spotify(inp):
|
def spotify(inp):
|
||||||
"spotify <song> -- Search Spotify for <song>"
|
"spotify <song> -- Search Spotify for <song>"
|
||||||
data = spotimeta.search_track(inp.strip())
|
data = spotimeta.search_track(inp.strip())
|
||||||
type, id = data["result"][0]["href"].split(":")[1:]
|
try:
|
||||||
|
type, id = data["result"][0]["href"].split(":")[1:]
|
||||||
|
except IndexError:
|
||||||
|
return "Could not find track."
|
||||||
url = gateway.format(type, id)
|
url = gateway.format(type, id)
|
||||||
return u"{} by {} - {}".format(data["result"][0]["name"], data["result"][0]["artist"]["name"], url)
|
return u"{} by {} - {}".format(data["result"][0]["name"], data["result"][0]["artist"]["name"], url)
|
||||||
|
|
||||||
|
|
Reference in a new issue