From ab88fcb9a7d8dbce6d5c114136cad3b5e8dcc3d3 Mon Sep 17 00:00:00 2001 From: Colin Powell Date: Fri, 13 Jan 2023 17:15:13 -0500 Subject: [PATCH] Fix lookup bug in track year --- vrobbler/apps/music/models.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/vrobbler/apps/music/models.py b/vrobbler/apps/music/models.py index 0a41266..c569d77 100644 --- a/vrobbler/apps/music/models.py +++ b/vrobbler/apps/music/models.py @@ -58,7 +58,13 @@ class Album(TimeStampedModel): 'artist-credit' ][0]['artist']['id'] if not self.year: - self.year = mb_data['release']['date'][0:4] + try: + self.year = mb_data['release']['date'][0:4] + except KeyError: + pass + except IndexError: + pass + self.save(update_fields=['musicbrainz_albumartist_id', 'year']) new_artist = Artist.objects.filter(