diff --git a/containers/novela/routers/common.py b/containers/novela/routers/common.py index c86ffea..13e38ae 100644 --- a/containers/novela/routers/common.py +++ b/containers/novela/routers/common.py @@ -70,15 +70,17 @@ def make_rel_path(*, media_type: str, publisher: str, author: str, title: str, s return Path("epub") / pub / auth / "Stories" / f"{ttl}.epub" if media_type == "pdf": + pub = clean_segment(publisher, "Unknown Publisher", 80) auth = clean_segment(author, "Unknown Author", 80) ttl = clean_segment(title, "Untitled", 140) - return Path("pdf") / auth / f"{ttl}.pdf" + return Path("pdf") / pub / auth / f"{ttl}.pdf" # CBR / CBZ — preserve the original extension; default to .cbr comics_ext = ext if ext in {".cbr", ".cbz"} else ".cbr" + pub = clean_segment(publisher, "Unknown Publisher", 80) auth = clean_segment(author, "Unknown", 80) ttl = clean_segment(title, "Untitled", 140) - return Path("comics") / auth / f"{ttl}{comics_ext}" + return Path("comics") / pub / auth / f"{ttl}{comics_ext}" def ensure_unique_rel_path(rel_path: Path) -> Path: diff --git a/containers/novela/routers/reader.py b/containers/novela/routers/reader.py index fc2d14d..e722b69 100644 --- a/containers/novela/routers/reader.py +++ b/containers/novela/routers/reader.py @@ -417,10 +417,12 @@ def _make_rel_path( return Path("epub") / pub / auth / "Stories" / f"{ttl}.epub" if ext == ".pdf": - return Path("pdf") / auth / f"{ttl}.pdf" + pub = _clean_segment(publisher, "Unknown Publisher", 80) + return Path("pdf") / pub / auth / f"{ttl}.pdf" # .cbr / .cbz - return Path("comics") / auth / f"{ttl}{ext}" + pub = _clean_segment(publisher, "Unknown Publisher", 80) + return Path("comics") / pub / auth / f"{ttl}{ext}" def _ensure_unique_rel_path(rel_path: Path, *, exclude: Path | None = None) -> Path: diff --git a/docs/TECHNICAL.md b/docs/TECHNICAL.md index 822bcc2..c539b99 100644 --- a/docs/TECHNICAL.md +++ b/docs/TECHNICAL.md @@ -27,9 +27,9 @@ All files are stored under `library/` (relative to the app working directory, ma |--------|-------------| | EPUB (no series) | `library/epub/{publisher}/{author}/Stories/{title}.epub` | | EPUB (series) | `library/epub/{publisher}/{author}/Series/{series}/{idx:03d} - {title}.epub` | -| PDF | `library/pdf/{author}/{title}.pdf` | -| CBR | `library/comics/{author}/{title}.cbr` | -| CBZ | `library/comics/{author}/{title}.cbz` | +| PDF | `library/pdf/{publisher}/{author}/{title}.pdf` | +| CBR | `library/comics/{publisher}/{author}/{title}.cbr` | +| CBZ | `library/comics/{publisher}/{author}/{title}.cbz` | - Segments are sanitised: special chars stripped, max lengths applied (publisher/author 80, title 140, series 80). - Series index is zero-padded to 3 digits (`001`, `002`, …), clamped to 1–999. diff --git a/docs/changelog-develop.md b/docs/changelog-develop.md index e4cc150..a92f556 100644 --- a/docs/changelog-develop.md +++ b/docs/changelog-develop.md @@ -46,6 +46,9 @@ This file tracks changes on the `develop` line. - Updated Docker image with `postgresql-client` for `pg_dump`. - Multiple test builds pushed to `gitea.oskamp.info/ivooskamp/novela:dev`. +## 2026-03-25 (4) +- Added {publisher} directory to PDF and CBR/CBZ paths: `pdf/{publisher}/{author}/{title}.pdf`, `comics/{publisher}/{author}/{title}.cbr/cbz` — consistent with EPUB structure + ## 2026-03-25 (3) - Fixed CBZ extension in import: `common.make_rel_path` always generated `.cbr` for CBZ files; now accepts `ext` parameter; `library.py` passes actual suffix so CBZ files land at `comics/{author}/{title}.cbz` - Added missing `GET /download/{filename}` endpoint (referenced in book.html but was 404)