Merge branch 'bump-settngs' into develop
This commit is contained in:
commit
65948cd9cd
@ -52,7 +52,7 @@ class AutoTagMatchWindow(QtWidgets.QDialog):
|
||||
self.current_match_set: MultipleMatch = match_set_list[0]
|
||||
|
||||
self.altCoverWidget = CoverImageWidget(
|
||||
self.altCoverContainer, CoverImageWidget.AltCoverMode, config.Runtime_Options_config.user_cache_dir, talker
|
||||
self.altCoverContainer, CoverImageWidget.AltCoverMode, config.Runtime_Options__config.user_cache_dir, talker
|
||||
)
|
||||
gridlayout = QtWidgets.QGridLayout(self.altCoverContainer)
|
||||
gridlayout.addWidget(self.altCoverWidget)
|
||||
@ -233,10 +233,10 @@ class AutoTagMatchWindow(QtWidgets.QDialog):
|
||||
md = ca.read_metadata(self._style)
|
||||
if md.is_empty:
|
||||
md = ca.metadata_from_filename(
|
||||
self.config.Filename_Parsing_complicated_parser,
|
||||
self.config.Filename_Parsing_remove_c2c,
|
||||
self.config.Filename_Parsing_remove_fcbd,
|
||||
self.config.Filename_Parsing_remove_publisher,
|
||||
self.config.Filename_Parsing__complicated_parser,
|
||||
self.config.Filename_Parsing__remove_c2c,
|
||||
self.config.Filename_Parsing__remove_fcbd,
|
||||
self.config.Filename_Parsing__remove_publisher,
|
||||
)
|
||||
|
||||
# now get the particular issue data
|
||||
|
@ -40,15 +40,15 @@ class AutoTagStartWindow(QtWidgets.QDialog):
|
||||
|
||||
self.cbxSpecifySearchString.setChecked(False)
|
||||
self.cbxSplitWords.setChecked(False)
|
||||
self.sbNameMatchSearchThresh.setValue(self.config.Issue_Identifier_series_match_identify_thresh)
|
||||
self.sbNameMatchSearchThresh.setValue(self.config.Issue_Identifier__series_match_identify_thresh)
|
||||
self.leSearchString.setEnabled(False)
|
||||
|
||||
self.cbxSaveOnLowConfidence.setChecked(self.config.Auto_Tag_save_on_low_confidence)
|
||||
self.cbxDontUseYear.setChecked(self.config.Auto_Tag_dont_use_year_when_identifying)
|
||||
self.cbxAssumeIssueOne.setChecked(self.config.Auto_Tag_assume_1_if_no_issue_num)
|
||||
self.cbxIgnoreLeadingDigitsInFilename.setChecked(self.config.Auto_Tag_ignore_leading_numbers_in_filename)
|
||||
self.cbxRemoveAfterSuccess.setChecked(self.config.Auto_Tag_remove_archive_after_successful_match)
|
||||
self.cbxAutoImprint.setChecked(self.config.Issue_Identifier_auto_imprint)
|
||||
self.cbxSaveOnLowConfidence.setChecked(self.config.Auto_Tag__save_on_low_confidence)
|
||||
self.cbxDontUseYear.setChecked(self.config.Auto_Tag__dont_use_year_when_identifying)
|
||||
self.cbxAssumeIssueOne.setChecked(self.config.Auto_Tag__assume_1_if_no_issue_num)
|
||||
self.cbxIgnoreLeadingDigitsInFilename.setChecked(self.config.Auto_Tag__ignore_leading_numbers_in_filename)
|
||||
self.cbxRemoveAfterSuccess.setChecked(self.config.Auto_Tag__remove_archive_after_successful_match)
|
||||
self.cbxAutoImprint.setChecked(self.config.Issue_Identifier__auto_imprint)
|
||||
|
||||
nlmt_tip = """<html>The <b>Name Match Ratio Threshold: Auto-Identify</b> is for eliminating automatic
|
||||
search matches that are too long compared to your series name search. The lower
|
||||
@ -73,7 +73,7 @@ class AutoTagStartWindow(QtWidgets.QDialog):
|
||||
self.ignore_leading_digits_in_filename = False
|
||||
self.remove_after_success = False
|
||||
self.search_string = ""
|
||||
self.name_length_match_tolerance = self.config.Issue_Identifier_series_match_search_thresh
|
||||
self.name_length_match_tolerance = self.config.Issue_Identifier__series_match_search_thresh
|
||||
self.split_words = self.cbxSplitWords.isChecked()
|
||||
|
||||
def search_string_toggle(self) -> None:
|
||||
@ -92,11 +92,11 @@ class AutoTagStartWindow(QtWidgets.QDialog):
|
||||
self.split_words = self.cbxSplitWords.isChecked()
|
||||
|
||||
# persist some settings
|
||||
self.config.Auto_Tag_save_on_low_confidence = self.auto_save_on_low
|
||||
self.config.Auto_Tag_dont_use_year_when_identifying = self.dont_use_year
|
||||
self.config.Auto_Tag_assume_1_if_no_issue_num = self.assume_issue_one
|
||||
self.config.Auto_Tag_ignore_leading_numbers_in_filename = self.ignore_leading_digits_in_filename
|
||||
self.config.Auto_Tag_remove_archive_after_successful_match = self.remove_after_success
|
||||
self.config.Auto_Tag__save_on_low_confidence = self.auto_save_on_low
|
||||
self.config.Auto_Tag__dont_use_year_when_identifying = self.dont_use_year
|
||||
self.config.Auto_Tag__assume_1_if_no_issue_num = self.assume_issue_one
|
||||
self.config.Auto_Tag__ignore_leading_numbers_in_filename = self.ignore_leading_digits_in_filename
|
||||
self.config.Auto_Tag__remove_archive_after_successful_match = self.remove_after_success
|
||||
|
||||
if self.cbxSpecifySearchString.isChecked():
|
||||
self.search_string = self.leSearchString.text()
|
||||
|
@ -29,7 +29,7 @@ class CBLTransformer:
|
||||
self.config = config
|
||||
|
||||
def apply(self) -> GenericMetadata:
|
||||
if self.config.Comic_Book_Lover_assume_lone_credit_is_primary:
|
||||
if self.config.Comic_Book_Lover__assume_lone_credit_is_primary:
|
||||
# helper
|
||||
def set_lone_primary(role_list: list[str]) -> tuple[Credit | None, int]:
|
||||
lone_credit: Credit | None = None
|
||||
@ -55,19 +55,19 @@ class CBLTransformer:
|
||||
c["primary"] = False
|
||||
self.metadata.add_credit(c["person"], "Artist", True)
|
||||
|
||||
if self.config.Comic_Book_Lover_copy_characters_to_tags:
|
||||
if self.config.Comic_Book_Lover__copy_characters_to_tags:
|
||||
self.metadata.tags.update(x for x in self.metadata.characters)
|
||||
|
||||
if self.config.Comic_Book_Lover_copy_teams_to_tags:
|
||||
if self.config.Comic_Book_Lover__copy_teams_to_tags:
|
||||
self.metadata.tags.update(x for x in self.metadata.teams)
|
||||
|
||||
if self.config.Comic_Book_Lover_copy_locations_to_tags:
|
||||
if self.config.Comic_Book_Lover__copy_locations_to_tags:
|
||||
self.metadata.tags.update(x for x in self.metadata.locations)
|
||||
|
||||
if self.config.Comic_Book_Lover_copy_storyarcs_to_tags:
|
||||
if self.config.Comic_Book_Lover__copy_storyarcs_to_tags:
|
||||
self.metadata.tags.update(x for x in self.metadata.story_arcs)
|
||||
|
||||
if self.config.Comic_Book_Lover_copy_notes_to_comments:
|
||||
if self.config.Comic_Book_Lover__copy_notes_to_comments:
|
||||
if self.metadata.notes is not None:
|
||||
if self.metadata.description is None:
|
||||
self.metadata.description = ""
|
||||
@ -76,7 +76,7 @@ class CBLTransformer:
|
||||
if self.metadata.notes not in self.metadata.description:
|
||||
self.metadata.description += self.metadata.notes
|
||||
|
||||
if self.config.Comic_Book_Lover_copy_weblink_to_comments:
|
||||
if self.config.Comic_Book_Lover__copy_weblink_to_comments:
|
||||
if self.metadata.web_link is not None:
|
||||
if self.metadata.description is None:
|
||||
self.metadata.description = ""
|
||||
|
@ -44,9 +44,9 @@ class CLI:
|
||||
self.batch_mode = False
|
||||
|
||||
def current_talker(self) -> ComicTalker:
|
||||
if self.config.Sources_source in self.talkers:
|
||||
return self.talkers[self.config.Sources_source]
|
||||
logger.error("Could not find the '%s' talker", self.config.Sources_source)
|
||||
if self.config.Sources__source in self.talkers:
|
||||
return self.talkers[self.config.Sources__source]
|
||||
logger.error("Could not find the '%s' talker", self.config.Sources__source)
|
||||
raise SystemExit(2)
|
||||
|
||||
def actual_issue_data_fetch(self, issue_id: str) -> GenericMetadata:
|
||||
@ -57,14 +57,14 @@ class CLI:
|
||||
logger.exception(f"Error retrieving issue details. Save aborted.\n{e}")
|
||||
return GenericMetadata()
|
||||
|
||||
if self.config.Comic_Book_Lover_apply_transform_on_import:
|
||||
if self.config.Comic_Book_Lover__apply_transform_on_import:
|
||||
ct_md = CBLTransformer(ct_md, self.config).apply()
|
||||
|
||||
return ct_md
|
||||
|
||||
def actual_metadata_save(self, ca: ComicArchive, md: GenericMetadata) -> bool:
|
||||
if not self.config.Runtime_Options_dryrun:
|
||||
for metadata_style in self.config.Runtime_Options_type:
|
||||
if not self.config.Runtime_Options__dryrun:
|
||||
for metadata_style in self.config.Runtime_Options__type:
|
||||
# write out the new data
|
||||
if not ca.write_metadata(md, metadata_style):
|
||||
logger.error("The tag save seemed to fail for style: %s!", MetaDataStyle.name[metadata_style])
|
||||
@ -73,7 +73,7 @@ class CLI:
|
||||
print("Save complete.")
|
||||
logger.info("Save complete.")
|
||||
else:
|
||||
if self.config.Runtime_Options_quiet:
|
||||
if self.config.Runtime_Options__quiet:
|
||||
logger.info("dry-run option was set, so nothing was written")
|
||||
print("dry-run option was set, so nothing was written")
|
||||
else:
|
||||
@ -100,7 +100,7 @@ class CLI:
|
||||
m["issue_title"],
|
||||
)
|
||||
)
|
||||
if self.config.Runtime_Options_interactive:
|
||||
if self.config.Runtime_Options__interactive:
|
||||
while True:
|
||||
i = input("Choose a match #, or 's' to skip: ")
|
||||
if (i.isdigit() and int(i) in range(1, len(match_set.matches) + 1)) or i == "s":
|
||||
@ -111,7 +111,7 @@ class CLI:
|
||||
ca = match_set.ca
|
||||
md = self.create_local_metadata(ca)
|
||||
ct_md = self.actual_issue_data_fetch(match_set.matches[int(i) - 1]["issue_id"])
|
||||
if self.config.Issue_Identifier_clear_metadata_on_import:
|
||||
if self.config.Issue_Identifier__clear_metadata_on_import:
|
||||
md = ct_md
|
||||
else:
|
||||
notes = (
|
||||
@ -120,14 +120,14 @@ class CLI:
|
||||
)
|
||||
md.overlay(ct_md.replace(notes=utils.combine_notes(md.notes, notes, "Tagged with ComicTagger")))
|
||||
|
||||
if self.config.Issue_Identifier_auto_imprint:
|
||||
if self.config.Issue_Identifier__auto_imprint:
|
||||
md.fix_publisher()
|
||||
|
||||
self.actual_metadata_save(ca, md)
|
||||
|
||||
def post_process_matches(self, match_results: OnlineMatchResults) -> None:
|
||||
# now go through the match results
|
||||
if self.config.Runtime_Options_summary:
|
||||
if self.config.Runtime_Options__summary:
|
||||
if len(match_results.good_matches) > 0:
|
||||
print("\nSuccessful matches:\n------------------")
|
||||
for f in match_results.good_matches:
|
||||
@ -148,7 +148,7 @@ class CLI:
|
||||
for f in match_results.fetch_data_failures:
|
||||
print(f)
|
||||
|
||||
if not self.config.Runtime_Options_summary and not self.config.Runtime_Options_interactive:
|
||||
if not self.config.Runtime_Options__summary and not self.config.Runtime_Options__interactive:
|
||||
# just quit if we're not interactive or showing the summary
|
||||
return
|
||||
|
||||
@ -168,20 +168,20 @@ class CLI:
|
||||
self.display_match_set_for_choice(label, match_set)
|
||||
|
||||
def run(self) -> None:
|
||||
if len(self.config.Runtime_Options_files) < 1:
|
||||
if len(self.config.Runtime_Options__files) < 1:
|
||||
logger.error("You must specify at least one filename. Use the -h option for more info")
|
||||
return
|
||||
|
||||
match_results = OnlineMatchResults()
|
||||
self.batch_mode = len(self.config.Runtime_Options_files) > 1
|
||||
self.batch_mode = len(self.config.Runtime_Options__files) > 1
|
||||
|
||||
for f in self.config.Runtime_Options_files:
|
||||
for f in self.config.Runtime_Options__files:
|
||||
self.process_file_cli(f, match_results)
|
||||
sys.stdout.flush()
|
||||
|
||||
self.post_process_matches(match_results)
|
||||
|
||||
if self.config.Runtime_Options_online:
|
||||
if self.config.Runtime_Options__online:
|
||||
print(
|
||||
f"\nFiles tagged with metadata provided by {self.current_talker().name} {self.current_talker().website}"
|
||||
)
|
||||
@ -191,18 +191,18 @@ class CLI:
|
||||
md.set_default_page_list(ca.get_number_of_pages())
|
||||
|
||||
# now, overlay the parsed filename info
|
||||
if self.config.Runtime_Options_parse_filename:
|
||||
if self.config.Runtime_Options__parse_filename:
|
||||
f_md = ca.metadata_from_filename(
|
||||
self.config.Filename_Parsing_complicated_parser,
|
||||
self.config.Filename_Parsing_remove_c2c,
|
||||
self.config.Filename_Parsing_remove_fcbd,
|
||||
self.config.Filename_Parsing_remove_publisher,
|
||||
self.config.Runtime_Options_split_words,
|
||||
self.config.Filename_Parsing__complicated_parser,
|
||||
self.config.Filename_Parsing__remove_c2c,
|
||||
self.config.Filename_Parsing__remove_fcbd,
|
||||
self.config.Filename_Parsing__remove_publisher,
|
||||
self.config.Runtime_Options__split_words,
|
||||
)
|
||||
|
||||
md.overlay(f_md)
|
||||
|
||||
for metadata_style in self.config.Runtime_Options_type:
|
||||
for metadata_style in self.config.Runtime_Options__type:
|
||||
if ca.has_metadata(metadata_style):
|
||||
try:
|
||||
t_md = ca.read_metadata(metadata_style)
|
||||
@ -212,12 +212,12 @@ class CLI:
|
||||
logger.error("Failed to load metadata for %s: %s", ca.path, e)
|
||||
|
||||
# finally, use explicit stuff
|
||||
md.overlay(self.config.Runtime_Options_metadata)
|
||||
md.overlay(self.config.Runtime_Options__metadata)
|
||||
|
||||
return md
|
||||
|
||||
def print(self, ca: ComicArchive) -> None:
|
||||
if not self.config.Runtime_Options_type:
|
||||
if not self.config.Runtime_Options__type:
|
||||
page_count = ca.get_number_of_pages()
|
||||
|
||||
brief = ""
|
||||
@ -247,17 +247,17 @@ class CLI:
|
||||
|
||||
print(brief)
|
||||
|
||||
if self.config.Runtime_Options_quiet:
|
||||
if self.config.Runtime_Options__quiet:
|
||||
return
|
||||
|
||||
print()
|
||||
|
||||
raw: str | bytes = ""
|
||||
if not self.config.Runtime_Options_type or MetaDataStyle.CIX in self.config.Runtime_Options_type:
|
||||
if not self.config.Runtime_Options__type or MetaDataStyle.CIX in self.config.Runtime_Options__type:
|
||||
if ca.has_metadata(MetaDataStyle.CIX):
|
||||
print("--------- ComicRack tags ---------")
|
||||
try:
|
||||
if self.config.Runtime_Options_raw:
|
||||
if self.config.Runtime_Options__raw:
|
||||
raw = ca.read_raw_cix()
|
||||
if isinstance(raw, bytes):
|
||||
raw = raw.decode("utf-8")
|
||||
@ -267,11 +267,11 @@ class CLI:
|
||||
except Exception as e:
|
||||
logger.error("Failed to load metadata for %s: %s", ca.path, e)
|
||||
|
||||
if not self.config.Runtime_Options_type or MetaDataStyle.CBI in self.config.Runtime_Options_type:
|
||||
if not self.config.Runtime_Options__type or MetaDataStyle.CBI in self.config.Runtime_Options__type:
|
||||
if ca.has_metadata(MetaDataStyle.CBI):
|
||||
print("------- ComicBookLover tags -------")
|
||||
try:
|
||||
if self.config.Runtime_Options_raw:
|
||||
if self.config.Runtime_Options__raw:
|
||||
raw = ca.read_raw_cbi()
|
||||
if isinstance(raw, bytes):
|
||||
raw = raw.decode("utf-8")
|
||||
@ -281,11 +281,11 @@ class CLI:
|
||||
except Exception as e:
|
||||
logger.error("Failed to load metadata for %s: %s", ca.path, e)
|
||||
|
||||
if not self.config.Runtime_Options_type or MetaDataStyle.COMET in self.config.Runtime_Options_type:
|
||||
if not self.config.Runtime_Options__type or MetaDataStyle.COMET in self.config.Runtime_Options__type:
|
||||
if ca.has_metadata(MetaDataStyle.COMET):
|
||||
print("----------- CoMet tags -----------")
|
||||
try:
|
||||
if self.config.Runtime_Options_raw:
|
||||
if self.config.Runtime_Options__raw:
|
||||
raw = ca.read_raw_comet()
|
||||
if isinstance(raw, bytes):
|
||||
raw = raw.decode("utf-8")
|
||||
@ -296,10 +296,10 @@ class CLI:
|
||||
logger.error("Failed to load metadata for %s: %s", ca.path, e)
|
||||
|
||||
def delete(self, ca: ComicArchive) -> None:
|
||||
for metadata_style in self.config.Runtime_Options_type:
|
||||
for metadata_style in self.config.Runtime_Options__type:
|
||||
style_name = MetaDataStyle.name[metadata_style]
|
||||
if ca.has_metadata(metadata_style):
|
||||
if not self.config.Runtime_Options_dryrun:
|
||||
if not self.config.Runtime_Options__dryrun:
|
||||
if not ca.remove_metadata(metadata_style):
|
||||
print(f"{ca.path}: Tag removal seemed to fail!")
|
||||
else:
|
||||
@ -310,25 +310,25 @@ class CLI:
|
||||
print(f"{ca.path}: This archive doesn't have {style_name} tags to remove.")
|
||||
|
||||
def copy(self, ca: ComicArchive) -> None:
|
||||
for metadata_style in self.config.Runtime_Options_type:
|
||||
for metadata_style in self.config.Runtime_Options__type:
|
||||
dst_style_name = MetaDataStyle.name[metadata_style]
|
||||
if not self.config.Runtime_Options_overwrite and ca.has_metadata(metadata_style):
|
||||
if not self.config.Runtime_Options__overwrite and ca.has_metadata(metadata_style):
|
||||
print(f"{ca.path}: Already has {dst_style_name} tags. Not overwriting.")
|
||||
return
|
||||
if self.config.Commands_copy == metadata_style:
|
||||
if self.config.Commands__copy == metadata_style:
|
||||
print(f"{ca.path}: Destination and source are same: {dst_style_name}. Nothing to do.")
|
||||
return
|
||||
|
||||
src_style_name = MetaDataStyle.name[self.config.Commands_copy]
|
||||
if ca.has_metadata(self.config.Commands_copy):
|
||||
if not self.config.Runtime_Options_dryrun:
|
||||
src_style_name = MetaDataStyle.name[self.config.Commands__copy]
|
||||
if ca.has_metadata(self.config.Commands__copy):
|
||||
if not self.config.Runtime_Options__dryrun:
|
||||
try:
|
||||
md = ca.read_metadata(self.config.Commands_copy)
|
||||
md = ca.read_metadata(self.config.Commands__copy)
|
||||
except Exception as e:
|
||||
md = GenericMetadata()
|
||||
logger.error("Failed to load metadata for %s: %s", ca.path, e)
|
||||
|
||||
if self.config.Comic_Book_Lover_apply_transform_on_bulk_operation == MetaDataStyle.CBI:
|
||||
if self.config.Comic_Book_Lover__apply_transform_on_bulk_operation == MetaDataStyle.CBI:
|
||||
md = CBLTransformer(md, self.config).apply()
|
||||
|
||||
if not ca.write_metadata(md, metadata_style):
|
||||
@ -341,8 +341,8 @@ class CLI:
|
||||
print(f"{ca.path}: This archive doesn't have {src_style_name} tags to copy.")
|
||||
|
||||
def save(self, ca: ComicArchive, match_results: OnlineMatchResults) -> None:
|
||||
if not self.config.Runtime_Options_overwrite:
|
||||
for metadata_style in self.config.Runtime_Options_type:
|
||||
if not self.config.Runtime_Options__overwrite:
|
||||
for metadata_style in self.config.Runtime_Options__type:
|
||||
if ca.has_metadata(metadata_style):
|
||||
print(f"{ca.path}: Already has {MetaDataStyle.name[metadata_style]} tags. Not overwriting.")
|
||||
return
|
||||
@ -352,26 +352,26 @@ class CLI:
|
||||
|
||||
md = self.create_local_metadata(ca)
|
||||
if md.issue is None or md.issue == "":
|
||||
if self.config.Auto_Tag_assume_1_if_no_issue_num:
|
||||
if self.config.Auto_Tag__assume_1_if_no_issue_num:
|
||||
md.issue = "1"
|
||||
|
||||
# now, search online
|
||||
if self.config.Runtime_Options_online:
|
||||
if self.config.Runtime_Options_issue_id is not None:
|
||||
if self.config.Runtime_Options__online:
|
||||
if self.config.Runtime_Options__issue_id is not None:
|
||||
# we were given the actual issue ID to search with
|
||||
try:
|
||||
ct_md = self.current_talker().fetch_comic_data(self.config.Runtime_Options_issue_id)
|
||||
ct_md = self.current_talker().fetch_comic_data(self.config.Runtime_Options__issue_id)
|
||||
except TalkerError as e:
|
||||
logger.exception(f"Error retrieving issue details. Save aborted.\n{e}")
|
||||
match_results.fetch_data_failures.append(str(ca.path.absolute()))
|
||||
return
|
||||
|
||||
if ct_md is None:
|
||||
logger.error("No match for ID %s was found.", self.config.Runtime_Options_issue_id)
|
||||
logger.error("No match for ID %s was found.", self.config.Runtime_Options__issue_id)
|
||||
match_results.no_matches.append(str(ca.path.absolute()))
|
||||
return
|
||||
|
||||
if self.config.Comic_Book_Lover_apply_transform_on_import:
|
||||
if self.config.Comic_Book_Lover__apply_transform_on_import:
|
||||
ct_md = CBLTransformer(ct_md, self.config).apply()
|
||||
else:
|
||||
if md is None or md.is_empty:
|
||||
@ -382,7 +382,7 @@ class CLI:
|
||||
ii = IssueIdentifier(ca, self.config, self.current_talker())
|
||||
|
||||
def myoutput(text: str) -> None:
|
||||
if self.config.Runtime_Options_verbose:
|
||||
if self.config.Runtime_Options__verbose:
|
||||
IssueIdentifier.default_write_output(text)
|
||||
|
||||
# use our overlaid MD struct to search
|
||||
@ -422,7 +422,7 @@ class CLI:
|
||||
logger.error("Online search: Multiple good matches. Save aborted")
|
||||
match_results.multiple_matches.append(MultipleMatch(ca, matches))
|
||||
return
|
||||
if low_confidence and self.config.Runtime_Options_abort_on_low_confidence:
|
||||
if low_confidence and self.config.Runtime_Options__abort_on_low_confidence:
|
||||
logger.error("Online search: Low confidence match. Save aborted")
|
||||
match_results.low_confidence_matches.append(MultipleMatch(ca, matches))
|
||||
return
|
||||
@ -439,7 +439,7 @@ class CLI:
|
||||
match_results.fetch_data_failures.append(str(ca.path.absolute()))
|
||||
return
|
||||
|
||||
if self.config.Issue_Identifier_clear_metadata_on_import:
|
||||
if self.config.Issue_Identifier__clear_metadata_on_import:
|
||||
md = GenericMetadata()
|
||||
|
||||
notes = (
|
||||
@ -449,11 +449,11 @@ class CLI:
|
||||
md.overlay(
|
||||
ct_md.replace(
|
||||
notes=utils.combine_notes(md.notes, notes, "Tagged with ComicTagger"),
|
||||
description=cleanup_html(ct_md.description, self.config.Sources_remove_html_tables),
|
||||
description=cleanup_html(ct_md.description, self.config.Sources__remove_html_tables),
|
||||
)
|
||||
)
|
||||
|
||||
if self.config.Issue_Identifier_auto_imprint:
|
||||
if self.config.Issue_Identifier__auto_imprint:
|
||||
md.fix_publisher()
|
||||
|
||||
# ok, done building our metadata. time to save
|
||||
@ -475,18 +475,18 @@ class CLI:
|
||||
return
|
||||
|
||||
new_ext = "" # default
|
||||
if self.config.File_Rename_set_extension_based_on_archive:
|
||||
if self.config.File_Rename__set_extension_based_on_archive:
|
||||
new_ext = ca.extension()
|
||||
|
||||
renamer = FileRenamer(
|
||||
md,
|
||||
platform="universal" if self.config.File_Rename_strict else "auto",
|
||||
replacements=self.config.File_Rename_replacements,
|
||||
platform="universal" if self.config.File_Rename__strict else "auto",
|
||||
replacements=self.config.File_Rename__replacements,
|
||||
)
|
||||
renamer.set_template(self.config.File_Rename_template)
|
||||
renamer.set_issue_zero_padding(self.config.File_Rename_issue_number_padding)
|
||||
renamer.set_smart_cleanup(self.config.File_Rename_use_smart_string_cleanup)
|
||||
renamer.move = self.config.File_Rename_move_to_dir
|
||||
renamer.set_template(self.config.File_Rename__template)
|
||||
renamer.set_issue_zero_padding(self.config.File_Rename__issue_number_padding)
|
||||
renamer.set_smart_cleanup(self.config.File_Rename__use_smart_string_cleanup)
|
||||
renamer.move = self.config.File_Rename__move_to_dir
|
||||
|
||||
try:
|
||||
new_name = renamer.determine_name(ext=new_ext)
|
||||
@ -498,14 +498,14 @@ class CLI:
|
||||
"Please consult the template help in the settings "
|
||||
"and the documentation on the format at "
|
||||
"https://docs.python.org/3/library/string.html#format-string-syntax",
|
||||
self.config.File_Rename_template,
|
||||
self.config.File_Rename__template,
|
||||
)
|
||||
return
|
||||
except Exception:
|
||||
logger.exception("Formatter failure: %s metadata: %s", self.config.File_Rename_template, renamer.metadata)
|
||||
logger.exception("Formatter failure: %s metadata: %s", self.config.File_Rename__template, renamer.metadata)
|
||||
return
|
||||
|
||||
folder = get_rename_dir(ca, self.config.File_Rename_dir if self.config.File_Rename_move_to_dir else None)
|
||||
folder = get_rename_dir(ca, self.config.File_Rename__dir if self.config.File_Rename__move_to_dir else None)
|
||||
|
||||
full_path = folder / new_name
|
||||
|
||||
@ -514,7 +514,7 @@ class CLI:
|
||||
return
|
||||
|
||||
suffix = ""
|
||||
if not self.config.Runtime_Options_dryrun:
|
||||
if not self.config.Runtime_Options__dryrun:
|
||||
# rename the file
|
||||
try:
|
||||
ca.rename(utils.unique_file(full_path))
|
||||
@ -537,7 +537,7 @@ class CLI:
|
||||
filename_path = ca.path
|
||||
new_file = filename_path.with_suffix(".cbz")
|
||||
|
||||
if self.config.Runtime_Options_abort_on_conflict and new_file.exists():
|
||||
if self.config.Runtime_Options__abort_on_conflict and new_file.exists():
|
||||
print(msg_hdr + f"{new_file.name} already exists in the that folder.")
|
||||
return
|
||||
|
||||
@ -545,10 +545,10 @@ class CLI:
|
||||
|
||||
delete_success = False
|
||||
export_success = False
|
||||
if not self.config.Runtime_Options_dryrun:
|
||||
if not self.config.Runtime_Options__dryrun:
|
||||
if ca.export_as_zip(new_file):
|
||||
export_success = True
|
||||
if self.config.Runtime_Options_delete_after_zip_export:
|
||||
if self.config.Runtime_Options__delete_after_zip_export:
|
||||
try:
|
||||
filename_path.unlink(missing_ok=True)
|
||||
delete_success = True
|
||||
@ -560,7 +560,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_after_zip_export:
|
||||
msg += " and delete original."
|
||||
print(msg)
|
||||
return
|
||||
@ -568,7 +568,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_after_zip_export and delete_success:
|
||||
msg += " (Original deleted) "
|
||||
else:
|
||||
msg += "Archive failed to export!"
|
||||
@ -587,28 +587,28 @@ class CLI:
|
||||
return
|
||||
|
||||
if not ca.is_writable() and (
|
||||
self.config.Commands_delete
|
||||
or self.config.Commands_copy
|
||||
or self.config.Commands_save
|
||||
or self.config.Commands_rename
|
||||
self.config.Commands__delete
|
||||
or self.config.Commands__copy
|
||||
or self.config.Commands__save
|
||||
or self.config.Commands__rename
|
||||
):
|
||||
logger.error("This archive is not writable")
|
||||
return
|
||||
|
||||
if self.config.Commands_print:
|
||||
if self.config.Commands__print:
|
||||
self.print(ca)
|
||||
|
||||
elif self.config.Commands_delete:
|
||||
elif self.config.Commands__delete:
|
||||
self.delete(ca)
|
||||
|
||||
elif self.config.Commands_copy is not None:
|
||||
elif self.config.Commands__copy is not None:
|
||||
self.copy(ca)
|
||||
|
||||
elif self.config.Commands_save:
|
||||
elif self.config.Commands__save:
|
||||
self.save(ca, match_results)
|
||||
|
||||
elif self.config.Commands_rename:
|
||||
elif self.config.Commands__rename:
|
||||
self.rename(ca)
|
||||
|
||||
elif self.config.Commands_export_to_zip:
|
||||
elif self.config.Commands__export_to_zip:
|
||||
self.export(ca)
|
||||
|
@ -247,55 +247,55 @@ def register_commandline_settings(parser: settngs.Manager) -> None:
|
||||
|
||||
|
||||
def validate_commandline_settings(config: settngs.Config[ct_ns], parser: settngs.Manager) -> settngs.Config[ct_ns]:
|
||||
if config[0].Commands_version:
|
||||
if config[0].Commands__version:
|
||||
parser.exit(
|
||||
status=1,
|
||||
message=f"ComicTagger {ctversion.version}: Copyright (c) 2012-2022 ComicTagger Team\n"
|
||||
"Distributed under Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)\n",
|
||||
)
|
||||
|
||||
config[0].Runtime_Options_no_gui = any(
|
||||
config[0].Runtime_Options__no_gui = any(
|
||||
[
|
||||
config[0].Commands_print,
|
||||
config[0].Commands_delete,
|
||||
config[0].Commands_save,
|
||||
config[0].Commands_copy,
|
||||
config[0].Commands_rename,
|
||||
config[0].Commands_export_to_zip,
|
||||
config[0].Commands_only_save_config,
|
||||
config[0].Commands_list_plugins,
|
||||
config[0].Runtime_Options_no_gui,
|
||||
config[0].Commands__print,
|
||||
config[0].Commands__delete,
|
||||
config[0].Commands__save,
|
||||
config[0].Commands__copy,
|
||||
config[0].Commands__rename,
|
||||
config[0].Commands__export_to_zip,
|
||||
config[0].Commands__only_save_config,
|
||||
config[0].Commands__list_plugins,
|
||||
config[0].Runtime_Options__no_gui,
|
||||
]
|
||||
)
|
||||
|
||||
if platform.system() == "Windows" and config[0].Runtime_Options_glob:
|
||||
if platform.system() == "Windows" and config[0].Runtime_Options__glob:
|
||||
# no globbing on windows shell, so do it for them
|
||||
import glob
|
||||
|
||||
globs = config[0].Runtime_Options_files
|
||||
config[0].Runtime_Options_files = []
|
||||
globs = config[0].Runtime_Options__files
|
||||
config[0].Runtime_Options__files = []
|
||||
for item in globs:
|
||||
config[0].Runtime_Options_files.extend(glob.glob(item))
|
||||
config[0].Runtime_Options__files.extend(glob.glob(item))
|
||||
|
||||
if (
|
||||
not config[0].Commands_only_save_config
|
||||
and config[0].Runtime_Options_no_gui
|
||||
and not config[0].Runtime_Options_files
|
||||
not config[0].Commands__only_save_config
|
||||
and config[0].Runtime_Options__no_gui
|
||||
and not config[0].Runtime_Options__files
|
||||
):
|
||||
parser.exit(message="Command requires at least one filename!\n", status=1)
|
||||
|
||||
if config[0].Commands_delete and not config[0].Runtime_Options_type:
|
||||
if config[0].Commands__delete and not config[0].Runtime_Options__type:
|
||||
parser.exit(message="Please specify the type to delete with -t\n", status=1)
|
||||
|
||||
if config[0].Commands_save and not config[0].Runtime_Options_type:
|
||||
if config[0].Commands__save and not config[0].Runtime_Options__type:
|
||||
parser.exit(message="Please specify the type to save with -t\n", status=1)
|
||||
|
||||
if config[0].Commands_copy:
|
||||
if not config[0].Runtime_Options_type:
|
||||
if config[0].Commands__copy:
|
||||
if not config[0].Runtime_Options__type:
|
||||
parser.exit(message="Please specify the type to copy to with -t\n", status=1)
|
||||
|
||||
if config[0].Runtime_Options_recursive:
|
||||
config[0].Runtime_Options_files = utils.get_recursive_filelist(config[0].Runtime_Options_files)
|
||||
if config[0].Runtime_Options__recursive:
|
||||
config[0].Runtime_Options__files = utils.get_recursive_filelist(config[0].Runtime_Options__files)
|
||||
|
||||
# take a crack at finding rar exe if it's not in the path
|
||||
if not utils.which("rar"):
|
||||
|
@ -235,7 +235,7 @@ def autotag(parser: settngs.Manager) -> None:
|
||||
def parse_filter(config: settngs.Config[ct_ns]) -> settngs.Config[ct_ns]:
|
||||
new_filter = []
|
||||
remove = []
|
||||
for x in config[0].Issue_Identifier_publisher_filter:
|
||||
for x in config[0].Issue_Identifier__publisher_filter:
|
||||
x = x.strip()
|
||||
if x: # ignore empty arguments
|
||||
if x[-1] == "-": # this publisher needs to be removed. We remove after all publishers have been enumerated
|
||||
@ -246,18 +246,18 @@ def parse_filter(config: settngs.Config[ct_ns]) -> settngs.Config[ct_ns]:
|
||||
for x in remove: # remove publishers
|
||||
if x in new_filter:
|
||||
new_filter.remove(x)
|
||||
config[0].Issue_Identifier_publisher_filter = new_filter
|
||||
config[0].Issue_Identifier__publisher_filter = new_filter
|
||||
return config
|
||||
|
||||
|
||||
def validate_file_settings(config: settngs.Config[ct_ns]) -> settngs.Config[ct_ns]:
|
||||
config = parse_filter(config)
|
||||
if config[0].Filename_Parsing_protofolius_issue_number_scheme:
|
||||
config[0].Filename_Parsing_allow_issue_start_with_letter = True
|
||||
if config[0].Filename_Parsing__protofolius_issue_number_scheme:
|
||||
config[0].Filename_Parsing__allow_issue_start_with_letter = True
|
||||
|
||||
config[0].File_Rename_replacements = Replacements(
|
||||
[Replacement(x[0], x[1], x[2]) for x in config[0].File_Rename_replacements[0]],
|
||||
[Replacement(x[0], x[1], x[2]) for x in config[0].File_Rename_replacements[1]],
|
||||
config[0].File_Rename__replacements = Replacements(
|
||||
[Replacement(x[0], x[1], x[2]) for x in config[0].File_Rename__replacements[0]],
|
||||
[Replacement(x[0], x[1], x[2]) for x in config[0].File_Rename__replacements[1]],
|
||||
)
|
||||
return config
|
||||
|
||||
|
@ -8,104 +8,104 @@ import comictaggerlib.defaults
|
||||
|
||||
|
||||
class settngs_namespace(settngs.TypedNS):
|
||||
Commands_version: bool
|
||||
Commands_print: bool
|
||||
Commands_delete: bool
|
||||
Commands_copy: int
|
||||
Commands_save: bool
|
||||
Commands_rename: bool
|
||||
Commands_export_to_zip: bool
|
||||
Commands_only_save_config: bool
|
||||
Commands_list_plugins: bool
|
||||
Commands__version: bool
|
||||
Commands__print: bool
|
||||
Commands__delete: bool
|
||||
Commands__copy: int
|
||||
Commands__save: bool
|
||||
Commands__rename: bool
|
||||
Commands__export_to_zip: bool
|
||||
Commands__only_save_config: bool
|
||||
Commands__list_plugins: bool
|
||||
|
||||
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_parse_filename: bool
|
||||
Runtime_Options_issue_id: str
|
||||
Runtime_Options_online: bool
|
||||
Runtime_Options_metadata: comicapi.genericmetadata.GenericMetadata
|
||||
Runtime_Options_interactive: bool
|
||||
Runtime_Options_abort_on_low_confidence: bool
|
||||
Runtime_Options_summary: bool
|
||||
Runtime_Options_raw: bool
|
||||
Runtime_Options_recursive: bool
|
||||
Runtime_Options_split_words: bool
|
||||
Runtime_Options_dryrun: bool
|
||||
Runtime_Options_darkmode: bool
|
||||
Runtime_Options_glob: bool
|
||||
Runtime_Options_quiet: bool
|
||||
Runtime_Options_type: list[int]
|
||||
Runtime_Options_overwrite: bool
|
||||
Runtime_Options_no_gui: bool
|
||||
Runtime_Options_files: list[str]
|
||||
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__parse_filename: bool
|
||||
Runtime_Options__issue_id: str
|
||||
Runtime_Options__online: bool
|
||||
Runtime_Options__metadata: comicapi.genericmetadata.GenericMetadata
|
||||
Runtime_Options__interactive: bool
|
||||
Runtime_Options__abort_on_low_confidence: bool
|
||||
Runtime_Options__summary: bool
|
||||
Runtime_Options__raw: bool
|
||||
Runtime_Options__recursive: bool
|
||||
Runtime_Options__split_words: bool
|
||||
Runtime_Options__dryrun: bool
|
||||
Runtime_Options__darkmode: bool
|
||||
Runtime_Options__glob: bool
|
||||
Runtime_Options__quiet: bool
|
||||
Runtime_Options__type: list[int]
|
||||
Runtime_Options__overwrite: bool
|
||||
Runtime_Options__no_gui: bool
|
||||
Runtime_Options__files: list[str]
|
||||
|
||||
internal_install_id: str
|
||||
internal_save_data_style: int
|
||||
internal_load_data_style: int
|
||||
internal_last_opened_folder: str
|
||||
internal_window_width: int
|
||||
internal_window_height: int
|
||||
internal_window_x: int
|
||||
internal_window_y: int
|
||||
internal_form_width: int
|
||||
internal_list_width: int
|
||||
internal_sort_column: int
|
||||
internal_sort_direction: int
|
||||
internal__install_id: str
|
||||
internal__save_data_style: int
|
||||
internal__load_data_style: int
|
||||
internal__last_opened_folder: str
|
||||
internal__window_width: int
|
||||
internal__window_height: int
|
||||
internal__window_x: int
|
||||
internal__window_y: int
|
||||
internal__form_width: int
|
||||
internal__list_width: int
|
||||
internal__sort_column: int
|
||||
internal__sort_direction: int
|
||||
|
||||
Issue_Identifier_series_match_identify_thresh: int
|
||||
Issue_Identifier_border_crop_percent: int
|
||||
Issue_Identifier_publisher_filter: list[str]
|
||||
Issue_Identifier_series_match_search_thresh: int
|
||||
Issue_Identifier_clear_metadata_on_import: bool
|
||||
Issue_Identifier_auto_imprint: bool
|
||||
Issue_Identifier_sort_series_by_year: bool
|
||||
Issue_Identifier_exact_series_matches_first: bool
|
||||
Issue_Identifier_always_use_publisher_filter: bool
|
||||
Issue_Identifier_clear_form_before_populating: bool
|
||||
Issue_Identifier__series_match_identify_thresh: int
|
||||
Issue_Identifier__border_crop_percent: int
|
||||
Issue_Identifier__publisher_filter: list[str]
|
||||
Issue_Identifier__series_match_search_thresh: int
|
||||
Issue_Identifier__clear_metadata_on_import: bool
|
||||
Issue_Identifier__auto_imprint: bool
|
||||
Issue_Identifier__sort_series_by_year: bool
|
||||
Issue_Identifier__exact_series_matches_first: bool
|
||||
Issue_Identifier__always_use_publisher_filter: bool
|
||||
Issue_Identifier__clear_form_before_populating: bool
|
||||
|
||||
Filename_Parsing_complicated_parser: bool
|
||||
Filename_Parsing_remove_c2c: bool
|
||||
Filename_Parsing_remove_fcbd: bool
|
||||
Filename_Parsing_remove_publisher: bool
|
||||
Filename_Parsing_protofolius_issue_number_scheme: bool
|
||||
Filename_Parsing_allow_issue_start_with_letter: bool
|
||||
Filename_Parsing__complicated_parser: bool
|
||||
Filename_Parsing__remove_c2c: bool
|
||||
Filename_Parsing__remove_fcbd: bool
|
||||
Filename_Parsing__remove_publisher: bool
|
||||
Filename_Parsing__protofolius_issue_number_scheme: bool
|
||||
Filename_Parsing__allow_issue_start_with_letter: bool
|
||||
|
||||
Sources_source: str
|
||||
Sources_remove_html_tables: bool
|
||||
Sources__source: str
|
||||
Sources__remove_html_tables: bool
|
||||
|
||||
Comic_Book_Lover_assume_lone_credit_is_primary: bool
|
||||
Comic_Book_Lover_copy_characters_to_tags: bool
|
||||
Comic_Book_Lover_copy_teams_to_tags: bool
|
||||
Comic_Book_Lover_copy_locations_to_tags: bool
|
||||
Comic_Book_Lover_copy_storyarcs_to_tags: bool
|
||||
Comic_Book_Lover_copy_notes_to_comments: bool
|
||||
Comic_Book_Lover_copy_weblink_to_comments: bool
|
||||
Comic_Book_Lover_apply_transform_on_import: bool
|
||||
Comic_Book_Lover_apply_transform_on_bulk_operation: bool
|
||||
Comic_Book_Lover__assume_lone_credit_is_primary: bool
|
||||
Comic_Book_Lover__copy_characters_to_tags: bool
|
||||
Comic_Book_Lover__copy_teams_to_tags: bool
|
||||
Comic_Book_Lover__copy_locations_to_tags: bool
|
||||
Comic_Book_Lover__copy_storyarcs_to_tags: bool
|
||||
Comic_Book_Lover__copy_notes_to_comments: bool
|
||||
Comic_Book_Lover__copy_weblink_to_comments: bool
|
||||
Comic_Book_Lover__apply_transform_on_import: bool
|
||||
Comic_Book_Lover__apply_transform_on_bulk_operation: bool
|
||||
|
||||
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_dir: str
|
||||
File_Rename_move_to_dir: bool
|
||||
File_Rename_strict: bool
|
||||
File_Rename_replacements: comictaggerlib.defaults.Replacements
|
||||
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__dir: str
|
||||
File_Rename__move_to_dir: bool
|
||||
File_Rename__strict: bool
|
||||
File_Rename__replacements: comictaggerlib.defaults.Replacements
|
||||
|
||||
Auto_Tag_save_on_low_confidence: bool
|
||||
Auto_Tag_dont_use_year_when_identifying: bool
|
||||
Auto_Tag_assume_1_if_no_issue_num: bool
|
||||
Auto_Tag_ignore_leading_numbers_in_filename: bool
|
||||
Auto_Tag_remove_archive_after_successful_match: bool
|
||||
Auto_Tag__save_on_low_confidence: bool
|
||||
Auto_Tag__dont_use_year_when_identifying: bool
|
||||
Auto_Tag__assume_1_if_no_issue_num: bool
|
||||
Auto_Tag__ignore_leading_numbers_in_filename: bool
|
||||
Auto_Tag__remove_archive_after_successful_match: bool
|
||||
|
||||
General_check_for_new_version: bool
|
||||
General__check_for_new_version: bool
|
||||
|
||||
Dialog_Flags_show_disclaimer: bool
|
||||
Dialog_Flags_dont_notify_about_this_version: str
|
||||
Dialog_Flags_ask_about_usage_stats: bool
|
||||
Dialog_Flags__show_disclaimer: bool
|
||||
Dialog_Flags__dont_notify_about_this_version: str
|
||||
Dialog_Flags__ask_about_usage_stats: bool
|
||||
|
||||
Source_comicvine_comicvine_key: str
|
||||
Source_comicvine_comicvine_url: str
|
||||
Source_comicvine_cv_use_series_start_as_volume: bool
|
||||
Source_comicvine__comicvine_key: str
|
||||
Source_comicvine__comicvine_url: str
|
||||
Source_comicvine__cv_use_series_start_as_volume: bool
|
||||
|
@ -97,7 +97,7 @@ def open_tagger_window(
|
||||
) -> None:
|
||||
os.environ["QtWidgets.QT_AUTO_SCREEN_SCALE_FACTOR"] = "1"
|
||||
args = [sys.argv[0]]
|
||||
if config[0].Runtime_Options_darkmode:
|
||||
if config[0].Runtime_Options__darkmode:
|
||||
args.extend(["-platform", "windows:darkmode=2"])
|
||||
app = Application(args)
|
||||
if error is not None:
|
||||
@ -106,7 +106,7 @@ def open_tagger_window(
|
||||
raise SystemExit(1)
|
||||
|
||||
# needed to catch initial open file events (macOS)
|
||||
app.openFileRequest.connect(lambda x: config[0].Runtime_Options_files.append(x.toLocalFile()))
|
||||
app.openFileRequest.connect(lambda x: config[0].Runtime_Options__files.append(x.toLocalFile()))
|
||||
|
||||
if platform.system() == "Darwin":
|
||||
# Set the MacOS dock icon
|
||||
@ -134,7 +134,7 @@ def open_tagger_window(
|
||||
QtWidgets.QApplication.processEvents()
|
||||
|
||||
try:
|
||||
tagger_window = TaggerWindow(config[0].Runtime_Options_files, config, talkers)
|
||||
tagger_window = TaggerWindow(config[0].Runtime_Options__files, config, talkers)
|
||||
tagger_window.setWindowIcon(QtGui.QIcon(str(graphics_path / "app.png")))
|
||||
tagger_window.show()
|
||||
|
||||
|
@ -96,10 +96,10 @@ class IssueIdentifier:
|
||||
|
||||
# used to eliminate series names that are too long based on our search
|
||||
# string
|
||||
self.series_match_thresh = config.Issue_Identifier_series_match_identify_thresh
|
||||
self.series_match_thresh = config.Issue_Identifier__series_match_identify_thresh
|
||||
|
||||
# used to eliminate unlikely publishers
|
||||
self.publisher_filter = [s.strip().casefold() for s in config.Issue_Identifier_publisher_filter]
|
||||
self.publisher_filter = [s.strip().casefold() for s in config.Issue_Identifier__publisher_filter]
|
||||
|
||||
self.additional_metadata = GenericMetadata()
|
||||
self.output_function: Callable[[str], None] = IssueIdentifier.default_write_output
|
||||
@ -239,10 +239,10 @@ class IssueIdentifier:
|
||||
|
||||
# try to get some metadata from filename
|
||||
md_from_filename = ca.metadata_from_filename(
|
||||
self.config.Filename_Parsing_complicated_parser,
|
||||
self.config.Filename_Parsing_remove_c2c,
|
||||
self.config.Filename_Parsing_remove_fcbd,
|
||||
self.config.Filename_Parsing_remove_publisher,
|
||||
self.config.Filename_Parsing__complicated_parser,
|
||||
self.config.Filename_Parsing__remove_c2c,
|
||||
self.config.Filename_Parsing__remove_fcbd,
|
||||
self.config.Filename_Parsing__remove_publisher,
|
||||
)
|
||||
|
||||
working_md = md_from_filename.copy()
|
||||
@ -291,7 +291,7 @@ class IssueIdentifier:
|
||||
return Score(score=100, url="", hash=0)
|
||||
|
||||
try:
|
||||
url_image_data = ImageFetcher(self.config.Runtime_Options_config.user_cache_dir).fetch(
|
||||
url_image_data = ImageFetcher(self.config.Runtime_Options__config.user_cache_dir).fetch(
|
||||
primary_img_url, blocking=True
|
||||
)
|
||||
except ImageFetcherException as e:
|
||||
@ -313,7 +313,7 @@ class IssueIdentifier:
|
||||
if use_remote_alternates:
|
||||
for alt_url in alt_urls:
|
||||
try:
|
||||
alt_url_image_data = ImageFetcher(self.config.Runtime_Options_config.user_cache_dir).fetch(
|
||||
alt_url_image_data = ImageFetcher(self.config.Runtime_Options__config.user_cache_dir).fetch(
|
||||
alt_url, blocking=True
|
||||
)
|
||||
except ImageFetcherException as e:
|
||||
@ -499,7 +499,7 @@ class IssueIdentifier:
|
||||
if narrow_cover_hash is not None:
|
||||
hash_list.append(narrow_cover_hash)
|
||||
|
||||
cropped_border = self.crop_border(cover_image_data, self.config.Issue_Identifier_border_crop_percent)
|
||||
cropped_border = self.crop_border(cover_image_data, self.config.Issue_Identifier__border_crop_percent)
|
||||
if cropped_border is not None:
|
||||
hash_list.append(self.calculate_hash(cropped_border))
|
||||
logger.info("Adding cropped cover to the hashlist")
|
||||
|
@ -54,7 +54,7 @@ class IssueSelectionWindow(QtWidgets.QDialog):
|
||||
self.coverWidget = CoverImageWidget(
|
||||
self.coverImageContainer,
|
||||
CoverImageWidget.AltCoverMode,
|
||||
config.Runtime_Options_config.user_cache_dir,
|
||||
config.Runtime_Options__config.user_cache_dir,
|
||||
talker,
|
||||
)
|
||||
gridlayout = QtWidgets.QGridLayout(self.coverImageContainer)
|
||||
@ -98,7 +98,7 @@ class IssueSelectionWindow(QtWidgets.QDialog):
|
||||
self.imageIssuesSourceWidget = CoverImageWidget(
|
||||
self.imageIssuesSourceLogo,
|
||||
CoverImageWidget.URLMode,
|
||||
config.Runtime_Options_config.user_cache_dir,
|
||||
config.Runtime_Options__config.user_cache_dir,
|
||||
talker,
|
||||
False,
|
||||
)
|
||||
|
@ -91,7 +91,7 @@ def configure_locale() -> None:
|
||||
|
||||
|
||||
def update_publishers(config: settngs.Config[ct_ns]) -> None:
|
||||
json_file = config[0].Runtime_Options_config.user_config_dir / "publishers.json"
|
||||
json_file = config[0].Runtime_Options__config.user_config_dir / "publishers.json"
|
||||
if json_file.exists():
|
||||
try:
|
||||
comicapi.utils.update_publishers(json.loads(json_file.read_text("utf-8")))
|
||||
@ -154,7 +154,7 @@ class App:
|
||||
config_paths.user_config_dir / "settings.json", list(args) or None
|
||||
)
|
||||
config = cast(settngs.Config[ct_ns], self.manager.get_namespace(cfg, file=True, cmdline=True))
|
||||
config[0].Runtime_Options_config = config_paths
|
||||
config[0].Runtime_Options__config = config_paths
|
||||
|
||||
config = ctsettings.validate_commandline_settings(config, self.manager)
|
||||
config = ctsettings.validate_file_settings(config)
|
||||
@ -184,7 +184,7 @@ class App:
|
||||
if len(talkers) < 1:
|
||||
error = error = (
|
||||
"Failed to load any talkers, please re-install and check the log located in '"
|
||||
+ str(self.config[0].Runtime_Options_config.user_log_dir)
|
||||
+ str(self.config[0].Runtime_Options__config.user_log_dir)
|
||||
+ "' for more details",
|
||||
True,
|
||||
)
|
||||
@ -198,13 +198,13 @@ class App:
|
||||
comicapi.utils.load_publishers()
|
||||
update_publishers(self.config)
|
||||
|
||||
if self.config[0].Commands_list_plugins:
|
||||
if self.config[0].Commands__list_plugins:
|
||||
self.list_plugins(list(talkers.values()), comicapi.comicarchive.archivers)
|
||||
return
|
||||
|
||||
if self.config[0].Commands_only_save_config:
|
||||
if self.config[0].Commands__only_save_config:
|
||||
if self.config_load_success:
|
||||
settings_path = self.config[0].Runtime_Options_config.user_config_dir / "settings.json"
|
||||
settings_path = self.config[0].Runtime_Options__config.user_config_dir / "settings.json"
|
||||
if self.config_load_success:
|
||||
self.manager.save_file(self.config[0], settings_path)
|
||||
print("Key set") # noqa: T201
|
||||
@ -213,12 +213,12 @@ class App:
|
||||
if not self.config_load_success:
|
||||
error = (
|
||||
"Failed to load settings, check the log located in '"
|
||||
+ str(self.config[0].Runtime_Options_config.user_log_dir)
|
||||
+ str(self.config[0].Runtime_Options__config.user_log_dir)
|
||||
+ "' for more details",
|
||||
True,
|
||||
)
|
||||
|
||||
if not self.config[0].Runtime_Options_no_gui:
|
||||
if not self.config[0].Runtime_Options__no_gui:
|
||||
try:
|
||||
from comictaggerlib import gui
|
||||
|
||||
@ -226,7 +226,7 @@ class App:
|
||||
raise gui.import_error
|
||||
return gui.open_tagger_window(talkers, self.config, error)
|
||||
except ImportError:
|
||||
self.config[0].Runtime_Options_no_gui = True
|
||||
self.config[0].Runtime_Options__no_gui = True
|
||||
logger.warning("PyQt5 is not available. ComicTagger is limited to command-line mode.")
|
||||
|
||||
# GUI mode is not available or CLI mode was requested
|
||||
|
@ -45,7 +45,7 @@ class MatchSelectionWindow(QtWidgets.QDialog):
|
||||
uic.loadUi(ui_path / "matchselectionwindow.ui", self)
|
||||
|
||||
self.altCoverWidget = CoverImageWidget(
|
||||
self.altCoverContainer, CoverImageWidget.AltCoverMode, config.Runtime_Options_config.user_cache_dir, talker
|
||||
self.altCoverContainer, CoverImageWidget.AltCoverMode, config.Runtime_Options__config.user_cache_dir, talker
|
||||
)
|
||||
gridlayout = QtWidgets.QGridLayout(self.altCoverContainer)
|
||||
gridlayout.addWidget(self.altCoverWidget)
|
||||
|
@ -62,32 +62,32 @@ class RenameWindow(QtWidgets.QDialog):
|
||||
self.rename_list: list[str] = []
|
||||
|
||||
self.btnSettings.clicked.connect(self.modify_settings)
|
||||
platform = "universal" if self.config[0].File_Rename_strict else "auto"
|
||||
self.renamer = FileRenamer(None, platform=platform, replacements=self.config[0].File_Rename_replacements)
|
||||
platform = "universal" if self.config[0].File_Rename__strict else "auto"
|
||||
self.renamer = FileRenamer(None, platform=platform, replacements=self.config[0].File_Rename__replacements)
|
||||
|
||||
self.do_preview()
|
||||
|
||||
def config_renamer(self, ca: ComicArchive, md: GenericMetadata | None = None) -> str:
|
||||
self.renamer.set_template(self.config[0].File_Rename_template)
|
||||
self.renamer.set_issue_zero_padding(self.config[0].File_Rename_issue_number_padding)
|
||||
self.renamer.set_smart_cleanup(self.config[0].File_Rename_use_smart_string_cleanup)
|
||||
self.renamer.replacements = self.config[0].File_Rename_replacements
|
||||
self.renamer.set_template(self.config[0].File_Rename__template)
|
||||
self.renamer.set_issue_zero_padding(self.config[0].File_Rename__issue_number_padding)
|
||||
self.renamer.set_smart_cleanup(self.config[0].File_Rename__use_smart_string_cleanup)
|
||||
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__set_extension_based_on_archive:
|
||||
new_ext = ca.extension()
|
||||
|
||||
if md is None:
|
||||
md = ca.read_metadata(self.data_style)
|
||||
if md.is_empty:
|
||||
md = ca.metadata_from_filename(
|
||||
self.config[0].Filename_Parsing_complicated_parser,
|
||||
self.config[0].Filename_Parsing_remove_c2c,
|
||||
self.config[0].Filename_Parsing_remove_fcbd,
|
||||
self.config[0].Filename_Parsing_remove_publisher,
|
||||
self.config[0].Filename_Parsing__complicated_parser,
|
||||
self.config[0].Filename_Parsing__remove_c2c,
|
||||
self.config[0].Filename_Parsing__remove_fcbd,
|
||||
self.config[0].Filename_Parsing__remove_publisher,
|
||||
)
|
||||
self.renamer.set_metadata(md)
|
||||
self.renamer.move = self.config[0].File_Rename_move_to_dir
|
||||
self.renamer.move = self.config[0].File_Rename__move_to_dir
|
||||
return new_ext
|
||||
|
||||
def do_preview(self) -> None:
|
||||
@ -100,7 +100,7 @@ class RenameWindow(QtWidgets.QDialog):
|
||||
try:
|
||||
new_name = self.renamer.determine_name(new_ext)
|
||||
except ValueError as e:
|
||||
logger.exception("Invalid format string: %s", self.config[0].File_Rename_template)
|
||||
logger.exception("Invalid format string: %s", self.config[0].File_Rename__template)
|
||||
QtWidgets.QMessageBox.critical(
|
||||
self,
|
||||
"Invalid format string!",
|
||||
@ -114,7 +114,7 @@ class RenameWindow(QtWidgets.QDialog):
|
||||
return
|
||||
except Exception as e:
|
||||
logger.exception(
|
||||
"Formatter failure: %s metadata: %s", self.config[0].File_Rename_template, self.renamer.metadata
|
||||
"Formatter failure: %s metadata: %s", self.config[0].File_Rename__template, self.renamer.metadata
|
||||
)
|
||||
QtWidgets.QMessageBox.critical(
|
||||
self,
|
||||
@ -189,7 +189,7 @@ class RenameWindow(QtWidgets.QDialog):
|
||||
|
||||
folder = get_rename_dir(
|
||||
comic[0],
|
||||
self.config[0].File_Rename_dir if self.config[0].File_Rename_move_to_dir else None,
|
||||
self.config[0].File_Rename__dir if self.config[0].File_Rename__move_to_dir else None,
|
||||
)
|
||||
|
||||
full_path = folder / comic[1]
|
||||
|
@ -116,7 +116,7 @@ class SeriesSelectionWindow(QtWidgets.QDialog):
|
||||
uic.loadUi(ui_path / "seriesselectionwindow.ui", self)
|
||||
|
||||
self.imageWidget = CoverImageWidget(
|
||||
self.imageContainer, CoverImageWidget.URLMode, config.Runtime_Options_config.user_cache_dir, talker
|
||||
self.imageContainer, CoverImageWidget.URLMode, config.Runtime_Options__config.user_cache_dir, talker
|
||||
)
|
||||
gridlayout = QtWidgets.QGridLayout(self.imageContainer)
|
||||
gridlayout.addWidget(self.imageWidget)
|
||||
@ -161,7 +161,7 @@ class SeriesSelectionWindow(QtWidgets.QDialog):
|
||||
self.progdialog: QtWidgets.QProgressDialog | None = None
|
||||
self.search_thread: SearchThread | None = None
|
||||
|
||||
self.use_filter = self.config.Issue_Identifier_always_use_publisher_filter
|
||||
self.use_filter = self.config.Issue_Identifier__always_use_publisher_filter
|
||||
|
||||
# Load to retrieve settings
|
||||
self.talker = talker
|
||||
@ -172,7 +172,7 @@ class SeriesSelectionWindow(QtWidgets.QDialog):
|
||||
self.imageSourceWidget = CoverImageWidget(
|
||||
self.imageSourceLogo,
|
||||
CoverImageWidget.URLMode,
|
||||
config.Runtime_Options_config.user_cache_dir,
|
||||
config.Runtime_Options__config.user_cache_dir,
|
||||
talker,
|
||||
False,
|
||||
)
|
||||
@ -360,7 +360,7 @@ class SeriesSelectionWindow(QtWidgets.QDialog):
|
||||
self.series_name,
|
||||
refresh,
|
||||
self.literal,
|
||||
self.config.Issue_Identifier_series_match_search_thresh,
|
||||
self.config.Issue_Identifier__series_match_search_thresh,
|
||||
)
|
||||
self.search_thread.searchComplete.connect(self.search_complete)
|
||||
self.search_thread.progressUpdate.connect(self.search_progress_update)
|
||||
@ -413,7 +413,7 @@ class SeriesSelectionWindow(QtWidgets.QDialog):
|
||||
# filter the publishers if enabled set
|
||||
if self.use_filter:
|
||||
try:
|
||||
publisher_filter = {s.strip().casefold() for s in self.config.Issue_Identifier_publisher_filter}
|
||||
publisher_filter = {s.strip().casefold() for s in self.config.Issue_Identifier__publisher_filter}
|
||||
# use '' as publisher name if None
|
||||
self.series_list = dict(
|
||||
filter(
|
||||
@ -429,7 +429,7 @@ class SeriesSelectionWindow(QtWidgets.QDialog):
|
||||
# compare as str in case extra chars ie. '1976?'
|
||||
# - missing (none) values being converted to 'None' - consistent with prior behaviour in v1.2.3
|
||||
# sort by start_year if set
|
||||
if self.config.Issue_Identifier_sort_series_by_year:
|
||||
if self.config.Issue_Identifier__sort_series_by_year:
|
||||
try:
|
||||
self.series_list = dict(
|
||||
natsort.natsorted(
|
||||
@ -449,7 +449,7 @@ class SeriesSelectionWindow(QtWidgets.QDialog):
|
||||
logger.exception("bad data error sorting results by count_of_issues")
|
||||
|
||||
# move sanitized matches to the front
|
||||
if self.config.Issue_Identifier_exact_series_matches_first:
|
||||
if self.config.Issue_Identifier__exact_series_matches_first:
|
||||
try:
|
||||
sanitized = utils.sanitize_title(self.series_name, False).casefold()
|
||||
sanitized_no_articles = utils.sanitize_title(self.series_name, True).casefold()
|
||||
|
@ -371,48 +371,50 @@ class SettingsWindow(QtWidgets.QDialog):
|
||||
self.leRarExePath.setText(getattr(self.config[0], self.config[1]["archiver"].v["rar"].internal_name))
|
||||
else:
|
||||
self.leRarExePath.setEnabled(False)
|
||||
self.sbNameMatchIdentifyThresh.setValue(self.config[0].Issue_Identifier_series_match_identify_thresh)
|
||||
self.sbNameMatchSearchThresh.setValue(self.config[0].Issue_Identifier_series_match_search_thresh)
|
||||
self.tePublisherFilter.setPlainText("\n".join(self.config[0].Issue_Identifier_publisher_filter))
|
||||
self.sbNameMatchIdentifyThresh.setValue(self.config[0].Issue_Identifier__series_match_identify_thresh)
|
||||
self.sbNameMatchSearchThresh.setValue(self.config[0].Issue_Identifier__series_match_search_thresh)
|
||||
self.tePublisherFilter.setPlainText("\n".join(self.config[0].Issue_Identifier__publisher_filter))
|
||||
|
||||
self.cbxCheckForNewVersion.setChecked(self.config[0].General_check_for_new_version)
|
||||
self.cbxCheckForNewVersion.setChecked(self.config[0].General__check_for_new_version)
|
||||
|
||||
self.cbxComplicatedParser.setChecked(self.config[0].Filename_Parsing_complicated_parser)
|
||||
self.cbxRemoveC2C.setChecked(self.config[0].Filename_Parsing_remove_c2c)
|
||||
self.cbxRemoveFCBD.setChecked(self.config[0].Filename_Parsing_remove_fcbd)
|
||||
self.cbxRemovePublisher.setChecked(self.config[0].Filename_Parsing_remove_publisher)
|
||||
self.cbxProtofoliusIssueNumberScheme.setChecked(self.config[0].Filename_Parsing_protofolius_issue_number_scheme)
|
||||
self.cbxAllowIssueStartWithLetter.setChecked(self.config[0].Filename_Parsing_allow_issue_start_with_letter)
|
||||
self.cbxComplicatedParser.setChecked(self.config[0].Filename_Parsing__complicated_parser)
|
||||
self.cbxRemoveC2C.setChecked(self.config[0].Filename_Parsing__remove_c2c)
|
||||
self.cbxRemoveFCBD.setChecked(self.config[0].Filename_Parsing__remove_fcbd)
|
||||
self.cbxRemovePublisher.setChecked(self.config[0].Filename_Parsing__remove_publisher)
|
||||
self.cbxProtofoliusIssueNumberScheme.setChecked(
|
||||
self.config[0].Filename_Parsing__protofolius_issue_number_scheme
|
||||
)
|
||||
self.cbxAllowIssueStartWithLetter.setChecked(self.config[0].Filename_Parsing__allow_issue_start_with_letter)
|
||||
|
||||
self.switch_parser()
|
||||
|
||||
self.cbxClearFormBeforePopulating.setChecked(self.config[0].Issue_Identifier_clear_form_before_populating)
|
||||
self.cbxUseFilter.setChecked(self.config[0].Issue_Identifier_always_use_publisher_filter)
|
||||
self.cbxSortByYear.setChecked(self.config[0].Issue_Identifier_sort_series_by_year)
|
||||
self.cbxExactMatches.setChecked(self.config[0].Issue_Identifier_exact_series_matches_first)
|
||||
self.cbxClearFormBeforePopulating.setChecked(self.config[0].Issue_Identifier__clear_form_before_populating)
|
||||
self.cbxUseFilter.setChecked(self.config[0].Issue_Identifier__always_use_publisher_filter)
|
||||
self.cbxSortByYear.setChecked(self.config[0].Issue_Identifier__sort_series_by_year)
|
||||
self.cbxExactMatches.setChecked(self.config[0].Issue_Identifier__exact_series_matches_first)
|
||||
|
||||
self.cbxAssumeLoneCreditIsPrimary.setChecked(self.config[0].Comic_Book_Lover_assume_lone_credit_is_primary)
|
||||
self.cbxCopyCharactersToTags.setChecked(self.config[0].Comic_Book_Lover_copy_characters_to_tags)
|
||||
self.cbxCopyTeamsToTags.setChecked(self.config[0].Comic_Book_Lover_copy_teams_to_tags)
|
||||
self.cbxCopyLocationsToTags.setChecked(self.config[0].Comic_Book_Lover_copy_locations_to_tags)
|
||||
self.cbxCopyStoryArcsToTags.setChecked(self.config[0].Comic_Book_Lover_copy_storyarcs_to_tags)
|
||||
self.cbxCopyNotesToComments.setChecked(self.config[0].Comic_Book_Lover_copy_notes_to_comments)
|
||||
self.cbxCopyWebLinkToComments.setChecked(self.config[0].Comic_Book_Lover_copy_weblink_to_comments)
|
||||
self.cbxApplyCBLTransformOnCVIMport.setChecked(self.config[0].Comic_Book_Lover_apply_transform_on_import)
|
||||
self.cbxAssumeLoneCreditIsPrimary.setChecked(self.config[0].Comic_Book_Lover__assume_lone_credit_is_primary)
|
||||
self.cbxCopyCharactersToTags.setChecked(self.config[0].Comic_Book_Lover__copy_characters_to_tags)
|
||||
self.cbxCopyTeamsToTags.setChecked(self.config[0].Comic_Book_Lover__copy_teams_to_tags)
|
||||
self.cbxCopyLocationsToTags.setChecked(self.config[0].Comic_Book_Lover__copy_locations_to_tags)
|
||||
self.cbxCopyStoryArcsToTags.setChecked(self.config[0].Comic_Book_Lover__copy_storyarcs_to_tags)
|
||||
self.cbxCopyNotesToComments.setChecked(self.config[0].Comic_Book_Lover__copy_notes_to_comments)
|
||||
self.cbxCopyWebLinkToComments.setChecked(self.config[0].Comic_Book_Lover__copy_weblink_to_comments)
|
||||
self.cbxApplyCBLTransformOnCVIMport.setChecked(self.config[0].Comic_Book_Lover__apply_transform_on_import)
|
||||
self.cbxApplyCBLTransformOnBatchOperation.setChecked(
|
||||
self.config[0].Comic_Book_Lover_apply_transform_on_bulk_operation
|
||||
self.config[0].Comic_Book_Lover__apply_transform_on_bulk_operation
|
||||
)
|
||||
|
||||
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.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)
|
||||
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.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)
|
||||
|
||||
for table, replacments in zip(
|
||||
(self.twLiteralReplacements, self.twValueReplacements), self.config[0].File_Rename_replacements
|
||||
(self.twLiteralReplacements, self.twValueReplacements), self.config[0].File_Rename__replacements
|
||||
):
|
||||
table.clearContents()
|
||||
for i in reversed(range(table.rowCount())):
|
||||
@ -452,30 +454,30 @@ class SettingsWindow(QtWidgets.QDialog):
|
||||
self.rename_test()
|
||||
if self.rename_error is not None:
|
||||
if isinstance(self.rename_error, ValueError):
|
||||
logger.exception("Invalid format string: %s", self.config[0].File_Rename_template)
|
||||
logger.exception("Invalid format string: %s", self.config[0].File_Rename__template)
|
||||
QtWidgets.QMessageBox.critical(
|
||||
self,
|
||||
"Invalid format string!",
|
||||
"Your rename template is invalid!"
|
||||
f"<br/><br/>{self.rename_error}<br/><br/>"
|
||||
"Please consult the template help in the "
|
||||
"settings and the documentation on the format at "
|
||||
"<a href='https://docs.python.org/3/library/string.html#format-string-syntax'>"
|
||||
"https://docs.python.org/3/library/string.html#format-string-syntax</a>",
|
||||
+ f"<br/><br/>{self.rename_error}<br/><br/>"
|
||||
+ "Please consult the template help in the "
|
||||
+ "settings and the documentation on the format at "
|
||||
+ "<a href='https://docs.python.org/3/library/string.html#format-string-syntax'>"
|
||||
+ "https://docs.python.org/3/library/string.html#format-string-syntax</a>",
|
||||
)
|
||||
return
|
||||
else:
|
||||
logger.exception(
|
||||
"Formatter failure: %s metadata: %s", self.config[0].File_Rename_template, self.renamer.metadata
|
||||
"Formatter failure: %s metadata: %s", self.config[0].File_Rename__template, self.renamer.metadata
|
||||
)
|
||||
QtWidgets.QMessageBox.critical(
|
||||
self,
|
||||
"The formatter had an issue!",
|
||||
"The formatter has experienced an unexpected error!"
|
||||
f"<br/><br/>{type(self.rename_error).__name__}: {self.rename_error}<br/><br/>"
|
||||
"Please open an issue at "
|
||||
"<a href='https://github.com/comictagger/comictagger'>"
|
||||
"https://github.com/comictagger/comictagger</a>",
|
||||
+ f"<br/><br/>{type(self.rename_error).__name__}: {self.rename_error}<br/><br/>"
|
||||
+ "Please open an issue at "
|
||||
+ "<a href='https://github.com/comictagger/comictagger'>"
|
||||
+ "https://github.com/comictagger/comictagger</a>",
|
||||
)
|
||||
|
||||
# Copy values from form to settings and save
|
||||
@ -489,54 +491,54 @@ class SettingsWindow(QtWidgets.QDialog):
|
||||
if not str(self.leIssueNumPadding.text()).isdigit():
|
||||
self.leIssueNumPadding.setText("0")
|
||||
|
||||
self.config[0].General_check_for_new_version = self.cbxCheckForNewVersion.isChecked()
|
||||
self.config[0].General__check_for_new_version = self.cbxCheckForNewVersion.isChecked()
|
||||
|
||||
self.config[0].Issue_Identifier_series_match_identify_thresh = self.sbNameMatchIdentifyThresh.value()
|
||||
self.config[0].Issue_Identifier_series_match_search_thresh = self.sbNameMatchSearchThresh.value()
|
||||
self.config[0].Issue_Identifier_publisher_filter = utils.split(self.tePublisherFilter.toPlainText(), "\n")
|
||||
self.config[0].Issue_Identifier__series_match_identify_thresh = self.sbNameMatchIdentifyThresh.value()
|
||||
self.config[0].Issue_Identifier__series_match_search_thresh = self.sbNameMatchSearchThresh.value()
|
||||
self.config[0].Issue_Identifier__publisher_filter = utils.split(self.tePublisherFilter.toPlainText(), "\n")
|
||||
|
||||
self.config[0].Filename_Parsing_complicated_parser = self.cbxComplicatedParser.isChecked()
|
||||
self.config[0].Filename_Parsing_remove_c2c = self.cbxRemoveC2C.isChecked()
|
||||
self.config[0].Filename_Parsing_remove_fcbd = self.cbxRemoveFCBD.isChecked()
|
||||
self.config[0].Filename_Parsing_remove_publisher = self.cbxRemovePublisher.isChecked()
|
||||
self.config[0].Filename_Parsing_allow_issue_start_with_letter = self.cbxAllowIssueStartWithLetter.isChecked()
|
||||
self.config.values.Filename_Parsing_protofolius_issue_number_scheme = (
|
||||
self.config[0].Filename_Parsing__complicated_parser = self.cbxComplicatedParser.isChecked()
|
||||
self.config[0].Filename_Parsing__remove_c2c = self.cbxRemoveC2C.isChecked()
|
||||
self.config[0].Filename_Parsing__remove_fcbd = self.cbxRemoveFCBD.isChecked()
|
||||
self.config[0].Filename_Parsing__remove_publisher = self.cbxRemovePublisher.isChecked()
|
||||
self.config[0].Filename_Parsing__allow_issue_start_with_letter = self.cbxAllowIssueStartWithLetter.isChecked()
|
||||
self.config.values.Filename_Parsing__protofolius_issue_number_scheme = (
|
||||
self.cbxProtofoliusIssueNumberScheme.isChecked()
|
||||
)
|
||||
|
||||
self.config[0].Issue_Identifier_clear_form_before_populating = self.cbxClearFormBeforePopulating.isChecked()
|
||||
self.config[0].Issue_Identifier_always_use_publisher_filter = self.cbxUseFilter.isChecked()
|
||||
self.config[0].Issue_Identifier_sort_series_by_year = self.cbxSortByYear.isChecked()
|
||||
self.config[0].Issue_Identifier_exact_series_matches_first = self.cbxExactMatches.isChecked()
|
||||
self.config[0].Issue_Identifier__clear_form_before_populating = self.cbxClearFormBeforePopulating.isChecked()
|
||||
self.config[0].Issue_Identifier__always_use_publisher_filter = self.cbxUseFilter.isChecked()
|
||||
self.config[0].Issue_Identifier__sort_series_by_year = self.cbxSortByYear.isChecked()
|
||||
self.config[0].Issue_Identifier__exact_series_matches_first = self.cbxExactMatches.isChecked()
|
||||
|
||||
self.config[0].Comic_Book_Lover_assume_lone_credit_is_primary = self.cbxAssumeLoneCreditIsPrimary.isChecked()
|
||||
self.config[0].Comic_Book_Lover_copy_characters_to_tags = self.cbxCopyCharactersToTags.isChecked()
|
||||
self.config[0].Comic_Book_Lover_copy_teams_to_tags = self.cbxCopyTeamsToTags.isChecked()
|
||||
self.config[0].Comic_Book_Lover_copy_locations_to_tags = self.cbxCopyLocationsToTags.isChecked()
|
||||
self.config[0].Comic_Book_Lover_copy_storyarcs_to_tags = self.cbxCopyStoryArcsToTags.isChecked()
|
||||
self.config[0].Comic_Book_Lover_copy_notes_to_comments = self.cbxCopyNotesToComments.isChecked()
|
||||
self.config[0].Comic_Book_Lover_copy_weblink_to_comments = self.cbxCopyWebLinkToComments.isChecked()
|
||||
self.config[0].Comic_Book_Lover_apply_transform_on_import = self.cbxApplyCBLTransformOnCVIMport.isChecked()
|
||||
self.config.values.Comic_Book_Lover_apply_transform_on_bulk_operation = (
|
||||
self.config[0].Comic_Book_Lover__assume_lone_credit_is_primary = self.cbxAssumeLoneCreditIsPrimary.isChecked()
|
||||
self.config[0].Comic_Book_Lover__copy_characters_to_tags = self.cbxCopyCharactersToTags.isChecked()
|
||||
self.config[0].Comic_Book_Lover__copy_teams_to_tags = self.cbxCopyTeamsToTags.isChecked()
|
||||
self.config[0].Comic_Book_Lover__copy_locations_to_tags = self.cbxCopyLocationsToTags.isChecked()
|
||||
self.config[0].Comic_Book_Lover__copy_storyarcs_to_tags = self.cbxCopyStoryArcsToTags.isChecked()
|
||||
self.config[0].Comic_Book_Lover__copy_notes_to_comments = self.cbxCopyNotesToComments.isChecked()
|
||||
self.config[0].Comic_Book_Lover__copy_weblink_to_comments = self.cbxCopyWebLinkToComments.isChecked()
|
||||
self.config[0].Comic_Book_Lover__apply_transform_on_import = self.cbxApplyCBLTransformOnCVIMport.isChecked()
|
||||
self.config.values.Comic_Book_Lover__apply_transform_on_bulk_operation = (
|
||||
self.cbxApplyCBLTransformOnBatchOperation.isChecked()
|
||||
)
|
||||
|
||||
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_move_to_dir = self.cbxMoveFiles.isChecked()
|
||||
self.config[0].File_Rename_dir = self.leDirectory.text()
|
||||
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__move_to_dir = self.cbxMoveFiles.isChecked()
|
||||
self.config[0].File_Rename__dir = self.leDirectory.text()
|
||||
|
||||
self.config[0].File_Rename_strict = self.cbxRenameStrict.isChecked()
|
||||
self.config[0].File_Rename_replacements = self.get_replacements()
|
||||
self.config[0].File_Rename__strict = self.cbxRenameStrict.isChecked()
|
||||
self.config[0].File_Rename__replacements = self.get_replacements()
|
||||
|
||||
# Read settings from talker tabs
|
||||
self.config = comictaggerlib.ui.talkeruigenerator.form_settings_to_config(self.sources, self.config)
|
||||
|
||||
self.update_talkers_config()
|
||||
|
||||
settngs.save_file(self.config, self.config[0].Runtime_Options_config.user_config_dir / "settings.json")
|
||||
settngs.save_file(self.config, self.config[0].Runtime_Options__config.user_config_dir / "settings.json")
|
||||
self.parent().config = self.config
|
||||
QtWidgets.QDialog.accept(self)
|
||||
|
||||
@ -549,8 +551,8 @@ class SettingsWindow(QtWidgets.QDialog):
|
||||
self.select_file(self.leRarExePath, "RAR")
|
||||
|
||||
def clear_cache(self) -> None:
|
||||
ImageFetcher(self.config[0].Runtime_Options_config.user_cache_dir).clear_cache()
|
||||
ComicCacher(self.config[0].Runtime_Options_config.user_cache_dir, version).clear_cache()
|
||||
ImageFetcher(self.config[0].Runtime_Options__config.user_cache_dir).clear_cache()
|
||||
ComicCacher(self.config[0].Runtime_Options__config.user_cache_dir, version).clear_cache()
|
||||
QtWidgets.QMessageBox.information(self, self.name, "Cache has been cleared.")
|
||||
|
||||
def reset_settings(self) -> None:
|
||||
|
@ -93,11 +93,11 @@ class TaggerWindow(QtWidgets.QMainWindow):
|
||||
|
||||
# prevent multiple instances
|
||||
socket = QtNetwork.QLocalSocket(self)
|
||||
socket.connectToServer(config[0].internal_install_id)
|
||||
socket.connectToServer(config[0].internal__install_id)
|
||||
alive = socket.waitForConnected(3000)
|
||||
if alive:
|
||||
logger.setLevel(logging.INFO)
|
||||
logger.info("Another application with key [%s] is already running", config[0].internal_install_id)
|
||||
logger.info("Another application with key [%s] is already running", config[0].internal__install_id)
|
||||
# send file list to other instance
|
||||
if file_list:
|
||||
socket.write(pickle.dumps(file_list))
|
||||
@ -109,15 +109,15 @@ class TaggerWindow(QtWidgets.QMainWindow):
|
||||
# listen on a socket to prevent multiple instances
|
||||
self.socketServer = QtNetwork.QLocalServer(self)
|
||||
self.socketServer.newConnection.connect(self.on_incoming_socket_connection)
|
||||
ok = self.socketServer.listen(config[0].internal_install_id)
|
||||
ok = self.socketServer.listen(config[0].internal__install_id)
|
||||
if not ok:
|
||||
if self.socketServer.serverError() == QtNetwork.QAbstractSocket.SocketError.AddressInUseError:
|
||||
self.socketServer.removeServer(config[0].internal_install_id)
|
||||
ok = self.socketServer.listen(config[0].internal_install_id)
|
||||
self.socketServer.removeServer(config[0].internal__install_id)
|
||||
ok = self.socketServer.listen(config[0].internal__install_id)
|
||||
if not ok:
|
||||
logger.error(
|
||||
"Cannot start local socket with key [%s]. Reason: %s",
|
||||
config[0].internal_install_id,
|
||||
config[0].internal__install_id,
|
||||
self.socketServer.errorString(),
|
||||
)
|
||||
sys.exit()
|
||||
@ -138,7 +138,7 @@ class TaggerWindow(QtWidgets.QMainWindow):
|
||||
self.fileSelectionList.selectionChanged.connect(self.file_list_selection_changed)
|
||||
self.fileSelectionList.listCleared.connect(self.file_list_cleared)
|
||||
self.fileSelectionList.set_sorting(
|
||||
self.config[0].internal_sort_column, QtCore.Qt.SortOrder(self.config[0].internal_sort_direction)
|
||||
self.config[0].internal__sort_column, QtCore.Qt.SortOrder(self.config[0].internal__sort_direction)
|
||||
)
|
||||
|
||||
# we can't specify relative font sizes in the UI designer, so
|
||||
@ -156,13 +156,13 @@ class TaggerWindow(QtWidgets.QMainWindow):
|
||||
|
||||
self.setWindowIcon(QtGui.QIcon(str(graphics_path / "app.png")))
|
||||
|
||||
if config[0].Runtime_Options_type and isinstance(config[0].Runtime_Options_type[0], int):
|
||||
if config[0].Runtime_Options__type and isinstance(config[0].Runtime_Options__type[0], int):
|
||||
# respect the command line option tag type
|
||||
config[0].internal_save_data_style = config[0].Runtime_Options_type[0]
|
||||
config[0].internal_load_data_style = config[0].Runtime_Options_type[0]
|
||||
config[0].internal__save_data_style = config[0].Runtime_Options__type[0]
|
||||
config[0].internal__load_data_style = config[0].Runtime_Options__type[0]
|
||||
|
||||
self.save_data_style = config[0].internal_save_data_style
|
||||
self.load_data_style = config[0].internal_load_data_style
|
||||
self.save_data_style = config[0].internal__save_data_style
|
||||
self.load_data_style = config[0].internal__load_data_style
|
||||
|
||||
self.setAcceptDrops(True)
|
||||
self.config_menus()
|
||||
@ -228,8 +228,8 @@ class TaggerWindow(QtWidgets.QMainWindow):
|
||||
|
||||
self.show()
|
||||
self.set_app_position()
|
||||
if self.config[0].internal_form_width != -1:
|
||||
self.splitter.setSizes([self.config[0].internal_form_width, self.config[0].internal_list_width])
|
||||
if self.config[0].internal__form_width != -1:
|
||||
self.splitter.setSizes([self.config[0].internal__form_width, self.config[0].internal__list_width])
|
||||
self.raise_()
|
||||
QtCore.QCoreApplication.processEvents()
|
||||
self.resizeEvent(None)
|
||||
@ -246,7 +246,7 @@ class TaggerWindow(QtWidgets.QMainWindow):
|
||||
if len(file_list) != 0:
|
||||
self.fileSelectionList.add_path_list(file_list)
|
||||
|
||||
if self.config[0].Dialog_Flags_show_disclaimer:
|
||||
if self.config[0].Dialog_Flags__show_disclaimer:
|
||||
checked = OptionalMessageDialog.msg(
|
||||
self,
|
||||
"Welcome!",
|
||||
@ -265,15 +265,15 @@ class TaggerWindow(QtWidgets.QMainWindow):
|
||||
Have fun!
|
||||
""",
|
||||
)
|
||||
self.config[0].Dialog_Flags_show_disclaimer = not checked
|
||||
self.config[0].Dialog_Flags__show_disclaimer = not checked
|
||||
|
||||
if self.config[0].General_check_for_new_version:
|
||||
if self.config[0].General__check_for_new_version:
|
||||
self.check_latest_version_online()
|
||||
|
||||
def current_talker(self) -> ComicTalker:
|
||||
if self.config[0].Sources_source in self.talkers:
|
||||
return self.talkers[self.config[0].Sources_source]
|
||||
logger.error("Could not find the '%s' talker", self.config[0].Sources_source)
|
||||
if self.config[0].Sources__source in self.talkers:
|
||||
return self.talkers[self.config[0].Sources__source]
|
||||
logger.error("Could not find the '%s' talker", self.config[0].Sources__source)
|
||||
raise SystemExit(2)
|
||||
|
||||
def open_file_event(self, url: QtCore.QUrl) -> None:
|
||||
@ -286,7 +286,7 @@ class TaggerWindow(QtWidgets.QMainWindow):
|
||||
|
||||
def setup_logger(self) -> ApplicationLogWindow:
|
||||
try:
|
||||
current_logs = (self.config[0].Runtime_Options_config.user_log_dir / "ComicTagger.log").read_text("utf-8")
|
||||
current_logs = (self.config[0].Runtime_Options__config.user_log_dir / "ComicTagger.log").read_text("utf-8")
|
||||
except Exception:
|
||||
current_logs = ""
|
||||
root_logger = logging.getLogger()
|
||||
@ -618,10 +618,10 @@ class TaggerWindow(QtWidgets.QMainWindow):
|
||||
def actual_load_current_archive(self) -> None:
|
||||
if self.metadata.is_empty and self.comic_archive is not None:
|
||||
self.metadata = self.comic_archive.metadata_from_filename(
|
||||
self.config[0].Filename_Parsing_complicated_parser,
|
||||
self.config[0].Filename_Parsing_remove_c2c,
|
||||
self.config[0].Filename_Parsing_remove_fcbd,
|
||||
self.config[0].Filename_Parsing_remove_publisher,
|
||||
self.config[0].Filename_Parsing__complicated_parser,
|
||||
self.config[0].Filename_Parsing__remove_c2c,
|
||||
self.config[0].Filename_Parsing__remove_fcbd,
|
||||
self.config[0].Filename_Parsing__remove_publisher,
|
||||
)
|
||||
if len(self.metadata.pages) == 0 and self.comic_archive is not None:
|
||||
self.metadata.set_default_page_list(self.comic_archive.get_number_of_pages())
|
||||
@ -967,10 +967,10 @@ class TaggerWindow(QtWidgets.QMainWindow):
|
||||
# copy the form onto metadata object
|
||||
self.form_to_metadata()
|
||||
new_metadata = self.comic_archive.metadata_from_filename(
|
||||
self.config[0].Filename_Parsing_complicated_parser,
|
||||
self.config[0].Filename_Parsing_remove_c2c,
|
||||
self.config[0].Filename_Parsing_remove_fcbd,
|
||||
self.config[0].Filename_Parsing_remove_publisher,
|
||||
self.config[0].Filename_Parsing__complicated_parser,
|
||||
self.config[0].Filename_Parsing__remove_c2c,
|
||||
self.config[0].Filename_Parsing__remove_fcbd,
|
||||
self.config[0].Filename_Parsing__remove_publisher,
|
||||
split_words,
|
||||
)
|
||||
if new_metadata is not None:
|
||||
@ -1006,8 +1006,8 @@ class TaggerWindow(QtWidgets.QMainWindow):
|
||||
dialog.setNameFilters(filters)
|
||||
dialog.setFileMode(QtWidgets.QFileDialog.FileMode.ExistingFiles)
|
||||
|
||||
if self.config[0].internal_last_opened_folder is not None:
|
||||
dialog.setDirectory(self.config[0].internal_last_opened_folder)
|
||||
if self.config[0].internal__last_opened_folder is not None:
|
||||
dialog.setDirectory(self.config[0].internal__last_opened_folder)
|
||||
return dialog
|
||||
|
||||
def auto_identify_search(self) -> None:
|
||||
@ -1079,10 +1079,10 @@ class TaggerWindow(QtWidgets.QMainWindow):
|
||||
else:
|
||||
QtWidgets.QApplication.restoreOverrideCursor()
|
||||
if new_metadata is not None:
|
||||
if self.config[0].Comic_Book_Lover_apply_transform_on_import:
|
||||
if self.config[0].Comic_Book_Lover__apply_transform_on_import:
|
||||
new_metadata = CBLTransformer(new_metadata, self.config[0]).apply()
|
||||
|
||||
if self.config[0].Issue_Identifier_clear_form_before_populating:
|
||||
if self.config[0].Issue_Identifier__clear_form_before_populating:
|
||||
self.clear_form()
|
||||
|
||||
notes = (
|
||||
@ -1093,7 +1093,7 @@ class TaggerWindow(QtWidgets.QMainWindow):
|
||||
new_metadata.replace(
|
||||
notes=utils.combine_notes(self.metadata.notes, notes, "Tagged with ComicTagger"),
|
||||
description=cleanup_html(
|
||||
new_metadata.description, self.config[0].Sources_remove_html_tables
|
||||
new_metadata.description, self.config[0].Sources__remove_html_tables
|
||||
),
|
||||
)
|
||||
)
|
||||
@ -1140,7 +1140,7 @@ class TaggerWindow(QtWidgets.QMainWindow):
|
||||
"Change Tag Read Style", "If you change read tag style now, data in the form will be lost. Are you sure?"
|
||||
):
|
||||
self.load_data_style = self.cbLoadDataStyle.itemData(s)
|
||||
self.config[0].internal_load_data_style = self.load_data_style
|
||||
self.config[0].internal__load_data_style = self.load_data_style
|
||||
self.update_menus()
|
||||
if self.comic_archive is not None:
|
||||
self.load_archive(self.comic_archive)
|
||||
@ -1151,12 +1151,12 @@ class TaggerWindow(QtWidgets.QMainWindow):
|
||||
|
||||
def set_save_data_style(self, s: int) -> None:
|
||||
self.save_data_style = self.cbSaveDataStyle.itemData(s)
|
||||
self.config[0].internal_save_data_style = self.save_data_style
|
||||
self.config[0].internal__save_data_style = self.save_data_style
|
||||
self.update_style_tweaks()
|
||||
self.update_menus()
|
||||
|
||||
def set_source(self, s: int) -> None:
|
||||
self.config[0].Sources_source = self.cbx_sources.itemData(s)
|
||||
self.config[0].Sources__source = self.cbx_sources.itemData(s)
|
||||
|
||||
def update_credit_colors(self) -> None:
|
||||
# !!!ATB qt5 porting TODO
|
||||
@ -1378,16 +1378,16 @@ class TaggerWindow(QtWidgets.QMainWindow):
|
||||
self.adjust_source_combo()
|
||||
|
||||
def set_app_position(self) -> None:
|
||||
if self.config[0].internal_window_width != 0:
|
||||
self.move(self.config[0].internal_window_x, self.config[0].internal_window_y)
|
||||
self.resize(self.config[0].internal_window_width, self.config[0].internal_window_height)
|
||||
if self.config[0].internal__window_width != 0:
|
||||
self.move(self.config[0].internal__window_x, self.config[0].internal__window_y)
|
||||
self.resize(self.config[0].internal__window_width, self.config[0].internal__window_height)
|
||||
else:
|
||||
screen = QtGui.QGuiApplication.primaryScreen().geometry()
|
||||
size = self.frameGeometry()
|
||||
self.move(int((screen.width() - size.width()) / 2), int((screen.height() - size.height()) / 2))
|
||||
|
||||
def adjust_source_combo(self) -> None:
|
||||
self.cbx_sources.setCurrentIndex(self.cbx_sources.findData(self.config[0].Sources_source))
|
||||
self.cbx_sources.setCurrentIndex(self.cbx_sources.findData(self.config[0].Sources__source))
|
||||
|
||||
def adjust_load_style_combo(self) -> None:
|
||||
# select the current style
|
||||
@ -1649,7 +1649,7 @@ class TaggerWindow(QtWidgets.QMainWindow):
|
||||
|
||||
if (
|
||||
dest_style == MetaDataStyle.CBI
|
||||
and self.config[0].Comic_Book_Lover_apply_transform_on_bulk_operation
|
||||
and self.config[0].Comic_Book_Lover__apply_transform_on_bulk_operation
|
||||
):
|
||||
md = CBLTransformer(md, self.config[0]).apply()
|
||||
|
||||
@ -1688,7 +1688,7 @@ class TaggerWindow(QtWidgets.QMainWindow):
|
||||
logger.exception("Save aborted.")
|
||||
|
||||
if not ct_md.is_empty:
|
||||
if self.config[0].Comic_Book_Lover_apply_transform_on_import:
|
||||
if self.config[0].Comic_Book_Lover__apply_transform_on_import:
|
||||
ct_md = CBLTransformer(ct_md, self.config[0]).apply()
|
||||
|
||||
QtWidgets.QApplication.restoreOverrideCursor()
|
||||
@ -1718,10 +1718,10 @@ class TaggerWindow(QtWidgets.QMainWindow):
|
||||
logger.error("Failed to load metadata for %s: %s", ca.path, e)
|
||||
if md.is_empty:
|
||||
md = ca.metadata_from_filename(
|
||||
self.config[0].Filename_Parsing_complicated_parser,
|
||||
self.config[0].Filename_Parsing_remove_c2c,
|
||||
self.config[0].Filename_Parsing_remove_fcbd,
|
||||
self.config[0].Filename_Parsing_remove_publisher,
|
||||
self.config[0].Filename_Parsing__complicated_parser,
|
||||
self.config[0].Filename_Parsing__remove_c2c,
|
||||
self.config[0].Filename_Parsing__remove_fcbd,
|
||||
self.config[0].Filename_Parsing__remove_publisher,
|
||||
dlg.split_words,
|
||||
)
|
||||
if dlg.ignore_leading_digits_in_filename and md.series is not None:
|
||||
@ -1807,7 +1807,7 @@ class TaggerWindow(QtWidgets.QMainWindow):
|
||||
)
|
||||
md.overlay(ct_md.replace(notes=utils.combine_notes(md.notes, notes, "Tagged with ComicTagger")))
|
||||
|
||||
if self.config[0].Issue_Identifier_auto_imprint:
|
||||
if self.config[0].Issue_Identifier__auto_imprint:
|
||||
md.fix_publisher()
|
||||
|
||||
if not ca.write_metadata(md, self.save_data_style):
|
||||
@ -1984,17 +1984,17 @@ class TaggerWindow(QtWidgets.QMainWindow):
|
||||
f"Exit {self.appName}", "If you quit now, data in the form will be lost. Are you sure?"
|
||||
):
|
||||
appsize = self.size()
|
||||
self.config[0].internal_window_width = appsize.width()
|
||||
self.config[0].internal_window_height = appsize.height()
|
||||
self.config[0].internal_window_x = self.x()
|
||||
self.config[0].internal_window_y = self.y()
|
||||
self.config[0].internal_form_width = self.splitter.sizes()[0]
|
||||
self.config[0].internal_list_width = self.splitter.sizes()[1]
|
||||
self.config[0].internal__window_width = appsize.width()
|
||||
self.config[0].internal__window_height = appsize.height()
|
||||
self.config[0].internal__window_x = self.x()
|
||||
self.config[0].internal__window_y = self.y()
|
||||
self.config[0].internal__form_width = self.splitter.sizes()[0]
|
||||
self.config[0].internal__list_width = self.splitter.sizes()[1]
|
||||
(
|
||||
self.config[0].internal_sort_column,
|
||||
self.config[0].internal_sort_direction,
|
||||
self.config[0].internal__sort_column,
|
||||
self.config[0].internal__sort_direction,
|
||||
) = self.fileSelectionList.get_sorting()
|
||||
settngs.save_file(self.config, self.config[0].Runtime_Options_config.user_config_dir / "settings.json")
|
||||
settngs.save_file(self.config, self.config[0].Runtime_Options__config.user_config_dir / "settings.json")
|
||||
|
||||
event.accept()
|
||||
else:
|
||||
@ -2087,7 +2087,7 @@ class TaggerWindow(QtWidgets.QMainWindow):
|
||||
QtCore.QTimer.singleShot(1, self.fileSelectionList.revert_selection)
|
||||
return
|
||||
|
||||
self.config[0].internal_last_opened_folder = os.path.abspath(os.path.split(comic_archive.path)[0])
|
||||
self.config[0].internal__last_opened_folder = os.path.abspath(os.path.split(comic_archive.path)[0])
|
||||
self.comic_archive = comic_archive
|
||||
try:
|
||||
self.metadata = self.comic_archive.read_metadata(self.load_data_style)
|
||||
@ -2118,10 +2118,10 @@ class TaggerWindow(QtWidgets.QMainWindow):
|
||||
|
||||
def check_latest_version_online(self) -> None:
|
||||
version_checker = VersionChecker()
|
||||
self.version_check_complete(version_checker.get_latest_version(self.config[0].internal_install_id))
|
||||
self.version_check_complete(version_checker.get_latest_version(self.config[0].internal__install_id))
|
||||
|
||||
def version_check_complete(self, new_version: tuple[str, str]) -> None:
|
||||
if new_version[0] not in (self.version, self.config[0].Dialog_Flags_dont_notify_about_this_version):
|
||||
if new_version[0] not in (self.version, self.config[0].Dialog_Flags__dont_notify_about_this_version):
|
||||
website = "https://github.com/comictagger/comictagger"
|
||||
checked = OptionalMessageDialog.msg(
|
||||
self,
|
||||
@ -2132,7 +2132,7 @@ class TaggerWindow(QtWidgets.QMainWindow):
|
||||
"Don't tell me about this version again",
|
||||
)
|
||||
if checked:
|
||||
self.config[0].Dialog_Flags_dont_notify_about_this_version = new_version[0]
|
||||
self.config[0].Dialog_Flags__dont_notify_about_this_version = new_version[0]
|
||||
|
||||
def on_incoming_socket_connection(self) -> None:
|
||||
# Accept connection from other instance.
|
||||
|
@ -204,7 +204,7 @@ def generate_talker_info(talker: ComicTalker, config: settngs.Config[ct_ns], lay
|
||||
logo = CoverImageWidget(
|
||||
talker_info_layout.parentWidget(),
|
||||
CoverImageWidget.URLMode,
|
||||
config.values.Runtime_Options_config.user_cache_dir,
|
||||
config.values.Runtime_Options__config.user_cache_dir,
|
||||
talker,
|
||||
False,
|
||||
)
|
||||
@ -248,7 +248,7 @@ def generate_combobox(option: settngs.Setting, layout: QtWidgets.QGridLayout) ->
|
||||
|
||||
def settings_to_talker_form(sources: Sources, config: settngs.Config[ct_ns]) -> None:
|
||||
# Set the active talker via id in sources combo box
|
||||
sources[0].setCurrentIndex(sources[0].findData(config[0].Sources_source))
|
||||
sources[0].setCurrentIndex(sources[0].findData(config[0].Sources__source))
|
||||
|
||||
# Iterate over the tabs, the talker is included in the tab so no extra lookup is needed
|
||||
for talker, tab in sources.tabs:
|
||||
@ -322,7 +322,7 @@ def get_config_from_tab(tab: TalkerTab, definitions: settngs.Group) -> dict[str,
|
||||
|
||||
def form_settings_to_config(sources: Sources, config: settngs.Config[ct_ns]) -> settngs.Config[ct_ns]:
|
||||
# Update the currently selected talker
|
||||
config.values.Sources_source = sources.cbx_sources.currentData()
|
||||
config.values.Sources__source = sources.cbx_sources.currentData()
|
||||
cfg = settngs.normalize_config(config, True, True)
|
||||
|
||||
# Iterate over the tabs, the talker is included in the tab so no extra lookup is needed
|
||||
|
@ -45,7 +45,7 @@ install_requires =
|
||||
pyrate-limiter>=2.6,<3
|
||||
rapidfuzz>=2.12.0
|
||||
requests==2.*
|
||||
settngs==0.7.2
|
||||
settngs==0.8.0
|
||||
text2digits
|
||||
typing-extensions>=4.3.0
|
||||
wordninja
|
||||
@ -81,7 +81,6 @@ QTW =
|
||||
all =
|
||||
PyQt5
|
||||
PyQtWebEngine
|
||||
metron-talker>=0.1.1
|
||||
py7zr
|
||||
rarfile>=4.0
|
||||
pyicu;sys_platform == 'linux' or sys_platform == 'darwin'
|
||||
|
@ -10,8 +10,8 @@ from testing.comicdata import search_results
|
||||
|
||||
def test_create_cache(config, mock_version):
|
||||
config, definitions = config
|
||||
comictalker.comiccacher.ComicCacher(config.Runtime_Options_config.user_cache_dir, mock_version[0])
|
||||
assert config.Runtime_Options_config.user_cache_dir.exists()
|
||||
comictalker.comiccacher.ComicCacher(config.Runtime_Options__config.user_cache_dir, mock_version[0])
|
||||
assert config.Runtime_Options__config.user_cache_dir.exists()
|
||||
|
||||
|
||||
def test_search_results(comic_cache):
|
||||
|
@ -117,7 +117,7 @@ def comicvine_api(monkeypatch, cbz, comic_cache, mock_version, config) -> comict
|
||||
|
||||
cv = comictalker.talkers.comicvine.ComicVineTalker(
|
||||
version=mock_version[0],
|
||||
cache_folder=config[0].Runtime_Options_config.user_cache_dir,
|
||||
cache_folder=config[0].Runtime_Options__config.user_cache_dir,
|
||||
)
|
||||
manager = settngs.Manager()
|
||||
manager.add_persistent_group("comicvine", cv.register_settings)
|
||||
@ -174,14 +174,14 @@ def config(tmp_path):
|
||||
app.register_settings()
|
||||
|
||||
defaults = app.parse_settings(comictaggerlib.ctsettings.ComicTaggerPaths(tmp_path / "config"), "")
|
||||
defaults[0].Runtime_Options_config.user_data_dir.mkdir(parents=True, exist_ok=True)
|
||||
defaults[0].Runtime_Options_config.user_config_dir.mkdir(parents=True, exist_ok=True)
|
||||
defaults[0].Runtime_Options_config.user_cache_dir.mkdir(parents=True, exist_ok=True)
|
||||
defaults[0].Runtime_Options_config.user_state_dir.mkdir(parents=True, exist_ok=True)
|
||||
defaults[0].Runtime_Options_config.user_log_dir.mkdir(parents=True, exist_ok=True)
|
||||
defaults[0].Runtime_Options__config.user_data_dir.mkdir(parents=True, exist_ok=True)
|
||||
defaults[0].Runtime_Options__config.user_config_dir.mkdir(parents=True, exist_ok=True)
|
||||
defaults[0].Runtime_Options__config.user_cache_dir.mkdir(parents=True, exist_ok=True)
|
||||
defaults[0].Runtime_Options__config.user_state_dir.mkdir(parents=True, exist_ok=True)
|
||||
defaults[0].Runtime_Options__config.user_log_dir.mkdir(parents=True, exist_ok=True)
|
||||
yield defaults
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def comic_cache(config, mock_version) -> Generator[comictalker.comiccacher.ComicCacher, Any, None]:
|
||||
yield comictalker.comiccacher.ComicCacher(config[0].Runtime_Options_config.user_cache_dir, mock_version[0])
|
||||
yield comictalker.comiccacher.ComicCacher(config[0].Runtime_Options__config.user_cache_dir, mock_version[0])
|
||||
|
Loading…
Reference in New Issue
Block a user