Merge branch 'clearMetadata' into develop

This commit is contained in:
lordwelch 2022-05-19 13:39:41 -07:00
commit 983b3d08f6
4 changed files with 42 additions and 12 deletions

View File

@ -108,7 +108,10 @@ def display_match_set_for_choice(
opts, ca, ca.has_metadata(opts.data_style if opts.data_style is not None else 0), settings
)
cv_md = actual_issue_data_fetch(match_set.matches[int(i) - 1], settings, opts)
md.overlay(cv_md)
if opts.overwrite_metadata:
md = cv_md
else:
md.overlay(cv_md)
if opts.auto_imprint:
md.fix_publisher()
@ -181,17 +184,22 @@ def create_local_metadata(
# now, overlay the parsed filename info
if opts.parse_filename:
md.overlay(
ca.metadata_from_filename(
settings.complicated_parser, settings.remove_c2c, settings.remove_fcbd, settings.remove_publisher
)
f_md = ca.metadata_from_filename(
settings.complicated_parser, settings.remove_c2c, settings.remove_fcbd, settings.remove_publisher
)
if opts.overwrite_metadata:
md = f_md
else:
md.overlay(f_md)
if has_desired_tags:
md = ca.read_metadata(opts.data_style if opts.data_style is not None else 0)
# finally, use explicit stuff
md.overlay(opts.metadata)
if opts.overwrite_metadata and not opts.metadata.is_empty:
md = opts.metadata
else:
md.overlay(opts.metadata)
return md
@ -427,7 +435,10 @@ def process_file_cli(
match_results.fetch_data_failures.append(str(ca.path.absolute()))
return
md.overlay(cv_md)
if opts.overwrite_metadata:
md = cv_md
else:
md.overlay(cv_md)
if opts.auto_imprint:
md.fix_publisher()

View File

@ -66,6 +66,8 @@ If no options are given, {0} will run in windowed mode.
-o, --online Search online and attempt to identify file
using existing metadata and images in archive.
May be used in conjunction with -f and -m.
--overwrite Overwite any existing metadata.
May be used in conjunction with -o, -f and -m.
--id=ID Use the issue ID when searching online.
Overrides all other metadata.
-m, --metadata=LIST Explicitly define, as a list, some tags to be
@ -146,6 +148,7 @@ For more help visit the wiki at: https://github.com/comictagger/comictagger/wiki
self.darkmode = False
self.copy_source: Optional[int] = None
self.config_path = ""
self.overwrite_metadata = False
def display_msg_and_quit(self, msg: Optional[str], code: int, show_help: bool = False) -> None:
appname = os.path.basename(sys.argv[0])
@ -292,6 +295,7 @@ For more help visit the wiki at: https://github.com/comictagger/comictagger/wiki
"wait-on-cv-rate-limit",
"darkmode",
"config=",
"overwrite",
],
)
@ -330,6 +334,8 @@ For more help visit the wiki at: https://github.com/comictagger/comictagger/wiki
self.display_msg_and_quit("Invalid copy tag source type", 1)
if o in ("-o", "--online"):
self.search_online = True
if o == "--overwrite":
self.overwrite_metadata = True
if o in ("-n", "--dryrun"):
self.dryrun = True
if o in ("-m", "--metadata"):

View File

@ -1750,7 +1750,10 @@ Please choose options below, and select OK.
match_results.fetch_data_failures.append(str(ca.path.absolute()))
if cv_md is not None:
md.overlay(cv_md)
if dlg.cbxRemoveMetadata.isChecked():
md = cv_md
else:
md.overlay(cv_md)
if self.settings.auto_imprint:
md.fix_publisher()

View File

@ -44,7 +44,7 @@
</item>
<item row="1" column="0">
<layout class="QGridLayout" name="gridLayout">
<item row="7" column="0">
<item row="8" column="0">
<widget class="QCheckBox" name="cbxSpecifySearchString">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
@ -139,7 +139,17 @@
</property>
</widget>
</item>
<item row="10" column="0">
<item row="7" column="0">
<widget class="QCheckBox" name="cbxRemoveMetadata">
<property name="toolTip">
<string>Removes existing metadata before applying retrieved metadata</string>
</property>
<property name="text">
<string>Overwrite metadata</string>
</property>
</widget>
</item>
<item row="11" column="0">
<widget class="QLineEdit" name="leNameLengthMatchTolerance">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
@ -155,7 +165,7 @@
</property>
</widget>
</item>
<item row="8" column="0">
<item row="9" column="0">
<widget class="QLineEdit" name="leSearchString">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
@ -165,7 +175,7 @@
</property>
</widget>
</item>
<item row="9" column="0">
<item row="10" column="0">
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">