The Web Page - ZornTaov/ZC-ComicUpdater GitHub Wiki

The Web Page

An optional page for watching runs and adding, uploading and editing comics without touching a file.

The web page: a comic being scraped with two updates queued behind it, the library, the add form and an upload waiting to go in

Start it with python update_comics.py "D:/Comics" --web 8080 (add --schedule 03:30 as usual) and open http://localhost:8080/ or the NAS's address. Without --schedule the updater stays running and does only what the page or an update-now file asks.

Security: no login unless MIRROR_WEB_PASSWORD is set (any username). Otherwise anyone reaching the port can start scrapes, so keep it off the internet. Actions accept only JSON, so other sites cannot trigger them. Installing a plugin runs its code, so the Plugins dialog installs only behind a password, unless MIRROR_ALLOW_PLUGIN_INSTALLS=yes is set (see Scraper Plugins).

Watching

  • Running now: each comic in the current job, pages gained, time taken, its scraper's last line. After a chaptered comic's scrape - an update's, or a new comic's added with a chapter list or a size to cut it at - its chapter steps show there too as they go: the pages lined up, the chapter list read again, the archives written. The log says when each starts and how long it took. Stop kills the job; saved pages are kept and the metadata resumes from there.

  • Queued: waiting jobs, each removable. The page, the schedule and update-now all share this one queue, so runs never collide.

    Running now: one comic being scraped, thirteen pages in, with two updates queued

  • Log: live output; lost on restart. Recent: the last week's jobs, restarts included, kept in config/recent.json.

  • A comic's own log: the log above is the updater's summary, one line per comic. Everything the comic itself said - the scraper's or a plugin's program's every line, then its chapter steps - is kept a file per run in logs/ beside the config folder (/app/logs in the container), for a week. The log link beside a comic in Running now and Recent opens that run as text, and a run still going shows what it has said so far. A progress bar is kept once, as it was last drawn.

    The log, following a page check and a scrape Recent: a batch of new comics with one failure, a prime, two checks, a stopped scrape

  • Library: every comic, its page count and how its last run ended. Filter by name or wildcard (Uncompressed/SomeAuthor/*), then update the checked comics, all shown, or one from its row. Up to date means the last run reached the comic's end; a primed comic reads primed, waiting for its first update, with a count of those beside the totals.

    The library with ended comics shown: up to date, primed, incomplete, a failed download, and one ended

Add comics

One panel per comic: its two folders, then its first page and chapter list. Both folders are inside the ones named in Settings:

Pages folder Archive First page
SomeAuthor/TheirComic SomeAuthor/TheirComic.cbz https://example.com/theircomic/issue-1-cover
MyComic MyComic/MyComic.cbz https://example.com/comic/first-page

Add comics with four comics filled in, one with a chapter list, and number pages ticked

  • Archive blank: beside its siblings in a group folder, else in a folder of its own (some readers dislike loose archives in a root folder). Paste a list to fill rows, split on |, tabs or spaces.
  • Make cbz: whether the comic keeps archives at all (one per chapter if it has chapters, else one). Off, pages and chapters are still kept and nothing is written until it is turned back on.
  • Chapter list (optional): the comic's archive page. The comic is chaptered as soon as it is scraped, from the index the scrape keeps, and the single archive is given up once every page is in a chapter.
  • Cut every N pages: parts of that size from the first scrape, no walk (see Every so many pages). A primed comic remembers it and the update that fetches the rest writes the parts. A row's own chapter list wins.
  • Prime only: save just the first page. A full scrape has no time limit; a stalled page still ends by itself and anything can be stopped.
  • Scraper (shown once a plugin is installed): another downloader to scrape these comics with. The built-in options give way to the plugin's own settings, shared by every row; there is no chapter list, since its chapters come from it. A plugin comic's Edit shows its plugin's settings in place of the built-in scraper's, and the Library names its plugin beside it.

Options apply to every row, so add comics needing different options in separate batches. A folder that is already a comic is refused.

Check chapter list (beside Settings, and in Edit) reads an archive page and says what it would be read as: how many chapters, what each is called and where it starts. It downloads, walks and saves nothing, so it is the cheap way to find out whether a page is usable before giving it to a comic.

Check chapter list reading an archive page as three chapters of eight pages

Upload a comic

Upload a .zip or .cbz of a comic's pages (zip a folder first). It streams to disk with progress, so gigabytes are fine, then is inspected without unpacking: page count, numbering, and any mirror_metadata.json. A card then says where it goes:

  • Adopted before (it carries metadata): goes in as it came, output changed to where you put it. Its page index never comes along: copy it into the config folder's index by hand, or it is walked when its chapters are next worked out.
  • Not adopted yet: the card asks what adopt_comic.py would: last page held (or first not held) or ended, whether and from where to number new pages (prefilled), and cut every.
  • A .cbz can go in as loose pages to keep scraping, or stay this archive, as it is on the shelf.

An uploaded zip of sixty unnumbered pages, not adopted yet, asking where the comic is up to

It goes in by a queued job, never into a folder being scraped. An existing comic of that name is replaced only if you tick replace, and is moved into a .replaced folder, not deleted. Pages in several folders inside the zip, or paths escaping it, are refused; files that are neither pages nor metadata are left out, and the card says so. Uploads wait in .uploads at the library root until put in or discarded.

Edit

Edit shows a comic's settings (next start page, page number, archive path, scrape options, ended) beside pages held, last file saved, where and why the last run stopped, and recent runs - with a link to each of the week's updates of it in full, those that found nothing new included. Point a comic stuck on a broken page at the next one and press Save and update now. A comic being scraped cannot be edited; a save is refused if the file changed since opening; every change is logged in history.edits.

Editing a comic chaptered from its archive page

Move to another folder (folded away under Status) moves a comic, under its author for instance. Type or pick the folder, such as Uncompressed/SomeAuthor. Every folder under Uncompressed is offered, and so is every folder on the CBZs shelf, as its matching Uncompressed folder: an author whose archives are filed on the shelf is offered before any of their comics' pages are there. Then press See what would move. Move it only becomes available after that. The comic keeps its name. The single archive or the folder of chapter archives moves to the matching place on the CBZs shelf (CBZs/SomeAuthor/…), and cbz_path, output and the recorded chapter folder are rewritten to match. The index stays in config/index under its old name, and the comic records that name so it is still found. An archive filed somewhere that doesn't match the pages is listed as staying where it is. The move is a queued job, so it never runs during a scrape. It only renames: a move that fails part way puts back everything it had done. It is refused if anything is already at the new place or the folder is inside another comic. Folders left empty, such as an old author's, are removed. The move shows under the comic's edits. A cover the Reader wrote beside the archive moves with it. The reader's next scan carries over where you were up to, the comic's reader settings and its chosen cover.

Chaptering a library comic: set its chapter list to the archive page (walked once if there is no index; the single archive goes once every page is placed), or leave it blank to read chapters from the page addresses (/comic/issue-4-page-7), or blank with Or cut every N (details); then press Work out chapters.

Chapter boundaries lists chapters by the title of their first page. Rename one, move its start, mark it not a chapter, add one by page number and name, or insert a skipped page (details). A walked comic offers its own pages to pick from, by number and name; an unwalked one takes a number or address. Each change is a lasting correction.

Chapter boundaries for a comic of three chapters, each starting at its cover

Settings edits config/ComicScraper.json (Settings and Metadata), marking values fixed on the command line, which win. Element paths edits and checks the XPaths (Element Paths).

Settings, with the progress interval marked as set on the command line

The page is plain files in web_page/ (index.html, css/, js/), no build step, read on every load.