added wider scope playlist counting and handling for unknown image sizes

This commit is contained in:
aj 2019-10-20 15:54:09 +01:00
parent c2561ae9de
commit 3289e6b242
2 changed files with 6 additions and 1 deletions

View File

@ -15,6 +15,8 @@ class Image:
medium = 2
large = 3
extralarge = 4
mega = 5
other = 6
def __init__(self, size: Size, link: str):
self.size = size

View File

@ -310,7 +310,10 @@ class Network:
@staticmethod
def parse_image(image_dict) -> Image:
return Image(size=Image.Size[image_dict['size']], link=image_dict['#text'])
try:
return Image(size=Image.Size[image_dict['size']], link=image_dict['#text'])
except KeyError:
return Image(size=Image.Size['other'], link=image_dict['#text'])
@staticmethod
def parse_scrobble(scrobble_dict) -> Scrobble: