norm_fold out of loop for add_credit. Explicit overlay mode for CLI metadata.
This commit is contained in:
parent
e9a592df50
commit
2faac18597
@ -268,8 +268,8 @@ class GenericMetadata:
|
||||
return new
|
||||
|
||||
# Create dict for deduplication
|
||||
new_dict: dict[str, Credit] = {f"{norm_fold(n['person'])}_{n['role'].casefold()}": n for n in new}
|
||||
cur_dict: dict[str, Credit] = {f"{norm_fold(c['person'])}_{c['role'].casefold()}": c for c in cur}
|
||||
new_dict: dict[str, Credit] = {norm_fold(f"{n['person']}_{n['role']}"): n for n in new}
|
||||
cur_dict: dict[str, Credit] = {norm_fold(f"{c['person']}_{c['role']}"): c for c in cur}
|
||||
|
||||
# Any duplicates use the 'new' value
|
||||
cur_dict.update(new_dict)
|
||||
@ -477,10 +477,13 @@ class GenericMetadata:
|
||||
|
||||
credit = Credit(person=person, role=role, primary=primary)
|
||||
|
||||
person = norm_fold(person)
|
||||
role = norm_fold(role)
|
||||
|
||||
# look to see if it's not already there...
|
||||
found = False
|
||||
for c in self.credits:
|
||||
if norm_fold(c["person"]) == norm_fold(person) and norm_fold(c["role"]) == norm_fold(role):
|
||||
if norm_fold(c["person"]) == person and norm_fold(c["role"]) == role:
|
||||
# no need to add it. just adjust the "primary" flag as needed
|
||||
c["primary"] = primary
|
||||
found = True
|
||||
|
@ -29,7 +29,7 @@ from typing import Any, TextIO
|
||||
from comicapi import utils
|
||||
from comicapi.comicarchive import ComicArchive
|
||||
from comicapi.comicarchive import metadata_styles as md_styles
|
||||
from comicapi.genericmetadata import GenericMetadata
|
||||
from comicapi.genericmetadata import GenericMetadata, OverlayMode
|
||||
from comictaggerlib.cbltransformer import CBLTransformer
|
||||
from comictaggerlib.ctsettings import ct_ns
|
||||
from comictaggerlib.filerenamer import FileRenamer, get_rename_dir
|
||||
@ -259,7 +259,7 @@ class CLI:
|
||||
logger.error("Failed to load metadata for %s: %s", ca.path, e)
|
||||
|
||||
# finally, use explicit stuff (always 'overlay' mode)
|
||||
md.overlay(self.config.Runtime_Options__metadata)
|
||||
md.overlay(self.config.Runtime_Options__metadata, mode=OverlayMode.overlay)
|
||||
|
||||
return md
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user