1 parent
f47217d5a3
commit
8ceb3c8be8
60 files changed
+10884
No files matched your search
@@ -0,0 +1,160 @@
|
||||
# jellymove
|
||||
|
||||
Move movies and TV series between two Jellyfin servers, with their subtitles,
|
||||
artwork, NFOs, extras and everyone's watch history.
|
||||
|
||||
Built for a two-tier setup: a cloud server with fast but limited storage and
|
||||
a home server with slow but large storage, presented as one library by
|
||||
[Jellyswarrm](https://github.com/LLukas22/Jellyswarrm). Pick a film or series
|
||||
in the web UI and send it to the other side. jellymove copies it, checks it,
|
||||
gets the other Jellyfin to index it, carries the watch state across, and only
|
||||
then removes it from the source.
|
||||
|
||||
> **Status: early (v0.1).** The whole move flow works end to end against a
|
||||
> test double of Jellyfin. It has **not yet been run against a real Jellyfin
|
||||
> server**. Try a dry run first, keep backups, and read "Not yet verified" below.
|
||||
|
||||
## How a move works
|
||||
|
||||
One agent runs next to each Jellyfin and sees the same media folders. The
|
||||
**destination pulls**:
|
||||
|
||||
1. **Plan.** The source checks that the item has its own folder, hashes every
|
||||
file (BLAKE3) and records each user's played state, resume points and
|
||||
favourites. The destination picks a library and refuses if the folder
|
||||
already exists. *Dry runs stop here.*
|
||||
2. **Copy.** Files stream into a hidden `.jellymove-partial/` folder inside the
|
||||
destination library. Dropped connections resume from where they stopped,
|
||||
and each file is hash-checked.
|
||||
3. **Promote.** Verified files are renamed into place, an atomic operation on
|
||||
the same filesystem.
|
||||
4. **Index.** The destination asks Jellyfin to scan that folder, then waits
|
||||
until the item and every episode appear.
|
||||
5. **Restore watch history.** Jellyfin gives moved files new item IDs, so
|
||||
jellymove re-applies each user's data to the new items, matching users by name.
|
||||
6. **Clean up.** The source moves its folder to `.jellymove-trash/` in the same
|
||||
library and rescans. It is not deleted.
|
||||
|
||||
A crash or restart at any point resumes from the last completed step.
|
||||
|
||||
## Quick look (no Jellyfin needed)
|
||||
|
||||
```sh
|
||||
npm --prefix ui ci && npm --prefix ui run build
|
||||
cargo run -p jm-server --example demo
|
||||
# open http://127.0.0.1:8097 (cloud) and http://127.0.0.1:8098 (home)
|
||||
```
|
||||
|
||||
## Running it for real
|
||||
|
||||
Install one agent per server. **Mount media at the same paths as the Jellyfin
|
||||
container**, so the paths Jellyfin reports are the paths jellymove sees.
|
||||
|
||||
```sh
|
||||
cp config.example.toml jellymove.toml # edit: node_name, jellyfin.api_key, peer.url, peer.token
|
||||
docker compose -f deploy/docker-compose.yml up -d
|
||||
```
|
||||
|
||||
- Create an admin API key in Jellyfin (Dashboard → API Keys). jellymove reads
|
||||
every user's watch state.
|
||||
- Use the same `peer.token` on both agents (`openssl rand -hex 32`).
|
||||
- The agents talk over HTTP, and **each must be able to reach the other**: the
|
||||
destination pulls, so a move *to* the cloud needs the cloud agent to reach
|
||||
home. Put them on Tailscale/WireGuard (simplest), or behind your reverse
|
||||
proxy with TLS. An outbound-only mode for a home server behind NAT is on
|
||||
the roadmap.
|
||||
- Run the container as the same user as Jellyfin (`user: "1000:1000"`) so
|
||||
moved files keep the right ownership.
|
||||
- Set a UI password (`[ui]`) unless the port is only reachable privately.
|
||||
- The **Status** tab checks that every library folder is visible and writable.
|
||||
|
||||
### Without Docker (systemd)
|
||||
|
||||
Each release has a static Linux binary (x86_64, musl, web UI built in), so it
|
||||
runs on any distro with no other dependencies:
|
||||
|
||||
```sh
|
||||
tar -xzf jellymove-v0.1.0-x86_64-unknown-linux-musl.tar.gz
|
||||
cd jellymove-v0.1.0-x86_64-unknown-linux-musl
|
||||
sudo install -m 755 jellymove /usr/local/bin/jellymove
|
||||
sudo install -D -m 640 -g jellyfin config.example.toml /etc/jellymove/jellymove.toml
|
||||
sudo cp jellymove.service /etc/systemd/system/
|
||||
sudo systemctl daemon-reload && sudo systemctl enable --now jellymove
|
||||
```
|
||||
|
||||
Before starting it, edit `/etc/jellymove/jellymove.toml` and set
|
||||
`data_dir = "/var/lib/jellymove"` (the unit's `StateDirectory`). If Jellyfin
|
||||
runs as a different user, change `User=`/`Group=` in the unit and `-g` above.
|
||||
|
||||
To upgrade, replace `/usr/local/bin/jellymove` and run `sudo systemctl restart jellymove`.
|
||||
Interrupted transfers resume after a restart.
|
||||
|
||||
### Making a release
|
||||
|
||||
`.github/workflows/release.yml` runs on Gitea Actions. To cut a release, bump
|
||||
`version` in the root `Cargo.toml`, commit, then push a matching tag:
|
||||
|
||||
```sh
|
||||
git tag v0.1.1 && git push origin v0.1.1
|
||||
```
|
||||
|
||||
The workflow runs the tests, builds the UI and binary, and attaches the
|
||||
tarball and its `.sha256` to a Gitea release for that tag. Re-running it
|
||||
replaces the files. Tags with a `-` (`v0.2.0-rc1`) are marked pre-release.
|
||||
|
||||
### Library mapping
|
||||
|
||||
By default an item goes into the library with the same name on the other
|
||||
server. To file things elsewhere, configure this on the **receiving** agent:
|
||||
|
||||
```toml
|
||||
[incoming_libraries]
|
||||
"Movies" = "Movies (archive)"
|
||||
```
|
||||
|
||||
### Jellyswarrm
|
||||
|
||||
While a move is running the item exists on both servers, and Jellyswarrm
|
||||
v0.3.1+ shows it once with two versions. Jellyswarrm's merge cache can go stale
|
||||
when files move ([#216](https://github.com/LLukas22/Jellyswarrm/issues/216)).
|
||||
Until that is fixed upstream, a post-move hook can restart it:
|
||||
|
||||
```toml
|
||||
[hooks]
|
||||
post_move = "docker restart jellyswarrm"
|
||||
```
|
||||
|
||||
## Safety rules
|
||||
|
||||
- Nothing leaves the source until the destination has indexed every file.
|
||||
- The source copy goes to `.jellymove-trash/`. Empty it yourself once you're
|
||||
happy (automatic retention is on the roadmap).
|
||||
- Nothing at the destination is ever overwritten.
|
||||
- A movie must be in **its own folder**. jellymove refuses flat folders like
|
||||
`Movies/Heat.mkv` + `Movies/Ronin.mkv`, because moving "the folder" would take both.
|
||||
- Peers can only fetch files the source has explicitly exported, by index.
|
||||
|
||||
## Not yet verified
|
||||
|
||||
- Against real Jellyfin, in particular user-data writes
|
||||
(`POST /UserItems/{id}/UserData`), `/Library/Media/Updated` timing on large
|
||||
libraries, and multi-version movies.
|
||||
- Against real Jellyswarrm.
|
||||
- The Docker image build (the Dockerfile is written but untested here).
|
||||
- Windows and macOS. The code is cross-platform, but only Linux has been run.
|
||||
|
||||
## Roadmap
|
||||
|
||||
- Season-level moves; "promote" (pre-warm) shortcuts
|
||||
- Trash retention and a trash view in the UI
|
||||
- Pairing codes and pinned TLS instead of a shared token
|
||||
- Outbound-only control channel so a NATed home agent needs no inbound port
|
||||
- Automatic tiering rules ("demote anything unwatched for 90 days when the cloud disk is over 80%")
|
||||
- Sonarr/Radarr root-folder updates so the *arrs follow the move
|
||||
- iroh transport (built-in NAT traversal); scheduled bandwidth windows
|
||||
- `jellymove service install` (systemd/launchd/Windows service)
|
||||
|
||||
## Development
|
||||
|
||||
See [CLAUDE.md](CLAUDE.md) for layout, commands and invariants, and
|
||||
[docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) for the design.
|
||||
Reference in new issue
Block a user