Fix lastfm
This commit is contained in:
parent
e46cb5c826
commit
7f3b433209
1 changed files with 5 additions and 5 deletions
|
@ -36,10 +36,10 @@ def lastfm(inp, nick='', db=None, bot=None, notice=None):
|
||||||
api_key=api_key, user=user, limit=1)
|
api_key=api_key, user=user, limit=1)
|
||||||
|
|
||||||
if 'error' in response:
|
if 'error' in response:
|
||||||
return "Error: {}.".format(response["message"])
|
return u"Error: {}.".format(response["message"])
|
||||||
|
|
||||||
if not "track" in response["recenttracks"] or len(response["recenttracks"]["track"]) == 0:
|
if not "track" in response["recenttracks"] or len(response["recenttracks"]["track"]) == 0:
|
||||||
return 'No recent tracks for user "{}" found.'.format(user)
|
return u'No recent tracks for user "{}" found.'.format(user)
|
||||||
|
|
||||||
tracks = response["recenttracks"]["track"]
|
tracks = response["recenttracks"]["track"]
|
||||||
|
|
||||||
|
@ -66,11 +66,11 @@ def lastfm(inp, nick='', db=None, bot=None, notice=None):
|
||||||
album = track["album"]["#text"]
|
album = track["album"]["#text"]
|
||||||
artist = track["artist"]["#text"]
|
artist = track["artist"]["#text"]
|
||||||
|
|
||||||
out = '{} {} "{}"'.format(user, status, title)
|
out = u'{} {} "{}"'.format(user, status, title)
|
||||||
if artist:
|
if artist:
|
||||||
out += " by \x02{}\x0f".format(artist)
|
out += u" by \x02{}\x0f".format(artist)
|
||||||
if album:
|
if album:
|
||||||
out += " from the album \x02{}\x0f".format(album)
|
out += u" from the album \x02{}\x0f".format(album)
|
||||||
|
|
||||||
# append ending based on what type it was
|
# append ending based on what type it was
|
||||||
out += ending
|
out += ending
|
||||||
|
|
Reference in a new issue