feat(downloader): add path resolution and sanitization (closes #4)

Add pure-logic downloader module with Book dataclass, filesystem-safe
path component sanitization, default conditional path patterns, custom
{TOKEN} pattern substitution, and subdirectory decision logic.

- sanitize(): 5-rule pipeline — colon→dash, strip illegal/control chars,
  trim whitespace, remove trailing dots, cap at 255 characters
- resolve_path(book, pattern?): default mode selects pattern by series
  presence; custom mode substitutes 11 tokens with sanitization
- needs_subdirectory(book): True when PDF extras or cover art present
- @dataclass(frozen=True) Book: immutable record for all book metadata

56 new tests across 11 classes. 97 total tests passing. 16/16 AC met.
This commit is contained in:
AlexKucera committed 2026-06-03 12:03:00 +02:00
1 parent 515f5c01f6
commit 25ee66b95d
5 files changed
+682

No files matched your search

+4
View File
@@ -13,3 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- OAuth2 client with password grant auth and paginated library fetch
- Download history tracking with corrupt JSON recovery
- CLI skeleton wiring config → auth → library → filter → print
- Path resolution with default conditional patterns and custom token substitution
- Filesystem-safe component sanitization (illegal chars, control chars, colons)
- Immutable Book dataclass for typed book metadata
- Subdirectory decision logic based on PDF extras or cover art presence