Add TMDB metadata client and Fetch Data: real episode titles/air dates via TMDB, with a Settings modal for the API token

This commit is contained in:
Renamr Scaffold
2026-08-29 03:01:19 +00:00
parent bab9bfa1ec
commit d1fc4039a7
12 changed files with 1231 additions and 27 deletions
+48 -21
View File
@@ -6,11 +6,12 @@ fork), built from scratch as its own project: new stack, new architecture, new b
**Status: early scaffold, but the core loop works end to end.** The naming-expression
engine is ported and tested, the faithfully-recreated two-pane UI is wired to real
native file/folder loading and drag-and-drop, local filename-based season/episode
detection ("Match") is working, and the actual on-disk rename operation is wired up
(same-directory rename, skip-on-conflict, with a confirmation step showing the full
old-name/new-name plan before anything touches disk — there is no undo yet). Full
media-metadata bindings, the fuzzy similarity/matching engine, and online metadata
lookups are not yet ported. See "Porting roadmap" below.
detection ("Match") is working, real online metadata lookups against TMDB ("Fetch
Data") are working, and the actual on-disk rename operation is wired up (same-directory
rename, skip-on-conflict, with a confirmation step showing the full old-name/new-name
plan before anything touches disk — there is no undo yet). Full media-metadata
bindings and the fuzzy similarity/matching engine are not yet ported. See "Porting
roadmap" below.
## Why a rewrite, and why this stack
@@ -50,19 +51,24 @@ translate directly.
```
crates/renamr-core/ Pure Rust core: naming-expression engine (ported), local
filename-based season/episode matching (ported, `matching/`), and
the on-disk rename engine (ported for the same-directory case,
filename-based season/episode matching (ported, `matching/`), a
TMDB metadata client (`web/tmdb.rs` — TV search + episode lookup,
tested against a mocked HTTP server via `mockito`), and the
on-disk rename engine (ported for the same-directory case,
`rename/`) — skip-on-conflict, no move/organize-into-folders yet.
Not yet ported: the fuzzy similarity engine, full media metadata
bindings, web datasource clients (TMDB/TVDB/AniDB/etc). No Tauri
bindings, other web datasource clients (TVDB/AniDB/etc). No Tauri
dependency, so it builds and unit-tests standalone.
src-tauri/ Tauri app shell: exposes renamr-core as commands to the frontend
(naming-scheme rendering, filename matching, executing a rename
plan, native file/folder dialogs, drag-and-drop expansion), app
metadata/icons/window config (tauri.conf.json).
(naming-scheme rendering, filename matching, TMDB metadata fetch,
executing a rename plan, native file/folder dialogs, drag-and-drop
expansion), plus `settings.rs` (TMDB token, stored as JSON in the
OS app-config directory), app metadata/icons/window config
(tauri.conf.json).
src/ React + TypeScript UI (Vite). Faithful recreation of the original
two-pane rename screen (Aurora theme) wired to real file loading,
drag-and-drop, live naming-scheme preview, local matching, and a
drag-and-drop, live naming-scheme preview, local matching, TMDB
fetch (behind a Settings modal for the API token), and a
confirm-before-touching-disk modal for the actual rename.
scripts/gen_icons.py Regenerates src-tauri/icons/ (placeholder branding — swap the
colors/glyph in the script, or replace the icons directly, to
@@ -89,11 +95,24 @@ npm run tauri build
```
Verified in the environment this was built in: `cargo test -p renamr-core` (all
passing), `cargo check -p renamr` (compiles clean against real Tauri + GTK/WebKit
system libraries), and `npm run build` (TypeScript type-checks, Vite bundles). The
actual GUI window has **not** been visually verified anywhere yet — that sandbox has no
display. Run `npm run tauri dev` on your machine to see and click through it for the
first time.
passing, including the TMDB client tests — those run against a local mock HTTP server
via `mockito`, no live network or API key needed to build/test), `cargo check -p
renamr` (compiles clean against real Tauri + GTK/WebKit system libraries), and `npm run
build` (TypeScript type-checks, Vite bundles). The actual GUI window has **not** been
visually verified anywhere yet — that sandbox has no display. Run `npm run tauri dev`
on your machine to see and click through it for the first time.
### Setting up TMDB (for "Fetch Data")
Everything else in the app works fully offline; "Fetch Data" is the one feature that
needs a (free) [TMDB](https://www.themoviedb.org/) account:
1. Create a TMDB account, then go to Settings → API in your account and generate an
**API Read Access Token** (not the older numeric "API Key" — Renamr uses the Bearer
token method TMDB documents as the default).
2. In the app, click the key icon ("TMDB Settings") next to Fetch Data and paste the
token in. It's saved locally in the OS app-config directory and only ever sent to
`api.themoviedb.org`.
## Porting roadmap (not yet done)
@@ -111,13 +130,21 @@ ported from, for anyone picking this up:
3. **Matching/similarity engine** — `net.filebot.similarity.*`. Local filename-based
season/episode detection is done (`crates/renamr-core/src/matching`, ported from the
pattern-matching half of `SeasonEpisodeMatcher.java`, adapted to Rust's `regex` crate
which lacks lookahead/lookbehind — wired to the "Match" button). Still not ported:
`EpisodeMetrics.java` (849 lines, the fuzzy title-matching score cascade used once
there's an actual metadata source to score candidates against) and `DateMatcher`.
which lacks lookahead/lookbehind — wired to the "Match" button). Now that TMDB is
wired up (see item 5 below), `EpisodeMetrics.java` (849 lines, the fuzzy title-matching
score cascade) is the next thing this actually blocks on: today "Fetch Data" just
takes TMDB's first (TMDB-ranked) search result, which is right most of the time but
has no way to catch a wrong pick among several similarly-named shows. `DateMatcher`
also still not ported.
4. **Media detection** — `net.filebot.media.MediaDetection` (1356 lines): ties file-name
parsing + matching together to auto-identify what a file is.
5. **Web datasource clients** — `net.filebot.web.*` (~40 files): TheMovieDB, TheTVDB,
AniDB, OMDb, TVmaze, OpenSubtitles, etc. Use `reqwest` + `serde_json`/`serde`.
AniDB, OMDb, TVmaze, OpenSubtitles, etc. TMDB is done for TV (`crates/renamr-core/src/web/tmdb.rs`,
`reqwest` + `serde_json`, Bearer-token auth) — search-by-name plus per-season episode
lookup, wired to "Fetch Data". Picks the first (TMDB-ranked) search result rather
than disambiguating between multiple plausible shows — a real fix needs the
`EpisodeMetrics` fuzzy-matching port above. TMDB movie lookup and all other sources
(TheTVDB, AniDB, OMDb, TVmaze, OpenSubtitles) are not yet started.
6. **Rename engine + CLI** — `net.filebot.cli.CmdlineOperations` (1235 lines) and
`ArgumentBean` (415 lines, the full flag surface: `-rename`, `--db`, `--format`,
`--action`, `--conflict`, `-get-subtitles`, `-script`, etc.). The core same-directory