Skip to content

Latest commit

 

History

History
90 lines (78 loc) · 5.22 KB

File metadata and controls

90 lines (78 loc) · 5.22 KB

Patch notes

v0.4.0 (2026-07-17)

Phase 2 (ergonomics and confidence) lands. All four items are opt-in; the default behaviour (clean to a new path, originals untouched) is unchanged.

  • --check: an epubcheck gate. Validates the original and the cleaned copy and refuses any clean that regresses fatals or errors (the acceptance bar from spec.md: no more fatals+errors than the source). A refused clean writes nothing and exits 3. epubcheck is an external oracle we shell out to, not a dependency; if it is not found, --check warns and proceeds without validation.
  • --in-place: replace the original. For people who manage originals directly. It is the one sanctioned exception to "never modify an original", so it is gated on both a backup (a numbered .bak beside the source) and the epubcheck validate. It implies --check and hard-errors (exit 2, nothing touched) when epubcheck is unavailable.
  • --json FILE: a machine-readable run summary (- for stdout). Per-book counts, image warnings, epubcheck before/after, and a run summary. Works in single-file and batch modes.
  • Image-watermark warnings. We cannot read burned-in pixels (stdlib only, no OCR), but we now flag the signatures we honestly can: image entries whose filename carries a producer signature (e.g. OceanofPDF.com.jpg), and content documents where the signature survives text stripping because it sits in a preserved <img> reference. These are reported as "cannot remove" rather than silently left behind.
  • New exit code 3 for a validation refusal (distinct from 1 IO/path errors and 2 bad flag combinations). New guards: --in-place with a positional output, and batch --in-place with --out, both fail loud.
  • 18 new tests (epubcheck-parsing against a fake oracle, image detection, and the in-place/gate/JSON CLI paths); the suite stays self-contained and needs no real epubcheck.

v0.3.0 (2026-07-05)

  • Added an anchorless removal pass. Some producers inject the stamp as plain text with the URL not linked (no <a> to anchor on), e.g. <p>ABC Amber LIT Converter http://www.processtext.com/abclit.html</p> or nested in a <div type="FOOTER">. A text pass now locates the stamp by a text_sig and removes the outermost wrapper whose entire text is the stamp (allowing it to repeat), with the same balanced-element safety. A real sentence that merely mentions the URL is preserved (its wrapper's text is not only the stamp).
  • Watermark entries gained text_sig (a visible-text substring) and phrase (a regex for the stamp's text); href_sig is now optional (a producer may be anchorless-only). Detection keys on both signatures.
  • Found by the first full-library sweep: Jack Ketchum's Off Season and Julia Quinn's The Duke and I both carried the anchorless ABC Amber form that v0.2.0 could not remove.
  • Three new tests: anchorless <p>, anchorless <div type="FOOTER">, and the URL-in-real-prose safety case.

v0.2.0 (2026-07-05)

  • Generalized the single hardcoded OceanofPDF signature into a small watermark registry (WATERMARKS). Each entry is an href signature plus the stamp's visible text; the balanced-element engine, archive rewrite, and detection are now signature-agnostic. Adding a producer is one table entry.

  • Added ABC Amber LIT Converter support (processtext.com/abclit). Its stamp wraps the text in a <b> with the word "Converter" split across the <b> and its inner <a>, so removing only the <a> would orphan "Generated by ABC Amber LIT Conv". The removable-wrapper set now includes the inline elements b/i/em/strong; the "wrapper text must equal the watermark exactly" guard keeps real bold/italic prose safe.

  • Tests cover the ABC Amber <b> removal, a real <b> phrase surviving next to a watermark, and both producers' stamps in one document.

  • --out and -n/--dry-run are now rejected with a clear error (exit 2) in single-file mode instead of being silently ignored. Both flags only ever applied to --batch; in single-file mode oceanstrip book.epub --out dir quietly ignored --out and wrote <name> (cleaned).epub next to the source, which is an easy way to leave a stray file in an import directory. The error points at the fix (positional output path for one file, or --batch).

  • Added a CLI test suite (tests/test_cli.py) covering the guard and the still-valid single-file and batch paths.

v0.1.0 (2026-06-09)

First release. Extracted from a one-off script into a standalone tool.

  • Remove OceanofPDF.com watermark links from EPUB content documents using balanced element matching, so nested wrappers are handled without corrupting the XML.
  • Remove the stray oceanofpdf.com marker file from the archive root.
  • Repair mimetype ordering and compression on rewrite (fixes epubcheck PKG-006 that OceanofPDF's repackaging introduces).
  • Single-file and batch (--batch) modes; --dry-run to report without writing.
  • Originals are never modified.
  • stdlib unittest suite; no third-party dependencies.

Validated on a 3713-book Calibre library: 12 watermarked books found and cleaned with zero epubcheck regressions (three came out with fewer errors than the source, because the watermark link was itself a flagged issue).