Fixed bug.

This commit is contained in:
Luke Rogers 2013-02-07 11:54:11 +13:00
parent 0c4826fb08
commit ceb09f4334

View file

@ -13,7 +13,10 @@ http_re = (r'(open\.spotify\.com\/(track|album|artist|user)\/'
def spotify(inp):
"spotify <song> -- Search Spotify for <song>"
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)
return u"{} by {} - {}".format(data["result"][0]["name"], data["result"][0]["artist"]["name"], url)