comicfn2dict

source package comicfn2dict

Comic Filename to Dict parser and unparser.

Classes

Functions

source class ComicFilenameParser(path: str | Path, verbose: int = 0)

Parse a filename metadata into a dict.

Initialize.

Methods

  • path_index Lazily retrieve and memoize the key’s location in the path.

  • parse Parse the filename with a hierarchy of regexes.

source method ComicFilenameParser.path_index(key: str, default: int = -1) → int

Lazily retrieve and memoize the key’s location in the path.

source method ComicFilenameParser.parse() → dict[str, str | tuple[str, …]]

Parse the filename with a hierarchy of regexes.

source class ComicFilenameSerializer(metadata: Mapping, ext: bool = True, verbose: int = 0)

Serialize Comic Filenames from dict.

Initialize.

Methods

  • serialize Get our preferred basename from a metadata dict.

source method ComicFilenameSerializer.serialize() → str

Get our preferred basename from a metadata dict.

source comicfn2dict(path: str | Path, verbose: int = 0) → dict[str, str | tuple[str, …]]

Simplfily the API.

source dict2comicfn(md: Mapping, ext: bool = True, verbose: int = 0) → str

Simplify API.