From 82bbb5c2ab9746dd354ad4c39636c977990bdbc1 Mon Sep 17 00:00:00 2001 From: RemixDev Date: Thu, 1 Jul 2021 20:19:13 +0200 Subject: [PATCH] Make sure the new cover md5 exists before overwriting it --- deemix/types/Album.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deemix/types/Album.py b/deemix/types/Album.py index d1e0fda..be68f01 100644 --- a/deemix/types/Album.py +++ b/deemix/types/Album.py @@ -92,7 +92,7 @@ class Album: self.discTotal = albumAPI.get('nb_disk') self.copyright = albumAPI.get('copyright') - if self.pic.md5 == "": + if self.pic.md5 == "" and albumAPI.get('cover_small'): # Getting album cover MD5 # ex: https://e-cdns-images.dzcdn.net/images/cover/2e018122cb56986277102d2041a592c8/56x56-000000-80-0-0.jpg alb_pic = albumAPI['cover_small'] @@ -121,7 +121,7 @@ class Album: self.addExtraAlbumGWData(albumAPI_gw) def addExtraAlbumGWData(self, albumAPI_gw): - if self.pic.md5 == "": + if self.pic.md5 == "" and albumAPI_gw.get('ALB_PICTURE'): self.pic.md5 = albumAPI_gw['ALB_PICTURE'] if 'PHYSICAL_RELEASE_DATE' in albumAPI_gw: self.date.day = albumAPI_gw["PHYSICAL_RELEASE_DATE"][8:10]