Skip to content

Nasty Dogs and Funky Kings

Latest

Choose a tag to compare

@github-actions github-actions released this 16 Nov 21:45
e2bfdac

Changes

🐛 Bug Fixes

  • Fix XML element errors pyright reports in the metadata handlers @bpepple (#282)
  • Fix annotation errors pyright reports in the metadata classes @bpepple (#281)
  • Return empty lists instead of None for missing list fields @bpepple (#279)
  • Don't modify the caller's Metadata in write_metadata() @bpepple (#278)
  • Remove the stale case-variant metadata copy a write replaces @bpepple (#277)
  • Fill in ComicInfo page ImageSize when Pillow is missing @bpepple (#276)
  • Drop stale MetronInfo dates when a pre-1900 date is skipped @bpepple (#275)
  • Narrow Comic's exception handling and close archiver read-error gaps @bpepple (#273)
  • Fix overlay, page list cache, metadata filename and Pillow warning bugs @bpepple (#271)
  • Cache parsed metadata per format in Comic @bpepple (#270)
  • Add strict mode to Comic.read_metadata() for unreadable metadata @bpepple (#269)

🧰 Maintenance

  • Run pyright in make lint @bpepple (#284)
  • Fix the remaining pyright errors in the archivers, comic and validate @bpepple (#283)
  • Remove unused constants and vulture's archiver.py exclusion @bpepple (#280)
  • Remove duplicated constants, dead code and copied element setters @bpepple (#274)
  • Refactor metadata format handling and unify archiver caching and errors @bpepple (#272)

⚠️ Migrating from 9.x

Most code that only uses Comic won't need changes. Check the items below if you rely on write_metadata() changing your Metadata object, catch exceptions from Comic, or use the archiver classes directly.

Comic

  • write_metadata() no longer modifies your Metadata object (#278). It used to fill in page_count and each page's ImageSize/ImageWidth/ImageHeight, and turn page Image indexes into strings. The written file still has those values. If you need them, read the metadata back:

    comic.write_metadata(metadata, MetadataFormat.COMIC_INFO)
    written = comic.read_metadata(MetadataFormat.COMIC_INFO)
    written.page_count, written.pages[0]["ImageSize"]
  • write_metadata() raises on malformed Metadata (#273). A field holding the wrong type (for example, metadata.series = "Batman" instead of a Series) raises TypeError or AttributeError instead of returning False. Archive, I/O and invalid-value errors still return False.

  • Unexpected errors are no longer swallowed (#273). Comic used to catch every Exception. It now catches only ArchiverError, OSError and the documented parsing errors, so bugs in your code or in a custom archiver propagate instead of being logged.

  • remove_metadata() returns False for an unreadable archive instead of True, and now removes metadata from archives that have no pages (#273).

  • Metadata in subfolders is ignored (#271). Only ComicInfo.xml/MetronInfo.xml at the archive root count, matched case-insensitively. has_metadata() no longer reports a file such as Issue1/ComicInfo.xml, which could never be read anyway.

  • Writing replaces a case-variant metadata file (#277). If an archive only has comicinfo.xml, a write creates ComicInfo.xml with its contents and removes comicinfo.xml.

  • New: read_metadata(fmt, strict=True) raises ComicMetadataError when a metadata file exists but can't be read or parsed (#269). The default is unchanged. If you opened a second Comic to read the other metadata format, you can drop that workaround: each format is now cached separately (#270).

Metadata classes

  • Missing list fields read as [], not None (#279). A ComicInfo without <Title>, <Genre>, <Characters>, <Teams>, <Locations> or <StoryArc>, and a MetronInfo without <Credits>, used to set that field to None. Replace checks such as md.genres is None or md.credits is None with not md.genres.
  • Series and Publisher no longer subclass Basic (#281). isinstance(series, Basic) and isinstance(publisher, Basic) now return False. Their fields, field order and behaviour are unchanged. Their name is now typed str | None, matching what a ComicInfo without <Series> or <Publisher> already produced, and Credit.id_ is typed int | str | None, like Basic.id_.

Archivers (only if you use them directly)

  • get_filename_list() raises ArchiverReadError on failure on every backend (#272). A corrupt Zip, Tar or 7z archive used to list as []. A missing Rar or Pdf file now lists as [] instead of raising, the same as the others.
  • write_file() returns False on failure on every backend (#272). TarArchiver and SevenZipArchiver used to raise ArchiverWriteError/ArchiverReadError. ArchiverWriteError is still exported, but no built-in archiver raises it.
  • RarArchiver.read_file() and ZipArchiver.read_file() raise ArchiverReadError (#273) for encrypted, damaged, multi-volume or unsupported members instead of the raw rarfile/zipfile exception. The original is kept as __cause__.
  • Custom archivers should implement _list_files() instead of get_filename_list() (#272). The base class now caches the listing. An archiver that still overrides get_filename_list() keeps working. Call the new invalidate_cache() if the file may have changed outside the archiver.
  • PdfArchiver.PAGE_DPI is 144, not 150 (#274). Rendering hasn't changed; the constant now matches it.

Removed

These were never exported or documented:

  • darkseid.comic.MetadataFormatRegistry (#272)
  • darkseid.archivers.factory.ArchiverProtocol (#274)