Improve watchlist thumbnails and docs

This commit is contained in:
Dymas
2026-05-12 14:24:24 +02:00
parent b8f087a7b0
commit 5feee92bcd
4 changed files with 2561 additions and 290 deletions
+125 -15
View File
@@ -1,14 +1,14 @@
# ani-cli web
A small local web UI for a system-wide `ani-cli` install.
A local web UI for a system-wide `ani-cli` install.
Current version: `0.2.1`
Current version: `0.8.13`
## Project Layout
```text
ani-cli-web/
app.py Web server, queue, search, and post-download library naming.
app.py Web server, queue, watchlist, thumbnail cache, and post-download file naming.
ani-cli-web Launcher script.
VERSION Project version.
CHANGELOG.md Change history.
@@ -17,43 +17,153 @@ ani-cli-web/
## Run
Start the web app with:
```sh
./ani-cli-web
```
For thumbnail debugging, run:
```sh
./ani-cli-web --debug
```
The launcher also accepts `---debug`. You can also enable debug logging with `ANI_CLI_WEB_DEBUG=1`.
Then open:
```text
http://127.0.0.1:8421/
```
The app searches anime, queues downloads, supports original or dubbed mode, quality, episode ranges, editable library names, season numbers, and a default download folder.
By default the server binds to `127.0.0.1:8421`.
The queue is stored in SQLite, shown 10 jobs at a time, and includes bulk actions for removing finished jobs and retrying failed jobs.
## Overview
Downloads are staged in the web app state directory first. After `ani-cli` finishes, the wrapper moves them into a Plex/Jellyfin-friendly layout:
`ani-cli-web` keeps search and download management on `/` and exposes the watchlist on `/watchlist`.
The app currently includes:
- Search against AllAnime with `sub` or `dub` mode selection.
- Episode loading for the selected result.
- Queueing downloads with editable library name, season, episode range, quality, and target folder.
- A paged SQLite-backed download queue with retry, cancel, remove, retry-failed, and clear-finished actions.
- A paged SQLite-backed watchlist with summary cards, per-show refresh, bulk refresh, source links, and thumbnail tools.
- Local thumbnail caching plus manual thumbnail upload when automatic cover lookup fails.
- Project-local runtime state under `.ani-cli-web/`.
## Search Page
The main page at `/` is where you search and queue downloads.
Workflow:
1. Search by anime title or keyword.
2. Pick a result to load available episodes.
3. Adjust library name, season, episode range, quality, and download folder.
4. Add the selected show either to the watchlist or directly to the queue.
The page also includes:
- A Defaults panel for the saved download folder, mode, and quality.
- A dependency status panel so you can see which required tools are available.
- A live queue view that refreshes automatically.
## Download Queue
The queue is stored in SQLite and shown 10 jobs at a time.
Queue actions currently available:
- `Retry` for finished or failed jobs.
- `Cancel` for pending or running jobs.
- `Remove` for completed or failed jobs.
- `Retry failed` for all failed jobs.
- `Remove finished` for completed jobs.
Downloads are staged inside the project-local app state first. After `ani-cli` finishes, files are moved into a Plex/Jellyfin-friendly layout:
```text
ANI_CLI_DOWNLOAD_DIR/anime_name/Season 01/anime_name - S01E01.mp4
```
## Watchlist (New)
## Watchlist
A new feature allows tracking anime that is not yet finished airing.
The watchlist stores one row per show in SQLite and keeps separate `sub` and `dub` episode counts.
1. **Add Anime:** Use the "Add to Watchlist" section to track an anime by providing its `show_id` and desired `mode` (sub/dub).
2. **Status Check:** Periodically check the status to see if the anime has finished airing.
3. **Download Trigger:** Once the status is marked as "ready\_to\_download" (indicating completion), you can manually trigger a download job for the entire series.
You can add entries in two ways:
The watchlist data is stored in the application state directory.
1. From the Search page with `Add to watchlist`.
2. Manually on `/watchlist` with a title and AllAnime `show_id`.
Watchlist features:
1. `Refresh` updates one tracked show.
2. `Refresh All` updates the entire watchlist.
3. `Open` jumps back to the Search page with the title pre-filled.
4. Clicking the anime title opens the AllManga source page at `bangumi/<show_id>` in a new tab.
5. `Remove` deletes the watchlist entry and clears its cached poster file.
6. Poster cards use a compact multi-column grid with pagination at 30 cards per page.
7. Summary cards show tracked shows plus total `sub` and `dub` episode counts.
### Thumbnail Behavior
Watchlist thumbnails use the local `/api/watchlist/thumb/...` route, not direct remote image URLs.
Current thumbnail behavior:
- Cached thumbnails render from the local project cache when available.
- The page adds a fresh nonce to thumbnail URLs to avoid stale browser-cached misses.
- Missing visible covers are warmed up in small batches instead of one request per card all at once.
- AnimeSchedule is tried first for cover lookup.
- If a season-labeled title fails as-is, lookup retries with simplified base-title queries.
- AniDB is used as a fallback when AnimeSchedule does not resolve a cover.
- Failed fetch attempts no longer refresh the retry window, so a bad lookup does not get stuck in an immediate repeat-404 state.
Per-card thumbnail tools:
1. `Reload` forces a fresh redownload attempt for that show's poster.
2. `Upload` appears when no thumbnail is currently available and lets you assign a local image manually.
3. Hovering the poster tile or card shows the current thumbnail source hint.
Manual uploads are saved into the same local thumbnail cache used by automatic cover downloads.
## Runtime State
All runtime state is stored under:
```text
ani-cli-web/.ani-cli-web/
```
That folder currently holds:
- `config.json`
- `queue.sqlite3`
- legacy `queue.json` migration input when present
- legacy `watchlist.json` migration input when present
- `thumbnails/`
- AniDB title cache data
- staging files for active downloads
Legacy files from `~/.config/ani-cli-web/` and `~/.local/state/ani-cli-web/` are migrated into the project-local folder automatically on startup.
## Configuration
Environment variables:
- `ANI_CLI_BIN`: path or command name for `ani-cli`; defaults to `ani-cli` from `PATH`.
- `ANI_CLI_DOWNLOAD_DIR`: initial default download folder.
- `ANI_CLI_MODE`: initial mode, `sub` or `dub`.
- `ANI_CLI_QUALITY`: initial quality, for example `best`, `1080`, or `720`.
- `ANI_CLI_QUALITY`: initial quality such as `best`, `1080`, or `720`.
- `ANI_CLI_WEB_HOST`: server host, default `127.0.0.1`.
- `ANI_CLI_WEB_PORT`: server port, default `8421`.
- `ANI_CLI_WEB_DEBUG`: enable debug logging when set to `1`, `true`, `yes`, or `on`.
Settings, queue data, and staging files are stored under XDG config/state directories when writable, with a local `.ani-cli-web/` fallback inside this project. Existing `queue.json` data is migrated into SQLite automatically.
Saved defaults from the UI are written into the project-local `config.json`.
Runtime folders such as `.ani-cli-web/`, `downloads/`, and Python bytecode cache directories at any depth are ignored by git.
## Notes
- Watchlist and queue data are stored in the same project-local SQLite database.
- Runtime folders such as `.ani-cli-web/`, `downloads/`, and Python bytecode cache directories at any depth are ignored by git.