Actually fix the VA bug

This commit is contained in:
2023-03-27 20:19:03 -04:00
parent 3e2a9d2183
commit 1ee8fc589a
3 changed files with 29 additions and 23 deletions

View File

@ -16,7 +16,11 @@ other scrobblers which may have different definitions of when a scrobble
finishes or started. finishes or started.
** TODO Fix bug in Jellyfin scrobbles that spam more scrobbles after completion :scrobbling:videos:bug: ** TODO Fix bug in Jellyfin scrobbles that spam more scrobbles after completion :scrobbling:videos:bug:
** TODO Fix bug in podcast scrobbling where a second scrobble is created after completion :scrobbling:podcasts:bug: ** TODO Fix bug in podcast scrobbling where a second scrobble is created after completion :scrobbling:podcasts:bug:
** TODO Fix bug with Various Artist albums being labeled with first artist as album artist :scrobbling:bug:music: ** DONE Fix bug with Various Artist albums being labeled with first artist as album artist :scrobbling:bug:music:
CLOSED: [2023-03-27 Mon 20:18]
:LOGBOOK:
CLOCK: [2023-03-26 Sun 22:01]--[2023-03-27 Mon 01:07] => 3:06
:END:
** DONE Fix bug with weekly aggregator being blank on Sundays :aggregators:music:bug: ** DONE Fix bug with weekly aggregator being blank on Sundays :aggregators:music:bug:
CLOSED: [2023-03-26 Sun 13:52] CLOSED: [2023-03-26 Sun 13:52]
** DONE Fix KoReader scrobbling to use pages rather than time of last read :scrobbling:books:improvement: ** DONE Fix KoReader scrobbling to use pages rather than time of last read :scrobbling:books:improvement:

View File

@ -180,12 +180,10 @@ class Album(TimeStampedModel):
from music.utils import get_or_create_various_artists from music.utils import get_or_create_various_artists
multiple_artists = self.artists.count() > 1 multiple_artists = self.artists.count() > 1
if not self.album_artist:
if multiple_artists: if multiple_artists:
self.album_artist = get_or_create_various_artists() self.album_artist = get_or_create_various_artists()
else: else:
self.album_artist = self.artists.first() self.album_artist = self.artists.first()
self.save(update_fields=["album_artist"]) self.save(update_fields=["album_artist"])
def scrape_allmusic(self, force=False) -> None: def scrape_allmusic(self, force=False) -> None:

View File

@ -55,7 +55,10 @@ def get_or_create_album(
if not album and name: if not album and name:
mbid = mbid or album_dict["mb_id"] mbid = mbid or album_dict["mb_id"]
album = Album.objects.create(name=name, musicbrainz_id=mbid) album, album_created = Album.objects.get_or_create(
name=name, musicbrainz_id=mbid
)
if album_created:
album.year = album_dict["year"] album.year = album_dict["year"]
album.musicbrainz_releasegroup_id = album_dict["mb_group_id"] album.musicbrainz_releasegroup_id = album_dict["mb_group_id"]
album.musicbrainz_albumartist_id = artist.musicbrainz_id album.musicbrainz_albumartist_id = artist.musicbrainz_id
@ -69,8 +72,9 @@ def get_or_create_album(
) )
album.artists.add(artist) album.artists.add(artist)
album.fetch_artwork() album.fetch_artwork()
album.fix_album_artist()
album.scrape_allmusic() album.scrape_allmusic()
album.fix_album_artist()
if not album: if not album:
logger.warn(f"No album found for {name} and {mbid}") logger.warn(f"No album found for {name} and {mbid}")