From f90fa160d79d7271c2053b1bcd67488c3412fba1 Mon Sep 17 00:00:00 2001 From: Colin Powell Date: Wed, 6 Mar 2024 18:01:52 -0500 Subject: [PATCH] [scrobbling] Enrich some more logs --- vrobbler/apps/scrobbles/utils.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/vrobbler/apps/scrobbles/utils.py b/vrobbler/apps/scrobbles/utils.py index 2f4f3e8..b94a7ed 100644 --- a/vrobbler/apps/scrobbles/utils.py +++ b/vrobbler/apps/scrobbles/utils.py @@ -100,8 +100,10 @@ def check_scrobble_for_finish( ) return + is_complete = False if scrobble.percent_played >= completion_percent or force_finish: - logger.info(f"{scrobble.id} finished at {scrobble.percent_played}") + is_complete = True + # A hack to fix overruns on time ... default to media taking as long as needed to finish scrobble.playback_position_seconds = ( scrobble.media_obj.run_time_seconds ) @@ -118,14 +120,16 @@ def check_scrobble_for_finish( "playback_position_seconds", ] ) - else: - logger.info( - f"[scrobbling] not complete", - extra={ - "scrobble_id": scrobble.id, - "percent_played": scrobble.percent_played, - }, - ) + logger.info( + f"[scrobbling] checked for completion", + extra={ + "scrobble_id": scrobble.id, + "percent_played": scrobble.percent_played, + "completion_percent": completion_percent, + "is_complete": is_complete, + "force_finish": force_finish, + }, + ) def get_scrobbles_for_media(media_obj, user: User) -> models.QuerySet: