114 lines
6.0 KiB
Markdown
114 lines
6.0 KiB
Markdown
# Renamr
|
|||
|
|
|
||
|
|
A fast, cross-platform media renamer — a ground-up rewrite of FileBot (via its FB-Mod
|
||
|
|
fork), built from scratch as its own project: new stack, new architecture, new branding.
|
||
|
|
|
||
|
|
**Status: early scaffold.** The naming-expression engine is ported and tested; the
|
||
|
|
matching engine, media metadata parsing, web datasource clients, rename engine, and the
|
||
|
|
real UI are not yet ported. See "Porting roadmap" below.
|
||
|
|
|
||
|
|
## Why a rewrite, and why this stack
|
||
|
|
|
||
|
|
The original is a ~20k+ line Java/Swing app built with Ant. The goals were: faster
|
||
|
|
startup and UI, faster matching/renaming, a codebase that's actually pleasant to work
|
||
|
|
in, and a genuine rebrand — not a coat of paint.
|
||
|
|
|
||
|
|
Renamr is **Tauri**: a Rust core (`crates/renamr-core`, `src-tauri`) plus a
|
||
|
|
TypeScript/React frontend (`src`), compiled to a small native binary per platform
|
||
|
|
(Windows/macOS/Linux) with a system webview instead of shipping a bundled browser
|
||
|
|
engine. That's the concrete "faster" win over both the original JVM/Swing app and
|
||
|
|
an Electron-style rewrite: quick cold start, small binary, real OS-native windowing.
|
||
|
|
|
||
|
|
An earlier attempt used Kotlin + Compose Multiplatform to stay on the JVM and reuse
|
||
|
|
FileBot's Java logic directly. That was abandoned (nothing was salvaged into this repo)
|
||
|
|
after discovering the sandbox this was originally built in blocks Maven Central and the
|
||
|
|
Gradle Plugin Portal, making it impossible to compile or test. Tauri was chosen as the
|
||
|
|
replacement because both halves — Cargo via crates.io, npm via the public npm registry
|
||
|
|
— are reachable, so every piece described as "done" below is actually compiled/tested,
|
||
|
|
not just written and hoped for.
|
||
|
|
|
||
|
|
### Compatibility notes
|
||
|
|
|
||
|
|
Goal: keep CLI flags, config file locations, and the *outer* `{ }` naming-scheme
|
||
|
|
template syntax compatible with FileBot conventions, so existing automation mostly
|
||
|
|
keeps working.
|
||
|
|
|
||
|
|
One deliberate gap: FileBot's `{ }` expressions ran arbitrary **Groovy** code
|
||
|
|
(JVM-only). Renamr's Rust core has no Groovy engine, so expressions are evaluated with
|
||
|
|
[Rhai](https://rhai.rs/) instead. Simple bindings (`{n}`, `{s00e00}`, `{t}`) are
|
||
|
|
identical. More complex chained-method expressions will need small syntax tweaks
|
||
|
|
(e.g. Groovy's `.toUpperCase()` → Rhai's `.to_upper()`) — Rhai already ships most of the
|
||
|
|
common string/array methods FileBot's expression helpers wrapped, so most patterns
|
||
|
|
translate directly.
|
||
|
|
|
||
|
|
## Project layout
|
||
|
|
|
||
|
|
```
|
||
|
|
crates/renamr-core/ Pure Rust core: naming-expression engine (ported), and — not yet
|
||
|
|
ported — matching/similarity scoring, media metadata parsing,
|
||
|
|
web datasource clients (TMDB/TVDB/AniDB/etc), the rename engine.
|
||
|
|
No Tauri dependency, so it builds and unit-tests standalone.
|
||
|
|
src-tauri/ Tauri app shell: exposes renamr-core as commands to the frontend,
|
||
|
|
app metadata/icons/window config (tauri.conf.json).
|
||
|
|
src/ React + TypeScript UI (Vite). Currently a single proof-of-concept
|
||
|
|
screen wired to the live naming-expression preview.
|
||
|
|
scripts/gen_icons.py Regenerates src-tauri/icons/ (placeholder branding — swap the
|
||
|
|
colors/glyph in the script, or replace the icons directly, to
|
||
|
|
change the look).
|
||
|
|
```
|
||
|
|
|
||
|
|
## Building
|
||
|
|
|
||
|
|
Prerequisites: Rust (stable) + Cargo, Node.js 18+, and Tauri's platform prerequisites
|
||
|
|
(see https://v2.tauri.app/start/prerequisites/ — on Linux this means
|
||
|
|
`libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev` and a C
|
||
|
|
toolchain; macOS/Windows need Xcode / the VS Build Tools + WebView2 respectively).
|
||
|
|
|
||
|
|
```sh
|
||
|
|
# Rust core (no UI deps needed):
|
||
|
|
cargo test -p renamr-core
|
||
|
|
|
||
|
|
# Full app in dev mode (opens a native window):
|
||
|
|
npm install
|
||
|
|
npm run tauri dev
|
||
|
|
|
||
|
|
# Production build (installer/bundle for your current OS):
|
||
|
|
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.
|
||
|
|
|
||
|
|
## Porting roadmap (not yet done)
|
||
|
|
|
||
|
|
Roughly in priority order — each references the original FileBot source file it's
|
||
|
|
ported from, for anyone picking this up:
|
||
|
|
|
||
|
|
1. **Full naming-scheme bindings** — `net.filebot.format.MediaBindingBean` (1354 lines):
|
||
|
|
all the `{n}`, `{s00e00}`, `{airdate}`, `{vf}` (video format), etc. binding
|
||
|
|
properties. Currently only whatever bindings you pass in manually are available.
|
||
|
|
2. **String/expression helper methods** — `net.filebot.format.ExpressionFormatMethods`
|
||
|
|
(636 lines): FileBot-specific Groovy string extensions like `.pad()`, `.sortName()`.
|
||
|
|
Only a small subset (`any`, `all_of`, `concat`) is ported so far
|
||
|
|
(`crates/renamr-core/src/format/functions.rs`); Rhai's built-ins cover some of the
|
||
|
|
rest already.
|
||
|
|
3. **Matching/similarity engine** — `net.filebot.similarity.*`, especially
|
||
|
|
`EpisodeMetrics.java` (849 lines, the core fuzzy-matching score cascade) and
|
||
|
|
`SeriesNameMatcher`/`SeasonEpisodeMatcher`/`DateMatcher`.
|
||
|
|
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`.
|
||
|
|
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.) — flags are catalogued
|
||
|
|
in project notes but not yet implemented against real logic.
|
||
|
|
7. **Real UI** — file browser / drag-drop, rename preview table, settings, subtitle
|
||
|
|
panel. Current `src/App.tsx` is a single proof-of-concept screen.
|
||
|
|
8. **Packaging** — code signing, auto-update, installers per platform via
|
||
|
|
`npm run tauri build`.
|