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,13 +180,11 @@ 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:
if not self.allmusic_id or force: if not self.allmusic_id or force:

View File

@ -55,22 +55,26 @@ 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(
album.year = album_dict["year"] name=name, musicbrainz_id=mbid
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) if album_created:
album.fetch_artwork() album.year = album_dict["year"]
album.fix_album_artist() album.musicbrainz_releasegroup_id = album_dict["mb_group_id"]
album.scrape_allmusic() 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: if not album:
logger.warn(f"No album found for {name} and {mbid}") logger.warn(f"No album found for {name} and {mbid}")