From 645e81299b1910e8a8366a2b29c0f40a024aec7c Mon Sep 17 00:00:00 2001 From: Colin Powell Date: Sat, 23 May 2026 16:22:52 -0400 Subject: [PATCH] [imports] Clean up logs and fix missing tz for birding --- vrobbler/apps/birds/importer.py | 3 +++ vrobbler/apps/scrobbles/importers/webdav.py | 15 ++++++++------- vrobbler/apps/scrobbles/scrobblers.py | 4 +--- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/vrobbler/apps/birds/importer.py b/vrobbler/apps/birds/importer.py index 5a69a5b..587fe23 100644 --- a/vrobbler/apps/birds/importer.py +++ b/vrobbler/apps/birds/importer.py @@ -157,9 +157,12 @@ def import_birding_csv(file_path, user_id): stop_timestamp = timestamp + timedelta(minutes=duration_minutes) if duration_minutes else None + tz = getattr(timestamp.tzinfo, "name", None) + scrobble = Scrobble( user=user, timestamp=timestamp, + timezone=tz, stop_timestamp=stop_timestamp, source="Birding CSV Import", birding_location=location, diff --git a/vrobbler/apps/scrobbles/importers/webdav.py b/vrobbler/apps/scrobbles/importers/webdav.py index a610e9b..6d33e33 100644 --- a/vrobbler/apps/scrobbles/importers/webdav.py +++ b/vrobbler/apps/scrobbles/importers/webdav.py @@ -328,12 +328,13 @@ def scan_webdav_for_bgstats(webdav_client, user_id): with open(tmp.name, "r", encoding="utf-8") as f: parsed_json = json.load(f) scrobbles = email_scrobble_board_game(parsed_json, user_id) - logger.info( - "BG Stats import from %s for user %d created %d scrobble(s)", - fname, - user_id, - len(scrobbles), - ) + if scrobbles: + logger.info( + "BG Stats import from %s for user %d created %d scrobble(s)", + fname, + user_id, + len(scrobbles), + ) processed += 1 except Exception as e: logger.error( @@ -342,4 +343,4 @@ def scan_webdav_for_bgstats(webdav_client, user_id): finally: os.unlink(tmp.name) - return processed \ No newline at end of file + return processed diff --git a/vrobbler/apps/scrobbles/scrobblers.py b/vrobbler/apps/scrobbles/scrobblers.py index 3213ebd..529ec13 100644 --- a/vrobbler/apps/scrobbles/scrobblers.py +++ b/vrobbler/apps/scrobbles/scrobblers.py @@ -539,9 +539,7 @@ def email_scrobble_board_game( scrobble = None if timestamp.year > 2023: - logger.info( - "Scrobbles older than 2024 likely have no time associated just create it" - ) + # Scrobbles older than 2023 have play times, so try looking it up scrobble = Scrobble.objects.filter( board_game=base_game, user_id=user_id, timestamp=timestamp ).first()