Tolerate missing fields from search results

This commit is contained in:
François Charette 2020-12-05 18:53:59 +01:00
parent 1d9f5d9445
commit 0cc107d9c3

View File

@ -28,14 +28,23 @@ class Search:
self.Total.append("[RELEASE] {} - {} - {} [{}]".format(*items))
self.appendInfo(i, True)
except KeyError:
items = (
i["performer"]["name"],
i["title"],
self.seconds(i["duration"]),
"HI-RES" if i["hires"] else "Lossless",
)
self.Total.append("[TRACK] {} - {} - {} [{}]".format(*items))
self.appendInfo(i, False)
try:
items = (
i["performer"]["name"],
i["title"],
self.seconds(i["duration"]),
"HI-RES" if i["hires"] else "Lossless",
)
self.Total.append("[TRACK] {} - {} - {} [{}]".format(*items))
self.appendInfo(i, False)
except KeyError:
items = (
i["title"],
self.seconds(i["duration"]),
"HI-RES" if i["hires"] else "Lossless",
)
self.Total.append("[TRACK] {} [{}]".format(*items))
self.appendInfo(i, False)
def getResults(self, tracks=False):
self.itResults(self.Albums)