Skip to content

Commit

Permalink
Add imprint support (#135)
Browse files Browse the repository at this point in the history
Modify filesorter.py to use imprint if present instead of publisher, to preserve current handling. I.e. Sort to `Vertigo` instead of `DC Comics`

Plan to add option to ignore imprint in sorting in the future for users.
  • Loading branch information
bpepple authored Aug 13, 2024
1 parent 885515d commit 45d2f31
Show file tree
Hide file tree
Showing 4 changed files with 344 additions and 312 deletions.
9 changes: 7 additions & 2 deletions metrontagger/filesorter.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,13 @@ def _cleanup_metadata(
Returns:
tuple[str | None, str | None, str | None]: Cleaned publisher, series, and volume strings.
"""

publisher = cleanup_string(meta_data.publisher.name) if meta_data.publisher else None
# If there is an imprint, let's use that as the publisher.
if meta_data.imprint:
publisher = cleanup_string(meta_data.imprint.name)
else:
publisher = (
cleanup_string(meta_data.publisher.name) if meta_data.publisher else None
)
if meta_data.series:
series = cleanup_string(meta_data.series.name)
volume = cleanup_string(meta_data.series.volume)
Expand Down
9 changes: 6 additions & 3 deletions metrontagger/talker.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,9 +540,12 @@ def map_ratings(rating: str) -> str:
resp.series.volume,
resp.series.series_type.name,
)
md.issue = IssueString(resp.number).as_string()
md.publisher = Basic(resp.publisher.name, resp.publisher.id)
md.cover_date = resp.cover_date
md.issue = IssueString(resp.number).as_string() if resp.number else None
md.publisher = (
Basic(resp.publisher.name, resp.publisher.id) if resp.publisher else None
)
md.imprint = Basic(resp.imprint.name, resp.imprint.id) if resp.imprint else None
md.cover_date = resp.cover_date or None
md.comments = resp.desc
md.notes = create_note(md.info_source.id_)
if resp.story_titles:
Expand Down
Loading

0 comments on commit 45d2f31

Please sign in to comment.