diff --git a/CHANGELOG.md b/CHANGELOG.md index c13f6e6..2e87689 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # Changelog +## 1.7.x +### 1.7.0: Feature - Automatically Add Missing EXIF Fields +- Between versions 1.5 and 1.6, two new EXIF fields were introduced: `developer` and `time`. +- If these fields were missing in the local EXIF file, the program would still load but crash when processing an image. +- Previously, this could be fixed manually by adding the missing fields, something I could easily do myself, but not ideal for other users. +- The program now automatically checks if the local EXIF file has these fields, and if not, it adds them with default values. +- This might make it easier in the future to adjust local files. + +--- + ## 1.6.x ### 1.6.0: Feature - Add Information from Developing Process diff --git a/src/OptimaLab35/__main__.py b/src/OptimaLab35/__main__.py index 512c7b3..4f21bcc 100644 --- a/src/OptimaLab35/__main__.py +++ b/src/OptimaLab35/__main__.py @@ -11,7 +11,7 @@ def main(): app_settings = u.load_settings() app = QtWidgets.QApplication(sys.argv) - try: + try: # Check weather the pkg for theme is installed import qdarktheme app_settings["theme"]["theme_pkg"] = True except ImportError: @@ -20,7 +20,8 @@ def main(): if app_settings["theme"]["use_custom_theme"] and app_settings["theme"]["theme_pkg"]: qdarktheme.setup_theme(app_settings["theme"]["mode"].lower()) - u.save_settings(app_settings) + u.save_settings(app_settings) # Save the settings after check to ensure that everything is present if enabled. + u.adjust_exif_after_update() window = OptimaLab35() window.show() diff --git a/src/OptimaLab35/utils/utility.py b/src/OptimaLab35/utils/utility.py index 3f71698..0fafe52 100644 --- a/src/OptimaLab35/utils/utility.py +++ b/src/OptimaLab35/utils/utility.py @@ -47,6 +47,23 @@ class Utilities: if not self.write_yaml(self.settings_path, settings): print("Error writing file") + def adjust_exif_after_update(self): + """Adds new info the exif file after an update if needed""" + new_lst = ["developer", "time"] # for update from 1.5 to 1.6 + + current_lst = [] + exif = self.read_yaml(self.exif_path) + for key in exif: + current_lst.append(key) + + if all(item in current_lst for item in new_lst): + return + else: + print("Adding new exif data after update from 1.5") + exif["time"] = ["NA", "7:30", "10:00"] + exif["developer"] = ["NA", "Kodac HC-110 1:31", "Kodac HC-110 1:63"] + self.write_yaml(self.exif_path, exif) + def default_exif(self): """Makes a default exif file.""" print("Making default") @@ -89,6 +106,15 @@ class Utilities: "user_comment": [ "Scanner: NORITSU-KOKI", "Scanner: NA" + ], + "developer": [ + "Kodak HC-110 1:31", + "Kodak HC-110 1:63" + ], + "time": [ + "NA", + "7:00", + "10:00" ] } self.write_yaml(self.exif_path, def_exif)