Skip to content
This repository was archived by the owner on Aug 22, 2026. It is now read-only.

Latest commit

 

History

History
123 lines (103 loc) · 6.94 KB

File metadata and controls

123 lines (103 loc) · 6.94 KB

v0.5.0 (2026-08-21)

  • UI Upgrade: oceanstrip now features rich CLI output (ANSI formatting, tqdm progress bars, and a clear summary block). The project is no longer strictly stdlib-only and now depends on tqdm.

Patch notes

0.4.1

Roadmap decision, no code change.

The Calibre plugin question is settled: FileTypePlugin with on_import = True. Researched against the Calibre source rather than guessed. run(path_to_ebook) receives the file being imported and returns the path to a modified copy, which Calibre then imports instead. So a stripped EPUB is what enters the library, the user's original on disk is untouched, and nothing needs to write to metadata.db.

Two constraints recorded with it. The plugin runs inside Calibre's bundled Python, so it must vendor its own code; oceanstrip having zero dependencies is what makes that clean. And the --check epubcheck gate cannot come along, since it is an external Java process of seconds per book and would make importing a shelf unusable, so the plugin strips and the CLI keeps the gated verification.

Settled at the same time as Bindery's identical question. One plugin shape serving both tools, not a shared plugin: separate repos, separate licences, no dependency between them.

Paperwork correction. The release above bumped src/oceanstrip/__init__.py and left pyproject.toml on 0.4.0, which is the exact drift CLAUDE.md and the module docstring both forbid. Fixed, and tests/test_version.py now guards the mirror so it cannot happen silently again: nothing else noticed, because --version reads __version__ off the module and reports correctly while the packaging metadata claims the older number, so the mismatch would only have surfaced at install or publish time.

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).