From cae6d970cafcde637f883f0f042ee0518ec0c97b Mon Sep 17 00:00:00 2001 From: jesopo Date: Mon, 18 Feb 2019 13:19:45 +0000 Subject: [PATCH] Sometimes lastfm doesn't give us a list of tracks (lastfm.py) --- modules/lastfm.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/lastfm.py b/modules/lastfm.py index 1198b6f5..7cf52832 100644 --- a/modules/lastfm.py +++ b/modules/lastfm.py @@ -31,7 +31,10 @@ class Module(ModuleManager.BaseModule): if page: if "recenttracks" in page.data and len(page.data["recenttracks" ]["track"]): - now_playing = page.data["recenttracks"]["track"][0] + now_playing = page.data["recenttracks"]["track"] + if type(now_playing) == list: + now_playing = now_playing[0] + track_name = now_playing["name"] artist = now_playing["artist"]["#text"]