Actually fix the VA bug
This commit is contained in:
@ -180,13 +180,11 @@ class Album(TimeStampedModel):
|
||||
from music.utils import get_or_create_various_artists
|
||||
|
||||
multiple_artists = self.artists.count() > 1
|
||||
if not self.album_artist:
|
||||
if multiple_artists:
|
||||
self.album_artist = get_or_create_various_artists()
|
||||
else:
|
||||
self.album_artist = self.artists.first()
|
||||
|
||||
self.save(update_fields=["album_artist"])
|
||||
if multiple_artists:
|
||||
self.album_artist = get_or_create_various_artists()
|
||||
else:
|
||||
self.album_artist = self.artists.first()
|
||||
self.save(update_fields=["album_artist"])
|
||||
|
||||
def scrape_allmusic(self, force=False) -> None:
|
||||
if not self.allmusic_id or force:
|
||||
|
||||
@ -55,22 +55,26 @@ def get_or_create_album(
|
||||
|
||||
if not album and name:
|
||||
mbid = mbid or album_dict["mb_id"]
|
||||
album = Album.objects.create(name=name, musicbrainz_id=mbid)
|
||||
album.year = album_dict["year"]
|
||||
album.musicbrainz_releasegroup_id = album_dict["mb_group_id"]
|
||||
album.musicbrainz_albumartist_id = artist.musicbrainz_id
|
||||
album.save(
|
||||
update_fields=[
|
||||
"musicbrainz_id",
|
||||
"year",
|
||||
"musicbrainz_releasegroup_id",
|
||||
"musicbrainz_albumartist_id",
|
||||
]
|
||||
album, album_created = Album.objects.get_or_create(
|
||||
name=name, musicbrainz_id=mbid
|
||||
)
|
||||
album.artists.add(artist)
|
||||
album.fetch_artwork()
|
||||
album.fix_album_artist()
|
||||
album.scrape_allmusic()
|
||||
if album_created:
|
||||
album.year = album_dict["year"]
|
||||
album.musicbrainz_releasegroup_id = album_dict["mb_group_id"]
|
||||
album.musicbrainz_albumartist_id = artist.musicbrainz_id
|
||||
album.save(
|
||||
update_fields=[
|
||||
"musicbrainz_id",
|
||||
"year",
|
||||
"musicbrainz_releasegroup_id",
|
||||
"musicbrainz_albumartist_id",
|
||||
]
|
||||
)
|
||||
album.artists.add(artist)
|
||||
album.fetch_artwork()
|
||||
album.scrape_allmusic()
|
||||
album.fix_album_artist()
|
||||
|
||||
if not album:
|
||||
logger.warn(f"No album found for {name} and {mbid}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user