Build and send a book only when it changed
A key of the chapters, rules and metadata of a story tells if its book changed. A check without a change no longer builds the book again, also for a book that waits for an upload. A held book goes out without a new build. The Rebuild button still builds and sends in each case.
This commit is contained in:
@@ -25,6 +25,8 @@ def state(monkeypatch, tmp_path):
|
||||
monkeypatch.setattr(o, "job_queue", queue)
|
||||
monkeypatch.setattr(config, "CWA_URL", "")
|
||||
monkeypatch.setattr(config, "SITE_DELAY", 7)
|
||||
monkeypatch.setattr(config, "TMP_DIR", tmp_path / "tmp")
|
||||
config.TMP_DIR.mkdir()
|
||||
return store, queue
|
||||
|
||||
|
||||
@@ -151,7 +153,8 @@ def site(state, monkeypatch):
|
||||
calibre={"title": "Title"},
|
||||
)
|
||||
fetch = Mock(side_effect=lambda a, url, i: f"<p>fresh {url}</p>")
|
||||
build, deliver = Mock(), Mock(return_value="Sent")
|
||||
build = Mock(side_effect=lambda story, overrides, path: path.write_bytes(b"epub"))
|
||||
deliver = Mock(return_value="Sent")
|
||||
monkeypatch.setattr(fff, "get_adapter", lambda url: adapter)
|
||||
monkeypatch.setattr(fff, "fetch_story", lambda a: snap)
|
||||
monkeypatch.setattr(fff, "fetch_chapter", fetch)
|
||||
|
||||
Reference in New Issue
Block a user