cast date and remainder parts as strings

This commit is contained in:
AJ Slater 2024-02-23 22:16:51 -08:00
parent 29e6068db2
commit d3b11d6361
2 changed files with 3 additions and 1 deletions

View File

@ -62,6 +62,7 @@ class ComicFilenameSerializer:
# noop if only day. # noop if only day.
break break
if parts: if parts:
parts = (str(part) for part in parts)
date = "-".join(parts) date = "-".join(parts)
self._log("After date", date) self._log("After date", date)
self.metadata = MappingProxyType({**self.metadata, "date": date}) self.metadata = MappingProxyType({**self.metadata, "date": date})
@ -79,6 +80,7 @@ class ComicFilenameSerializer:
"""Add the remainders specially.""" """Add the remainders specially."""
if remainders := self.metadata.get("remainders"): if remainders := self.metadata.get("remainders"):
if isinstance(remainders, Sequence): if isinstance(remainders, Sequence):
remainders = (str(remainder) for remainder in remainders)
remainder = " ".join(remainders) remainder = " ".join(remainders)
else: else:
remainder = str(remainders) remainder = str(remainders)

View File

@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
[tool.poetry] [tool.poetry]
name = "comicfn2dict" name = "comicfn2dict"
version = "0.2.0a1" version = "0.2.0a2"
description = "Parse common comic filenames and return a dict of metadata attributes. Includes a cli." description = "Parse common comic filenames and return a dict of metadata attributes. Includes a cli."
license = "GPL-3.0-only" license = "GPL-3.0-only"
authors = ["AJ Slater <aj@slater.net>"] authors = ["AJ Slater <aj@slater.net>"]