Skip to content

Match TMDBHelper schema v50 and add the full-cache crawl - #7

Merged
xbmc4lyfe merged 15 commits into
mainfrom
claude/addon-v50-full-cache
Nov 5, 2026
Merged

xbmc4lyfe merged 15 commits into
mainfrom
claude/addon-v50-full-cache

Conversation

@xbmc4lyfe

Copy link
Copy Markdown
Contributor

Requested by Allen · project thread

Summary

This brings the branch that the full crawl runs from into main:

  • Matches TMDBHelper's database schema version 50 and fixes the crawl's data bugs.
  • Speeds up the database writer and the image purge.
  • Adds a fanart.tv crawl and matches Kodi's texture rows.
  • Saves images in parallel (Save images in parallel #6).
  • Reads free space with 64-bit block counts on macOS.
  • Documents keeping images on a network share, splitting disk space between the two crawls, and where to save the TMDB API key.

The last commit merges main back in to pick up the Entware package (#5). Two conflicts came up: the scripts/ row in site/content/layout.md and the Vale vocabulary. Both now keep the lines from each side.

Testing

  • cargo test: all suites pass (live TMDB tests are skipped).
  • cargo fmt --all -- --check and cargo clippy --all-targets -- -D warnings: clean.
  • Vale wasn't available in this environment. The only new prose is the merged scripts/ row.
  • The branch is already running a full crawl on macOS (about 2.96M items so far).

Generated by Claude Code

xbmc4lyfe and others added 10 commits October 31, 2026 04:17
The docs told readers to export a key but never said which TMDB value to
use or how to keep it out of shell history.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The add-on ignored everything warmup-rs wrote: `baseitem.language` held
each title's original language, while the add-on's query needs its own
language setting. Collections used the wrong ID, and rows in `ratings`
stopped the add-on fetching ratings.

- Port the add-on's `mappings.py` to one writer, including seasons,
  episodes, episode groups, and schema version 50.
- Download every image at `original` and delete older `w1280` files.
- Keep in-flight items in the queue, so a stop loses nothing.
- Drop 404s and items that keep failing instead of retrying forever.
- Exit on a rejected API key, and keep the key out of error logs.
- Add `--all-ids`, `--language`, and `--min-free-gb`.
- Lower the default concurrency to 20, which avoids TMDB's rate limit.
- Make the TMDB tests explicit with `just test-live`, since they passed
  without checking anything when no key was set.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The writers cycle through more prepared statements than rusqlite's default
cache of 16 holds, so most writes recompiled their SQL. A larger cache takes
a write from 128 ms to about 8 ms per item. The purge scanned the whole
texture table for each file it removed, so it now deletes by row ID.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
With its fanart.tv lookup on, TMDBHelper ignores a movie or show until
`baseitem.fanart_tv` is set. On Kodi 21.3 with those settings, flagged rows
served from the cache in 0.3 s, and unflagged rows were fetched again.

`--mode=fanart` fetches the art and sets the flag, and images mode now caches
fanart.tv URLs too. New texture rows leave `lasthashcheck` empty, which is what
Kodi stores for web images.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
macOS keeps `statvfs` block counts in 32 bits, and an SMB share reports 1 KB
blocks, so a share with 5 TB free read as about 1 TB and images mode paused.
Also fix a stray code fence in the quick start.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* Save images in parallel

The database writer used to save every image to disk one at a time, so the
concurrency limit only applied to downloads. On a network share, that held the
crawl to about 7 images a second. Each download task now saves its own image
and sends only the results to the writer. Each save also gets its own temporary
name, so two rows that share an image can't overwrite each other's partial file.

In a trial against the same share at --concurrency=32, the rate reached about
25 images a second while the running crawl kept its 7.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* Remove the temporary image file when a save fails

Each save has its own temporary name, so a partial file from a failed write
would otherwise stay on the share. Also adds zsh to the Vale vocabulary, which
the CI's Vale version doesn't know.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Brings in the Entware opkg package and the CoreELEC TODO item, and
combines the two scripts/ rows in the layout page and the Vale
vocabulary additions from both sides.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LG44gW5bMySbSKFF1ZGDNn
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-05T12:22:02.836598Z 2d7f064 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3c52c088c7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/cache/mapper.rs Resolved
Comment thread src/api/mod.rs Resolved
Comment thread src/cache/mapper.rs Resolved
Comment thread scripts/addon-schema.py Resolved
Comment thread src/cache/mapper.rs Resolved
Comment thread src/worker.rs Resolved
- A real external ID now replaces the "None" that a null one left, so
  a later refresh can add a missing IMDb or TVDB ID.
- Watch providers are written in the add-on's order (flatrate, free,
  ads, rent, buy), so a subscription isn't stored as buy-only.
- TMDB server errors that outlast the retries count as an outage, and
  the item goes back in the queue instead of toward failed.
- The free-space check uses the current folder when a database path
  has no folder, instead of skipping the check.
- addon-schema.py keeps the quoted language and country seed rows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LG44gW5bMySbSKFF1ZGDNn

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 83b6a04e35

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/cache/mapper.rs Resolved
Comment thread src/cache/mapper.rs Resolved
All three databases ran WAL with synchronous=OFF, and a forced restart
of the Mac during the full crawl left ItemDetails.db and state.db
malformed. They now use synchronous=NORMAL, which can lose the last
few transactions in a crash but not corrupt the file, plus fullfsync
and checkpoint_fullfsync, because a plain fsync on macOS leaves data
in the drive's cache.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LG44gW5bMySbSKFF1ZGDNn
Ongoing shows, seasons, and episodes expire after 7 days, but the
crawler only requeued items 30 days after their visit. When the seeder
runs, it now also reads the expired rows from ItemDetails.db and puts
those items back in the queue.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LG44gZSSKSAXLazAYpSG4A

Copy link
Copy Markdown
Contributor Author

@codex review


Generated by Claude Code

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3f5ec62390

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/cache/mapper.rs Resolved
Comment thread src/state.rs Resolved
…epth

- A person's filmography wrote a new cast or crew row on every refresh
  when the role or department was blank, because NULL never matches the
  unique key. It now checks for the credit first.
- An item found closer to a seed while it was being fetched kept its
  deeper depth, so its children could be dropped. The writer now reads
  the item's current queue depth before it expands it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LG44gZSSKSAXLazAYpSG4A

Copy link
Copy Markdown
Contributor Author

@codex review


Generated by Claude Code

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 40c5e53778

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/worker.rs Resolved
Comment thread src/images/texture_db.rs Resolved
- With --all-ids, the full exports filled the queue before the popular
  seeds were fetched, so the crawl no longer started with them. The
  popular seeds are now queued at depth 0 before the exports.
- The purge only recognized files downloaded at w1280 when that URL was
  registered, which older builds didn't do for posters, profiles, and
  logos. It now builds the w1280 URL from any registered size.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LG44gZSSKSAXLazAYpSG4A

Copy link
Copy Markdown
Contributor Author

@codex review


Generated by Claude Code

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 2d7f064f9c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@xbmc4lyfe
xbmc4lyfe merged commit d8061c7 into main Nov 5, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant