From fbe56f4db98d4dc7c467cad148fd9e9f3e09fff6 Mon Sep 17 00:00:00 2001 From: Timmy Welch Date: Mon, 22 Jan 2024 17:00:59 -0800 Subject: [PATCH] Remove unnecessary dest arguments in settings --- comictaggerlib/cli.py | 8 ++++---- comictaggerlib/ctsettings/commandline.py | 2 -- comictaggerlib/ctsettings/file.py | 1 - comictaggerlib/ctsettings/settngs_namespace.py | 4 ++-- comictaggerlib/renamewindow.py | 2 +- comictaggerlib/settingswindow.py | 4 ++-- 6 files changed, 9 insertions(+), 12 deletions(-) diff --git a/comictaggerlib/cli.py b/comictaggerlib/cli.py index 561a6a3..3633a91 100644 --- a/comictaggerlib/cli.py +++ b/comictaggerlib/cli.py @@ -599,7 +599,7 @@ class CLI: return Result(Action.rename, Status.read_failure, original_path) new_ext = "" # default - if self.config.File_Rename__set_extension_based_on_archive: + if self.config.File_Rename__auto_extension: new_ext = ca.extension() renamer = FileRenamer( @@ -674,7 +674,7 @@ class CLI: export_success = False if not self.config.Runtime_Options__dryrun: if export_success := ca.export_as_zip(new_file): - if self.config.Runtime_Options__delete_after_zip_export: + if self.config.Runtime_Options__delete_original: try: filename_path.unlink(missing_ok=True) delete_success = True @@ -685,7 +685,7 @@ class CLI: new_file.unlink(missing_ok=True) else: msg = msg_hdr + f"Dry-run: Would try to create {os.path.split(new_file)[1]}" - if self.config.Runtime_Options__delete_after_zip_export: + if self.config.Runtime_Options__delete_original: msg += " and delete original." self.output(msg) return Result(Action.export, Status.success, ca.path, new_file) @@ -693,7 +693,7 @@ class CLI: msg = msg_hdr if export_success: msg += f"Archive exported successfully to: {os.path.split(new_file)[1]}" - if self.config.Runtime_Options__delete_after_zip_export and delete_success: + if self.config.Runtime_Options__delete_original and delete_success: msg += " (Original deleted) " else: msg += "Archive failed to export!" diff --git a/comictaggerlib/ctsettings/commandline.py b/comictaggerlib/ctsettings/commandline.py index ec74e06..01100f1 100644 --- a/comictaggerlib/ctsettings/commandline.py +++ b/comictaggerlib/ctsettings/commandline.py @@ -78,7 +78,6 @@ def register_runtime(parser: settngs.Manager) -> None: parser.add_setting( "--delete-original", action="store_true", - dest="delete_after_zip_export", help="""Delete original archive after successful\nexport to Zip. (only relevant for -e)""", file=False, ) @@ -172,7 +171,6 @@ def register_runtime(parser: settngs.Manager) -> None: ) parser.add_setting( "--overwrite", - dest="overwrite", action=argparse.BooleanOptionalAction, default=True, help="""Apply metadata to already tagged archives (relevant for -s or -c).""", diff --git a/comictaggerlib/ctsettings/file.py b/comictaggerlib/ctsettings/file.py index 8cca837..21488e5 100644 --- a/comictaggerlib/ctsettings/file.py +++ b/comictaggerlib/ctsettings/file.py @@ -184,7 +184,6 @@ def rename(parser: settngs.Manager) -> None: ) parser.add_setting( "--auto-extension", - dest="set_extension_based_on_archive", default=True, action=argparse.BooleanOptionalAction, help="Automatically sets the extension based on the archive type e.g. cbr for rar, cbz for zip", diff --git a/comictaggerlib/ctsettings/settngs_namespace.py b/comictaggerlib/ctsettings/settngs_namespace.py index c469543..b807eaf 100644 --- a/comictaggerlib/ctsettings/settngs_namespace.py +++ b/comictaggerlib/ctsettings/settngs_namespace.py @@ -16,7 +16,7 @@ class settngs_namespace(settngs.TypedNS): Runtime_Options__config: comictaggerlib.ctsettings.types.ComicTaggerPaths Runtime_Options__verbose: int Runtime_Options__abort_on_conflict: bool - Runtime_Options__delete_after_zip_export: bool + Runtime_Options__delete_original: bool Runtime_Options__parse_filename: bool Runtime_Options__issue_id: str Runtime_Options__online: bool @@ -83,7 +83,7 @@ class settngs_namespace(settngs.TypedNS): File_Rename__template: str File_Rename__issue_number_padding: int File_Rename__use_smart_string_cleanup: bool - File_Rename__set_extension_based_on_archive: bool + File_Rename__auto_extension: bool File_Rename__dir: str File_Rename__move_to_dir: bool File_Rename__strict: bool diff --git a/comictaggerlib/renamewindow.py b/comictaggerlib/renamewindow.py index 28078d7..97759c5 100644 --- a/comictaggerlib/renamewindow.py +++ b/comictaggerlib/renamewindow.py @@ -76,7 +76,7 @@ class RenameWindow(QtWidgets.QDialog): self.renamer.replacements = self.config[0].File_Rename__replacements new_ext = ca.path.suffix # default - if self.config[0].File_Rename__set_extension_based_on_archive: + if self.config[0].File_Rename__auto_extension: new_ext = ca.extension() if md is None: diff --git a/comictaggerlib/settingswindow.py b/comictaggerlib/settingswindow.py index 2a66a7c..7e55e92 100644 --- a/comictaggerlib/settingswindow.py +++ b/comictaggerlib/settingswindow.py @@ -407,7 +407,7 @@ class SettingsWindow(QtWidgets.QDialog): self.leRenameTemplate.setText(self.config[0].File_Rename__template) self.leIssueNumPadding.setText(str(self.config[0].File_Rename__issue_number_padding)) self.cbxSmartCleanup.setChecked(self.config[0].File_Rename__use_smart_string_cleanup) - self.cbxChangeExtension.setChecked(self.config[0].File_Rename__set_extension_based_on_archive) + self.cbxChangeExtension.setChecked(self.config[0].File_Rename__auto_extension) self.cbxMoveFiles.setChecked(self.config[0].File_Rename__move_to_dir) self.leDirectory.setText(self.config[0].File_Rename__dir) self.cbxRenameStrict.setChecked(self.config[0].File_Rename__strict) @@ -525,7 +525,7 @@ class SettingsWindow(QtWidgets.QDialog): self.config[0].File_Rename__template = str(self.leRenameTemplate.text()) self.config[0].File_Rename__issue_number_padding = int(self.leIssueNumPadding.text()) self.config[0].File_Rename__use_smart_string_cleanup = self.cbxSmartCleanup.isChecked() - self.config[0].File_Rename__set_extension_based_on_archive = self.cbxChangeExtension.isChecked() + self.config[0].File_Rename__auto_extension = self.cbxChangeExtension.isChecked() self.config[0].File_Rename__move_to_dir = self.cbxMoveFiles.isChecked() self.config[0].File_Rename__dir = self.leDirectory.text()