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()