|
@@ -46,6 +46,13 @@ def process_scrobbles_from_imap() -> list[Scrobble]:
|
|
logger.info("No email message data found")
|
|
logger.info("No email message data found")
|
|
return
|
|
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():
|
|
for part in message.walk():
|
|
if part.get_content_disposition() == "attachment":
|
|
if part.get_content_disposition() == "attachment":
|
|
filename = part.get_filename()
|
|
filename = part.get_filename()
|