diff --git a/build/make.cmd b/build/make.cmd index 68d923f..befce63 100644 --- a/build/make.cmd +++ b/build/make.cmd @@ -1 +1,3 @@ -pip freeze \ No newline at end of file +@echo off +pyinstaller --noconfirm --onedir --windowed --icon "C:/Code/sbRenamer/sbRenamer.ico" --clean --add-data "C:/Code/sbRenamer/sbRenamer.ico;." "C:/Code/sbRenamer/sbRenamer.py" --distpath "C:/Code/sbRenamer/output" --workpath C:\Users\hvdwa\AppData\Local\Temp\build --specpath C:\Users\hvdwa\AppData\Local\Temp\spec + diff --git a/config.ini b/config.ini index e8d26c2..229ee1a 100644 --- a/config.ini +++ b/config.ini @@ -7,5 +7,5 @@ auto_start = False auto_hide = False save_xml = False number_of_days = 0 -fms_format = BOTH +fms_format = b738x diff --git a/sbRenamer.py b/sbRenamer.py index c487f1e..721da27 100644 --- a/sbRenamer.py +++ b/sbRenamer.py @@ -368,9 +368,8 @@ def rename_shortend(self, event, target_filename): dest_file = pathlib.Path(new_file_path.parent / target_filename) # keep the new file to be created to check new event self.file_names_to_ignore.append(dest_file.name) - if self.model.save_existing_target and dest_file.is_file(): - logging.debug("Destination file exits") - self.rename_existing_file(dest_file) + if dest_file.is_file(): + self.handle_existing_destination(dest_file) try: new_file_path.rename(dest_file) @@ -387,6 +386,16 @@ def rename_shortend(self, event, target_filename): "Unable to rename %s to %s, error: %s", filename, dest_file, err ) + def handle_existing_destination(self, dest_file): + """Removes or renames exisiting file""" + logging.debug("Destination file exits") + if self.model.save_existing_target: + logging.debug("Renaming Existing Destination") + self.rename_existing_file(dest_file) + else: + logging.debug("Removing Existing Destination") + os.remove(dest_file) + def rename_existing_file(self, file_to_rename): """renames file to samename with datetime"""