unused code removed
This commit is contained in:
@@ -84,7 +84,6 @@ async def delete_with_aiohttp(url, headers):
|
|||||||
|
|
||||||
async def synchronize_maildir_async(maildir_path, headers, progress, task_id):
|
async def synchronize_maildir_async(maildir_path, headers, progress, task_id):
|
||||||
last_sync = load_last_sync_timestamp()
|
last_sync = load_last_sync_timestamp()
|
||||||
current_time = time.time()
|
|
||||||
|
|
||||||
# Find messages moved from "new" to "cur" and mark them as read
|
# Find messages moved from "new" to "cur" and mark them as read
|
||||||
new_dir = os.path.join(maildir_path, 'new')
|
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):
|
async def save_mime_to_maildir_async(maildir_path, email_data, attachments_dir, headers, progress):
|
||||||
# Create a new EmailMessage object
|
# Create a new EmailMessage object
|
||||||
msg = EmailMessage()
|
|
||||||
# Determine the directory based on isRead
|
# Determine the directory based on isRead
|
||||||
target_dir = 'cur' if email_data.get('isRead', False) else 'new'
|
target_dir = 'cur' if email_data.get('isRead', False) else 'new'
|
||||||
id = email_data.get('id', '')
|
id = email_data.get('id', '')
|
||||||
@@ -363,7 +361,7 @@ def save_email_to_maildir(maildir_path, email_data, attachments_dir, progress):
|
|||||||
# Download attachments
|
# Download attachments
|
||||||
progress.console.print(f"Downloading attachments for message: {msg['Message-ID']}")
|
progress.console.print(f"Downloading attachments for message: {msg['Message-ID']}")
|
||||||
for attachment in email_data.get('attachments', []):
|
for attachment in email_data.get('attachments', []):
|
||||||
attachment_id = attachment.get('id')
|
|
||||||
attachment_name = attachment.get('name', 'unknown')
|
attachment_name = attachment.get('name', 'unknown')
|
||||||
attachment_content = attachment.get('contentBytes')
|
attachment_content = attachment.get('contentBytes')
|
||||||
if attachment_content:
|
if attachment_content:
|
||||||
@@ -396,12 +394,7 @@ def save_email_to_maildir(maildir_path, email_data, attachments_dir, progress):
|
|||||||
|
|
||||||
|
|
||||||
async def main():
|
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
|
# Save emails to Maildir
|
||||||
maildir_path = os.getenv('MAILDIR_PATH', os.path.expanduser('~/Mail')) + "/corteva"
|
maildir_path = os.getenv('MAILDIR_PATH', os.path.expanduser('~/Mail')) + "/corteva"
|
||||||
@@ -423,14 +416,7 @@ async def main():
|
|||||||
if os.path.exists(cache_file):
|
if os.path.exists(cache_file):
|
||||||
cache.deserialize(open(cache_file, 'r').read())
|
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
|
# Authentication
|
||||||
authority = f'https://login.microsoftonline.com/{tenant_id}'
|
authority = f'https://login.microsoftonline.com/{tenant_id}'
|
||||||
|
|||||||
@@ -139,7 +139,6 @@ class EmailViewerApp(App):
|
|||||||
self.action_oldest()
|
self.action_oldest()
|
||||||
|
|
||||||
def compute_status_title(self) -> None:
|
def compute_status_title(self) -> None:
|
||||||
sort_indicator = "\u2191" if self.sort_order_ascending else "\u2193"
|
|
||||||
return f"✉️ Message ID: {self.current_message_id} "
|
return f"✉️ Message ID: {self.current_message_id} "
|
||||||
|
|
||||||
def compute_valid_envelopes(self) -> None:
|
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:
|
def watch_reload_needed(self, old_reload_needed: bool, new_reload_needed: bool) -> None:
|
||||||
logging.info(f"Reload needed: {new_reload_needed}")
|
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()
|
self.fetch_envelopes()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user