Fix scrobbles same song over and over error
This commit is contained in:
@ -17,7 +17,6 @@ from music.models import Album, Artist, Track
|
||||
|
||||
def get_or_create_artist(name: str, mbid: str = None) -> Artist:
|
||||
artist = None
|
||||
logger.debug(f"Got artist {name} and mbid: {mbid}")
|
||||
|
||||
if "feat." in name.lower():
|
||||
name = re.split("feat.", name, flags=re.IGNORECASE)[0].strip()
|
||||
@ -29,13 +28,9 @@ def get_or_create_artist(name: str, mbid: str = None) -> Artist:
|
||||
artist_dict = lookup_artist_from_mb(name)
|
||||
mbid = mbid or artist_dict["id"]
|
||||
|
||||
logger.debug(f"Looking up artist {name} and mbid: {mbid}")
|
||||
artist = Artist.objects.filter(musicbrainz_id=mbid).first()
|
||||
if not artist:
|
||||
artist = Artist.objects.create(name=name, musicbrainz_id=mbid)
|
||||
logger.debug(
|
||||
f"Created artist {artist.name} ({artist.musicbrainz_id}) "
|
||||
)
|
||||
artist.fix_metadata()
|
||||
|
||||
return artist
|
||||
@ -48,9 +43,6 @@ def get_or_create_album(
|
||||
album_dict = lookup_album_dict_from_mb(name, artist_name=artist.name)
|
||||
|
||||
name = name or album_dict["title"]
|
||||
|
||||
logger.debug(f"Looking up album {name} and mbid: {mbid}")
|
||||
|
||||
album = Album.objects.filter(artists__in=[artist], name=name).first()
|
||||
|
||||
if not album and name:
|
||||
|
||||
@ -538,7 +538,7 @@ class Scrobble(TimeStampedModel):
|
||||
if self.media_obj.__class__.__name__ in LONG_PLAY_MEDIA.values():
|
||||
logger.info(f"No - Long play media")
|
||||
updatable = False
|
||||
if self.percent_played > 100:
|
||||
if self.percent_played >= 100:
|
||||
logger.info(f"No - 100% played - {self.id} - {self.source}")
|
||||
updatable = False
|
||||
if self.is_stale:
|
||||
|
||||
Reference in New Issue
Block a user