Compare commits

...

3 Commits

Author SHA1 Message Date
3f6facf45b Merge branch 'Kijaru/add_gtin_identifier' into develop
Some checks failed
CI / lint (ubuntu-latest, 3.9) (push) Failing after 33s
CI / build-and-test (macos-13, 3.9) (push) Has been cancelled
CI / build-and-test (macos-14, 3.9) (push) Has been cancelled
CI / build-and-test (ubuntu-22.04, 3.9) (push) Has been cancelled
CI / build-and-test (windows-latest, 3.9) (push) Has been cancelled
2025-06-08 13:24:26 -07:00
94f325a088 Fix error when parsing metadata from the CLI 2025-05-24 11:49:56 -07:00
ebd7fae059 Fix setting the issue to "1" when not searching online 2025-05-24 11:49:38 -07:00
2 changed files with 9 additions and 6 deletions

View File

@ -590,9 +590,6 @@ class CLI:
self.output(f"Processing {utils.path_to_short_str(ca.path)}...")
md, tags_read = self.create_local_metadata(ca, self.config.Runtime_Options__tags_read)
if md.issue is None or md.issue == "":
if self.config.Auto_Tag__assume_issue_one:
md.issue = "1"
matches: list[IssueResult] = []
# now, search online
@ -629,11 +626,15 @@ class CLI:
return res, match_results
else:
qt_md = self.try_quick_tag(ca, md)
query_md = md.copy()
qt_md = self.try_quick_tag(ca, query_md)
if query_md.issue is None or query_md.issue == "":
if self.config.Auto_Tag__assume_issue_one:
query_md.issue = "1"
if qt_md is None or qt_md.is_empty:
if qt_md is not None:
self.output("Failed to find match via quick tag")
ct_md, matches, res, match_results = self.normal_tag(ca, tags_read, md, match_results) # type: ignore[assignment]
ct_md, matches, res, match_results = self.normal_tag(ca, tags_read, query_md, match_results) # type: ignore[assignment]
if res is not None:
return res, match_results
else:

View File

@ -194,7 +194,7 @@ def parse_metadata_from_string(mdstr: str) -> GenericMetadata:
else:
value = t(value)
except (ValueError, TypeError):
raise argparse.ArgumentTypeError(f"Invalid syntax for tag '{key}': {value}")
raise argparse.ArgumentTypeError(f"Invalid syntax for tag {key!r}: {value!r}")
return value
md = GenericMetadata()
@ -240,6 +240,8 @@ def parse_metadata_from_string(mdstr: str) -> GenericMetadata:
else:
raise argparse.ArgumentTypeError(f"'{key}' is not a valid tag name")
md.is_empty = empty
except argparse.ArgumentTypeError as e:
raise e
except Exception as e:
logger.exception("Unable to read metadata from the commandline '%s'", mdstr)
raise Exception("Unable to read metadata from the commandline") from e