diff --git a/vrobbler/apps/music/models.py b/vrobbler/apps/music/models.py index 56f37a9..2deaa08 100644 --- a/vrobbler/apps/music/models.py +++ b/vrobbler/apps/music/models.py @@ -129,7 +129,9 @@ class Album(TimeStampedModel): return self.artists.first() def scrape_theaudiodb(self) -> None: - artist = self.primary_artist.name + artist = "Various Artists" + if self.primary_artist: + artist = self.primary_artist.name album_data = lookup_album_from_tadb(self.name, artist) if not album_data.get('theaudiodb_id'): logger.info(f"No data for {self} found in TheAudioDB") diff --git a/vrobbler/apps/scrobbles/theaudiodb.py b/vrobbler/apps/scrobbles/theaudiodb.py index 63e4d0b..78a05e2 100644 --- a/vrobbler/apps/scrobbles/theaudiodb.py +++ b/vrobbler/apps/scrobbles/theaudiodb.py @@ -58,13 +58,16 @@ def lookup_album_from_tadb(name: str, artist: str) -> dict: album_info['theaudiodb_mood'] = album.get('strMood') album_info['theaudiodb_speed'] = album.get('strSpeed') album_info['theaudiodb_theme'] = album.get('strTheme') - album_info['theaudiodb_year_released'] = album.get('intYearReleased') album_info['allmusic_id'] = album.get('strAllMusicID') album_info['wikipedia_slug'] = album.get('strWikipediaID') album_info['discogs_id'] = album.get('strDiscogsID') album_info['wikidata_id'] = album.get('strWikidataID') album_info['rateyourmusic_id'] = album.get('strRateYourMusicID') + if album.get('intYearReleased'): + album_info['theaudiodb_year_released'] = float( + album.get('intYearReleased') + ) if album.get('intScore'): album_info['theaudiodb_score'] = float(album.get('intScore')) if album.get('intScoreVotes'):