From 4924ef316f2061b889dbba54c732d4d41cc0643e Mon Sep 17 00:00:00 2001 From: Colin Powell Date: Thu, 3 Jul 2025 16:26:21 -0400 Subject: [PATCH] [scrobbles] Add a check for Garmin emails --- vrobbler/apps/scrobbles/imap.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/vrobbler/apps/scrobbles/imap.py b/vrobbler/apps/scrobbles/imap.py index e52a9bf..5a18e73 100644 --- a/vrobbler/apps/scrobbles/imap.py +++ b/vrobbler/apps/scrobbles/imap.py @@ -46,6 +46,13 @@ def process_scrobbles_from_imap() -> list[Scrobble]: logger.info("No email message data found") return + # Decode subject safely + subject, encoding = decode_header(message["Subject"])[0] + if isinstance(subject, bytes): + subject = subject.decode(encoding or "utf-8") + if "live activity now!" in subject: + print("Found a Garmin email") + for part in message.walk(): if part.get_content_disposition() == "attachment": filename = part.get_filename()