From e0e7e6ac766e1216e45bdf2d3f5268fb262ff50a Mon Sep 17 00:00:00 2001 From: Tim Bendt Date: Thu, 8 May 2025 12:06:42 -0600 Subject: [PATCH] unused code removed --- fetch_outlook.py | 20 +++----------------- maildir_gtd/app.py | 3 +-- 2 files changed, 4 insertions(+), 19 deletions(-) diff --git a/fetch_outlook.py b/fetch_outlook.py index aed570c..54c38ef 100644 --- a/fetch_outlook.py +++ b/fetch_outlook.py @@ -84,7 +84,6 @@ async def delete_with_aiohttp(url, headers): async def synchronize_maildir_async(maildir_path, headers, progress, task_id): last_sync = load_last_sync_timestamp() - current_time = time.time() # Find messages moved from "new" to "cur" and mark them as read new_dir = os.path.join(maildir_path, 'new') @@ -295,7 +294,6 @@ def create_maildir_structure(base_path): async def save_mime_to_maildir_async(maildir_path, email_data, attachments_dir, headers, progress): # Create a new EmailMessage object - msg = EmailMessage() # Determine the directory based on isRead target_dir = 'cur' if email_data.get('isRead', False) else 'new' id = email_data.get('id', '') @@ -363,7 +361,7 @@ def save_email_to_maildir(maildir_path, email_data, attachments_dir, progress): # Download attachments progress.console.print(f"Downloading attachments for message: {msg['Message-ID']}") for attachment in email_data.get('attachments', []): - attachment_id = attachment.get('id') + attachment_name = attachment.get('name', 'unknown') attachment_content = attachment.get('contentBytes') if attachment_content: @@ -396,12 +394,7 @@ def save_email_to_maildir(maildir_path, email_data, attachments_dir, progress): async def main(): - # Load cached timestamp if it exists - if os.path.exists(cache_timestamp_file): - with open(cache_timestamp_file, 'r') as f: - cache_timestamp = json.load(f) - else: - cache_timestamp = {} + # Save emails to Maildir maildir_path = os.getenv('MAILDIR_PATH', os.path.expanduser('~/Mail')) + "/corteva" @@ -423,14 +416,7 @@ async def main(): if os.path.exists(cache_file): cache.deserialize(open(cache_file, 'r').read()) - # Filepath for caching ETag - etag_cache_file = 'etag_cache.json' - # Load cached ETag if it exists - if os.path.exists(etag_cache_file): - with open(etag_cache_file, 'r') as f: - etag_cache = json.load(f) - else: - etag_cache = {} + # Authentication authority = f'https://login.microsoftonline.com/{tenant_id}' diff --git a/maildir_gtd/app.py b/maildir_gtd/app.py index 4c3e4ee..efcaec8 100644 --- a/maildir_gtd/app.py +++ b/maildir_gtd/app.py @@ -139,7 +139,6 @@ class EmailViewerApp(App): self.action_oldest() def compute_status_title(self) -> None: - sort_indicator = "\u2191" if self.sort_order_ascending else "\u2193" return f"✉️ Message ID: {self.current_message_id} " def compute_valid_envelopes(self) -> None: @@ -179,7 +178,7 @@ class EmailViewerApp(App): def watch_reload_needed(self, old_reload_needed: bool, new_reload_needed: bool) -> None: logging.info(f"Reload needed: {new_reload_needed}") - if (old_reload_needed == False and new_reload_needed == True): + if (not old_reload_needed and new_reload_needed): self.fetch_envelopes()