diff --git a/main.py b/main.py index 5f19a2a..9c28d00 100644 --- a/main.py +++ b/main.py @@ -1,8 +1,12 @@ # src/main.py +import os +import time import json import threading import argparse import traceback +from pathlib import Path +from typing import Dict from src.constants import * import tempfile import errno diff --git a/src/CoverCleaner.py b/src/CoverCleaner.py index d511ed7..bc10099 100644 --- a/src/CoverCleaner.py +++ b/src/CoverCleaner.py @@ -1,5 +1,6 @@ from pathlib import Path import zipfile +import os import re import shutil from typing import List, Optional diff --git a/src/config.py b/src/config.py index a68f995..86c44e3 100644 --- a/src/config.py +++ b/src/config.py @@ -2,6 +2,7 @@ import os import sys import shutil +from datetime import datetime ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) CONFIG_DIR = os.path.join(ROOT_DIR, 'backups') diff --git a/src/constants.py b/src/constants.py index 674a74e..4ba8994 100644 --- a/src/constants.py +++ b/src/constants.py @@ -1,3 +1,4 @@ +import os from pathlib import Path RAW_COVER_DIR = Path('./RawCover') diff --git a/src/getIDs.py b/src/getIDs.py index 074771f..e70d4c3 100644 --- a/src/getIDs.py +++ b/src/getIDs.py @@ -1,5 +1,7 @@ # src/get_ids.py import json +import sys +import requests import re import os import time diff --git a/src/mediux_downloader.py b/src/mediux_downloader.py index 00b4813..36ea169 100644 --- a/src/mediux_downloader.py +++ b/src/mediux_downloader.py @@ -156,4 +156,4 @@ async def download_and_save_image(session: ClientSession, file_url: str, file_na log(f'Failed to download {file_name}. Status code: {response.status}',success=False) if __name__ == '__main__': - mediux_downloader() + mediux_downloader() \ No newline at end of file diff --git a/src/webhook.py b/src/webhook.py index 70a4116..918c933 100644 --- a/src/webhook.py +++ b/src/webhook.py @@ -7,9 +7,10 @@ def webhook(HA_WEBHOOK_URL, HA_WEBHOOK_ID): webhook_url = f"{HA_WEBHOOK_URL}/api/webhook/{HA_WEBHOOK_ID}" response = requests.post(webhook_url) response.raise_for_status() - log("Webhook sent successfully!") - if response.status_code != 200: + if response.status_code == 200: + log("Webhook sent successfully!") + else: print(f"Statuscode: {response.status_code}") except requests.exceptions.RequestException as e: - print(f"Error while sending webhook: {e}") + print(f"Error while sending webhook: {e}") \ No newline at end of file