|
@@ -15,7 +15,10 @@ def process_scrobbles_from_imap() -> list[Scrobble]:
|
|
|
scrobbles_created: list[Scrobble] = []
|
|
|
|
|
|
active_profiles = UserProfile.objects.filter(imap_auto_import=True)
|
|
|
- logger.info("Starting import of scrobbles from IMAP", extra={"active_profiles": active_profiles})
|
|
|
+ logger.info(
|
|
|
+ "Starting import of scrobbles from IMAP",
|
|
|
+ extra={"active_profiles": active_profiles},
|
|
|
+ )
|
|
|
for profile in active_profiles:
|
|
|
logger.info(
|
|
|
"Importing scrobbles from IMAP for user",
|
|
@@ -75,17 +78,21 @@ def process_scrobbles_from_imap() -> list[Scrobble]:
|
|
|
file_data.decode("utf-8")
|
|
|
)
|
|
|
except Exception as e:
|
|
|
- logger.error("Failed to parse JSON file", extra={"filename": filename, "error": e})
|
|
|
+ logger.error(
|
|
|
+ "Failed to parse JSON file",
|
|
|
+ extra={"filename": filename, "error": e},
|
|
|
+ )
|
|
|
|
|
|
if not parsed_json:
|
|
|
- logger.info("No JSON found in BG Stats file", extra={"filename": filename})
|
|
|
+ logger.info(
|
|
|
+ "No JSON found in BG Stats file",
|
|
|
+ extra={"filename": filename},
|
|
|
+ )
|
|
|
continue
|
|
|
|
|
|
- scrobble = email_scrobble_board_game(
|
|
|
+ scrobbles_created = email_scrobble_board_game(
|
|
|
parsed_json, profile.user_id
|
|
|
)
|
|
|
- if scrobble:
|
|
|
- scrobbles_created.append(scrobble)
|
|
|
|
|
|
mail.logout()
|
|
|
|