diff --git a/ArtNet/artnet_manager.py b/ArtNet/artnet_manager.py index 3697063..a7efcbd 100644 --- a/ArtNet/artnet_manager.py +++ b/ArtNet/artnet_manager.py @@ -16,6 +16,7 @@ from ArtNet.web.link_generator import LinkGenerator class ArtNetManager: def __init__(self, config_location: str = "."): + self.known_image_amount = None self.config = ConfigReader(config_location, "somePassword") if self.config.data["version"] != self.config.CONFIG_VERSION: @@ -63,8 +64,9 @@ class ArtNetManager: self.window.set_temporary_status_message("Hello o7", 5000) def run(self): - if len(self.all_images) > 0: - self.curr_image_index = 0 + if len(self.all_images) == 0: + raise FileNotFoundError("No files or folders were in artnet root!") + self.curr_image_index = 0 self.refresh_shown_image() self.window.show() @@ -89,6 +91,8 @@ class ArtNetManager: if self.db_connection.get_art_by_path(image) is not None: self.known_image_amount += 1 + self.window.ui.imageNumberSpinBox.setMaximum(len(self.all_images)) + def scrape_tags(self, file_name: str, art_ID: int, url: str=None): """ Scrape the tags from the given url and return which one's are new diff --git a/ArtNet/file/config_reader.py b/ArtNet/file/config_reader.py index d92310f..301739a 100644 --- a/ArtNet/file/config_reader.py +++ b/ArtNet/file/config_reader.py @@ -56,8 +56,7 @@ class ConfigReader: Read the config from file and overwrite local settings :return: """ - print(os.path.isfile(self.__config_location)) - print(os.path.join(os.getcwd(), self.__config_location)) + print(f"Config file: {os.path.join(os.getcwd(), self.__config_location)}") file = open(self.__config_location, "r") data = yaml.safe_load(stream=file) self.data = self.decrypt_sensitive_data(data) @@ -114,7 +113,7 @@ class ConfigReader: ) ConfigReader.nonce = bytes("qt34nvßn".encode('utf-8')) - def encrypt_text(self, text: str) -> str: + def encrypt_text(self, text: str) -> bytes: cipher_text_bytes = self.__aesgcm.encrypt(data=text.encode('utf-8'), associated_data=None, nonce=ConfigReader.nonce