Procházet zdrojové kódy

[music] Fix getting album when duplicated name

Colin Powell před 2 týdny
rodič
revize
1093aa2376
1 změnil soubory, kde provedl 9 přidání a 7 odebrání
  1. 9 7
      vrobbler/apps/music/models.py

+ 9 - 7
vrobbler/apps/music/models.py

@@ -532,13 +532,15 @@ class Album(TimeStampedModel):
             logger.info(
                 f"Could not find album {name} with artist {artist.name} on musicbrainz"
             )
-            album, created = Album.objects.get_or_create(
-                name=name,
-            )
-            if created:
-                # album.fix_metadata()
-                # album.fetch_artwork()
-                ...
+            album = Album.objects.filter(name=name).first()
+            if not album:
+                album, created = Album.objects.get_or_create(
+                    name=name,
+                )
+                if created:
+                    # album.fix_metadata()
+                    # album.fetch_artwork()
+                    ...
             return album
 
         if not artist: