25 lines
693 B
Python
25 lines
693 B
Python
|
|
import time
|
|
import logging
|
|
import os
|
|
from webSimple import generate_pdf_list_html
|
|
from email_pdf_downloader import read_emails
|
|
|
|
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
|
|
|
|
def run_daemon():
|
|
while True:
|
|
try:
|
|
read_emails()
|
|
logging.info("Finished checking emails. Sleeping for 1 minutes.")
|
|
except Exception as e:
|
|
logging.error(f"An error occurred: {e}")
|
|
|
|
directory = SCRIPT_DIR+'/data'
|
|
output_file = os.path.join(directory, SCRIPT_DIR+"/index.html")
|
|
generate_pdf_list_html(directory, output_file)
|
|
time.sleep(60) # Sleep for 1 minute between checks
|
|
|
|
if __name__ == "__main__":
|
|
run_daemon()
|