From 62240bf2f41ca728bd34a37ea41abd36ced07e25 Mon Sep 17 00:00:00 2001 From: Mizaki Date: Sun, 4 Feb 2024 20:33:10 +0000 Subject: [PATCH] Add OverlayMode options for read style and data source --- comictaggerlib/autotagmatchwindow.py | 2 +- comictaggerlib/cli.py | 2 +- comictaggerlib/ctsettings/settngs_namespace.py | 1 + comictaggerlib/settingswindow.py | 8 ++++---- comictaggerlib/ui/settingswindow.ui | 9 ++++++--- 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/comictaggerlib/autotagmatchwindow.py b/comictaggerlib/autotagmatchwindow.py index a0cf9f6..163f597 100644 --- a/comictaggerlib/autotagmatchwindow.py +++ b/comictaggerlib/autotagmatchwindow.py @@ -262,7 +262,7 @@ class AutoTagMatchWindow(QtWidgets.QDialog): return QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.CursorShape.WaitCursor)) - md.overlay(ct_md, self.config.internal__source_data_overlay) + md.overlay(ct_md, self.config.Metadata_Options__source_overlay) for style in self._styles: success = ca.write_metadata(md, style) QtWidgets.QApplication.restoreOverrideCursor() diff --git a/comictaggerlib/cli.py b/comictaggerlib/cli.py index b299304..13dc94a 100644 --- a/comictaggerlib/cli.py +++ b/comictaggerlib/cli.py @@ -253,7 +253,7 @@ class CLI: if ca.has_metadata(style): try: t_md = ca.read_metadata(style) - md.overlay(t_md, self.config.internal__load_data_overlay) + md.overlay(t_md, self.config.Metadata_Options__read_style_overlay) break except Exception as e: logger.error("Failed to load metadata for %s: %s", ca.path, e) diff --git a/comictaggerlib/ctsettings/settngs_namespace.py b/comictaggerlib/ctsettings/settngs_namespace.py index ec29382..d2e5f18 100644 --- a/comictaggerlib/ctsettings/settngs_namespace.py +++ b/comictaggerlib/ctsettings/settngs_namespace.py @@ -206,6 +206,7 @@ class Metadata_Options(typing.TypedDict): cbl_copy_weblink_to_comments: bool cbl_apply_transform_on_import: bool cbl_apply_transform_on_bulk_operation: bool + metadata_overlay: OverlayMode use_short_metadata_names: bool disable_cr: bool diff --git a/comictaggerlib/settingswindow.py b/comictaggerlib/settingswindow.py index 0b60b15..5cd9bf7 100644 --- a/comictaggerlib/settingswindow.py +++ b/comictaggerlib/settingswindow.py @@ -433,10 +433,10 @@ class SettingsWindow(QtWidgets.QDialog): self.config[0].Metadata_Options__cbl_apply_transform_on_bulk_operation ) self.cbxOverlayReadStyle.setCurrentIndex( - self.cbxOverlayReadStyle.findData(self.config[0].internal__load_data_overlay.value) + self.cbxOverlayReadStyle.findData(self.config[0].Metadata_Options__read_style_overlay.value) ) self.cbxOverlaySource.setCurrentIndex( - self.cbxOverlaySource.findData(self.config[0].internal__source_data_overlay.value) + self.cbxOverlaySource.findData(self.config[0].Metadata_Options__source_overlay.value) ) self.cbxShortMetadataNames.setChecked(self.config[0].Metadata_Options__use_short_metadata_names) self.cbxDisableCR.setChecked(self.config[0].Metadata_Options__disable_cr) @@ -570,8 +570,8 @@ class SettingsWindow(QtWidgets.QDialog): self.cbxApplyCBLTransformOnBatchOperation.isChecked() ) - self.config[0].internal__load_data_overlay = OverlayMode[self.cbxOverlayReadStyle.currentData()] - self.config[0].internal__source_data_overlay = OverlayMode[self.cbxOverlaySource.currentData()] + self.config[0].Metadata_Options__read_style_overlay = OverlayMode[self.cbxOverlayReadStyle.currentData()] + self.config[0].Metadata_Options__source_overlay = OverlayMode[self.cbxOverlaySource.currentData()] self.config[0].Metadata_Options__disable_cr = self.cbxDisableCR.isChecked() # Update metadata style names if required if self.config[0].Metadata_Options__use_short_metadata_names != self.cbxShortMetadataNames.isChecked(): diff --git a/comictaggerlib/ui/settingswindow.ui b/comictaggerlib/ui/settingswindow.ui index ca5d2a5..7423156 100644 --- a/comictaggerlib/ui/settingswindow.ui +++ b/comictaggerlib/ui/settingswindow.ui @@ -755,7 +755,8 @@ false - Overlays all the none empty values of the read style/data source (e.g. Comic Vine) metadata on top of the current metadata (i.e. file name parsing, other read style(s)). + Read Style: Overlays all the none empty values of the read style metadata on top of the current metadata (i.e. file name parsing, other read style(s)). +Data Source: Overlays all the none empty values from the data source (e.g. Comic Vine) on top of the current metadata (i.e. file name parsing, read style(s)). Example: (Series=batman, Issue=1, Tags=[batman,joker,robin]) @@ -792,7 +793,8 @@ Example: - Adds any metadata that is present in the read style/data source (e.g. Comic Vine) but is missing in the current metadata (i.e. file name parsing, other read style(s)). + Read Style: Adds any metadata that is present in the read style but is missing in the current metadata (i.e. file name parsing, other read style(s)). +Data Source: Add any metadata that is present in the data source (e.g. Comic Vine) but is missing in the current metadata (i.e. file name parsing, read style(s)). Example: (Series=batman, Issue=1, Tags=[batman,joker,robin]) @@ -829,7 +831,8 @@ Example: - Combine lists (tags, characters, genres, credits, etc.) replacing duplicates with the "new" data and all other non-empty values are replaced by the "new" values. + Read Style: Same as Overlay except lists (tags, characters, genres, credits, etc.) are combined with the current metadata (i.e. file name parsing, other read style(s)). +Data Source: Same as Overlay except lists (tags, characters, genres, credits, etc.) are combined with the current metadata (i.e. file name parsing, read style(s)). Example: (Series=batman, Issue=1, Tags=[batman,joker,robin])