Procházet zdrojové kódy

Fix lookup bug in track year

Colin Powell před 2 roky
rodič
revize
ab88fcb9a7
1 změnil soubory, kde provedl 7 přidání a 1 odebrání
  1. 7 1
      vrobbler/apps/music/models.py

+ 7 - 1
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(