From fce5e5d830ad94679a471fd007418898ed67d1b8 Mon Sep 17 00:00:00 2001 From: Hugo Date: Fri, 11 May 2018 22:07:28 +0300 Subject: [PATCH 1/2] 'Tracks' with only one are artists not tracks, skip them --- pylast/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pylast/__init__.py b/pylast/__init__.py index bb8a34a..35cffaf 100644 --- a/pylast/__init__.py +++ b/pylast/__init__.py @@ -2202,8 +2202,11 @@ class User(_BaseObject, _Chartable): self.ws_prefix + ".getLovedTracks", cacheable, params): + try: + artist = _extract(track, "name", 1) + except IndexError: + continue title = _extract(track, "name") - artist = _extract(track, "name", 1) date = _extract(track, "date") timestamp = track.getElementsByTagName( "date")[0].getAttribute("uts") From eae4b6261ccd8ff1698e5c595612380978c9e985 Mon Sep 17 00:00:00 2001 From: Hugo Date: Wed, 16 May 2018 11:45:44 +0300 Subject: [PATCH 2/2] Add '# pragma: no cover' as no easy way to test --- pylast/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pylast/__init__.py b/pylast/__init__.py index 35cffaf..5fef12f 100644 --- a/pylast/__init__.py +++ b/pylast/__init__.py @@ -2204,7 +2204,7 @@ class User(_BaseObject, _Chartable): params): try: artist = _extract(track, "name", 1) - except IndexError: + except IndexError: # pragma: no cover continue title = _extract(track, "name") date = _extract(track, "date")