- Rust 66.1%
- QML 21.9%
- C++ 5.4%
- Shell 3.7%
- CMake 1.1%
- Other 1.8%
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019Nptk3vFpRrg7ZM269hN5f |
||
|---|---|---|
| .forgejo/workflows | ||
| android | ||
| cmake | ||
| crates | ||
| fdroid | ||
| linux | ||
| release-notes | ||
| scripts | ||
| src | ||
| third_party | ||
| web | ||
| windows | ||
| .gitignore | ||
| Cargo.lock | ||
| Cargo.toml | ||
| CMakeLists.txt | ||
| LICENSE | ||
| README.md | ||
| rustfmt.toml | ||
anime-center
A small, calm media center for anime (and anything else organised the same way). It works from the files: no scraper, no file database. What's on disk is what you see; the only thing stored is which episodes you watched, so renaming or deleting files never leaves stale entries behind.
Runs on Linux, Windows and Android (phones, tablets and Android TV), with keyboard/remote and touch both supported.
Libraries
A library is a folder with one subfolder per show:
Anime/
4-nin wa Sorezore Uso wo Tsuku/
meta.json optional
cover.jpg optional, any image type (sniffed, not by extension)
fanart.jpg optional background artwork
tvshow.nfo optional, Kodi format, read-only
4-nin wa Sorezore Uso wo Tsuku S01E01.mkv
…
Some Show/
Season 1/ … seasons are optional; meta.json and covers
may also live in the first season folder
Specials/ … any other folder is a section of its own,
OVA/ … under its name, with its own meta.json,
cover and AniList link
Another Show/
Another Show/ … one folder per season, named after it
Another Show Second Arc/ … (after any Season N folders, in name order)
Kimi no Na wa (2016)/ a movie: a folder with one video
Kimi no Na wa (2016).mkv
Kimi no Na wa (2016).nfo optional, Kodi <movie>; or movie.nfo
Kimi no Na wa (2016)-poster.jpg optional; or poster.jpg
Kimi no Na wa (2016)-fanart.jpg optional; or fanart.jpg
Every subfolder with videos other than Season N is a section of its own:
listed under its name after the seasons (Specials/, OVA/ and the like
after the others, Extras/ last), with its own watch state, and it can be
linked to an AniList entry of its own like a season. All of a folder's
videos belong to it, whatever their names say; extras (NCOP, PV…) don't
count towards progress. "Continue" goes through the sections with regular
episodes, not through specials and extras.
Renaming or reordering season folders keeps their watch state where the
app can tell them apart: by the AniList (or other) id in their meta.json,
else by their name. A folder renamed without a meta.json can't be told
from a new one and starts unwatched; one that goes missing has its state
put aside until it's back.
Libraries can live on:
| Kind | Location |
|---|---|
| Folder | a local path (Android: needs "All files access") |
| WebDAV | https://host/path (Basic auth) |
| SMB | smb://host[:port]/share/path (SMB 2/3, NTLM) |
| NFS | nfs://host[:port]/export/path[?mountport=N&uid=N&gid=N] (NFSv3) |
NFS has no sign-in: the server goes by user and group IDs. Like a mount,
the app uses yours (with your groups) on Linux; on Android and Windows,
which have none to offer, 65534 ("nobody"). The library form has fields to
set them (the URL's uid and gid), e.g. to a user that may write
meta.json and covers into the share.
SMB without a user name logs in as guest. Servers that map unknown users
to guest (Samba's map to guest = Bad User, the default on OpenMediaVault)
do the same for a user they don't know, so a typo in the user name can
still reach a guest-readable share. Guest sessions aren't signed: there is
no key to sign with.
Network shares are accessed by the app itself (pure Rust clients), not
through OS mounts, and mpv reads videos through the same code (acvfs://).
Their listings and metadata are cached, so a library shows up instantly (and
while the server is offline) and is refreshed in the background; covers are
kept as thumbnails. Libraries (of any kind) are read when first shown and
again every ten minutes, not on every return to the library page; a show
is read anew when it's opened. The cache lives in the platform cache directory and can
be deleted at any time.
A folder containing a .ignore or .nomedia file is skipped, with
everything in it: a show folder disappears from the library, a season or
other subfolder from its show.
Metadata
meta.json(written by external tools): title, description (HTML), genres, tags,myScore, andsource/id/linksthat identify the show, so watch history survives renaming the folder.- Kodi
tvshow.nfoand per-episode.nfofiles are read if present, and for moviesmovie.nfoor the video's own.nfo(title, plot, genres, tags, ids; ananilistid links it to AniList). - Without either, the folder name is the title and the identity.
Library views
The library page lists the shows you are watching (at least one episode
watched, not finished; most recently watched first). Filters switch to continue
(a season finished, the next not started yet; also most recently watched
first), rewatching (on AniList, see below), new (unwatched), completed, dropped (on AniList), or all shows; the choice is remembered. Filters
without shows are hidden, and while the chosen one has none, all shows are
listed. Each cover
shows watched/total episodes, counting regular episodes and specials
(not openings, endings or other extras), "2 new" when episodes were
added since the show was last opened, and "R18" for shows for adults
("isAdult": true in meta.json, from AniList). Typing (or the Search button)
searches the whole library by title.
Profiles
Watch state belongs to profiles (name and optional picture), picked with the avatars in the upper left. Several profiles can be active at once to watch together: marking episodes and playback progress then count for each of them. Where they differ, covers show each one's progress and episodes show who watched them; "Continue" and resuming go by whoever is furthest behind. A show is under Watching if any of them is part-way through it (an episode played for over a minute counts), under Rewatching if any of them is rewatching it on AniList, under Continue if any of them finished a season and hasn't started the next (and didn't drop one on AniList; a season linked to AniList in parts counts each part as a season of its own), under New if any of them hasn't started it, Completed when all have finished it, and Dropped only when all of them dropped it on AniList.
A profile picture can be a file (not on Android TV, which has no file
picker), an image from a .pictures folder at a library's root or from
the app's own pictures folder (on Linux
~/.local/share/anime-center/pictures), or a show's cover. With a remote,
OK on a text field opens the on-screen keyboard (on a TV, in a text
dialog: TVs don't bring the keyboard up for the app's own fields).
AniList
- Metadata: shows (or season folders) whose
meta.jsonlinks to AniList get missing fields and a missing cover filled in from AniList. Opening a show asks AniList again (at most once a minute) and patches what changed there (title, description, source, cover URL, genres, tags) into its and its seasons'meta.json; every other property stays as it is, in its place. "Link to AniList…" in a show's menu searches AniList and writesmeta.jsonfor the show or the selected season, and fetches the cover. AniList splits some seasons into parts with entries of their own ("Part 2") where a release has them in one folder: when a folder has more episodes than its entry (episodesinmeta.json), "Link part 2 to AniList…" writesmetap2.jsonnext to it, with the episodes before it asoffset, and its cover ascoverp2.*, and so on. Pointing at an episode of such a part (hovering it, or selecting it with the keys) shows that part's title, description and cover. Seasons that only the file names tell apart (S02E01next toS01E01, no season folders) keep theirs in the show folder by number:metas2.jsonandcovers2.*for season 2,metas2p2.jsonfor its part 2 (season 1 ismeta.json, as for the show). Progress goes to each part's entry by position, and never past an entry's episode count: episodes no linked part covers are only marked here. Libraries that can't be written to (read-only shares and folders) keep new files in the app's data folder instead, with the reason in Activity; once the library takes them, they are moved there. A file the library has itself is never copied into the app, though: its updates are skipped there (said once in Activity), so it doesn't fork and changes made to it elsewhere keep showing. - Accounts: each profile can connect an AniList account (in the
profile's settings; the browser opens AniList's sign-in, which returns
through a static page, see web/README.md, to the app on
127.0.0.1). Devices without a browser, like TVs, show a QR code to sign in on a phone on the same network instead ("Sign in on another device" everywhere else). The first time, the account's list is fetched and each linked show takes over the progress from it. After that, the list is fetched again at every start of the app (one request per account), so what was watched elsewhere shows up, and a show is checked again when it's opened; both only ever add. "Sync now" (in the profile's settings) fetches the whole list again and takes over its progress for every linked show, also for shows taken over before, and sends what is further here than there (not for entries dropped there). Watching adds to the list there: progress up to the furthest watched episode, completed at AniList's episode count. It never counts down and never touches a completed entry. Changes wait in a queue while offline. Shows (or seasons) dropped on the list are under Dropped instead of Watching, until watching goes on past them. - Rewatching: an entry set to rewatching on AniList starts over here: its progress there replaces what was watched before (episodes watched here since it last changed there stay). It's listed under Rewatching until it's through; episodes not watched again yet show "Watched before". Watching goes on as usual, and finishing it completes the entry on AniList and counts the rewatch.
- Rate limits: all requests go through one queue, paced below AniList's announced limit (30 requests a minute at the moment), with searches before list updates before background work.
Audio and subtitles
Episodes start with the audio and subtitles last picked for that show (found again by language and name, so it works across files that order their tracks differently). Shows without a pick use the languages set under Libraries → Playback; subtitles for signs and songs only are skipped unless there's nothing else in that language.
Activity
Nothing pops up while the app works in the background. A library
refreshing from the network shows how many of its folders it has looked
at. "Activity" (on the Libraries page) lists what happened: library
updates and what changed, AniList sign-ins, list updates and progress
taken over, and problems. The last 500 events are kept in activity.log
in the app's data folder.
Background artwork
Pages show faint, slowly changing background images:
- the library page cycles through the images in a
.backgroundsfolder at the library's root (shared by every device using the library), in the app's ownbackgroundsfolder (on Linux~/.local/share/anime-center/backgrounds), and the shows' fanart; - a show page shows the show's fanart (
fanart.*,background.*orbackdrop.*, as written by Kodi scrapers) if it has one, else the images of those two folders.
File names
Episodes are recognised by a list of patterns (S01E02, 1x02,
Episode 2, 第2話, fansub style Show - 02v2 [CRC], specials like OVA,
SP1, extras like NCOP), with a fallback that compares sibling file names
to find the episode number. To support a new naming scheme, add a line to
crates/core/tests/fixtures/filenames.tsv and, if needed, a pattern to
crates/core/src/parse/patterns.rs.
Building
Requirements: Rust (stable), Qt 6.5+ (developed with 6.11), CMake 3.24+, Ninja, libmpv.
Linux
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release
cmake --build build
./build/anime-center
libmpv comes from pkg-config (mpv-devel / libmpv-dev). Tests:
cargo test; the network tests in crates/core/tests/remote_vfs.rs start
rclone, smbd and unfsd when installed and skip otherwise.
AppImage
podman run --rm -v "$PWD:/src" -v anime-center-cache:/root/.cache -w /src \
docker.io/library/debian:bookworm scripts/build-appimage.sh
Builds build-appimage/anime-center-x86_64.AppImage in Debian 12, so it
runs on distributions with glibc 2.36 or newer (Debian 12, Ubuntu 22.10+,
Fedora 37+, current Arch and openSUSE). It bundles Qt, libmpv and FFmpeg;
the system provides the graphics stack, fonts, ALSA and PipeWire.
Android
export ANDROID_SDK_ROOT=… ANDROID_NDK_ROOT=… JAVA_HOME=…
export QT_ROOT=~/Qt/6.11.2 # with gcc_64 and android_* for each ABI
scripts/build-android.sh arm64-v8a # or armeabi-v7a, x86_64
The script downloads prebuilt libmpv (from mpv-android, via Maven Central,
checksum-verified), builds, and signs the APK with KEYSTORE/KEYSTORE_PASS/
KEY_ALIAS, or a local debug key. Needs the Rust target
(aarch64-linux-android, armv7-linux-androideabi or
x86_64-linux-android). Each ABI gets its own APK and versionCode
(the version as MMMmmmppp followed by an ABI digit), so devices that can
run several pick the 64-bit one.
Debugging aid: adb shell "setprop debug.animecenter.env 'QSG_INFO=1;QT_LOGGING_RULES=qt.*=true'"
sets environment variables for the next app start.
Windows (cross-compiled on Linux)
scripts/build-windows.sh
No Windows machine is needed: the script cross-compiles with llvm-mingw
(Clang for MinGW, also used for the Rust part via
x86_64-pc-windows-gnullvm) against Qt's own llvm-mingw build of Qt for
Windows, and only runs windeployqt.exe under Wine. Everything it needs
(llvm-mingw, Qt for Windows, libmpv, and a Linux host Qt unless
QT_HOST_PATH points at one) is downloaded once into
~/.cache/anime-center-build/windows. The result is
build-windows/dist/ and build-windows/anime-center-windows-x64.zip.
Requirements: cmake, ninja, python3, 7z, curl, wine and rustup.
Long paths work regardless of the system's LongPathsEnabled setting:
local videos are read through the app.
Windows programs have no console to log to; set ANIME_CENTER_LOG to a
file path to get Qt's messages there and mpv's log in <path>.mpv (works
on every platform). To try the build under Wine:
wine build-windows/dist/anime-center.exe (playback works, decoding in
software).
CI
.forgejo/workflows/build.yml builds and tests on Linux, cross-builds
Windows and builds the arm64 APK on every push, each in a plain Debian
container using the scripts above. The Linux job also lints the QML with
scripts/qmllint.sh (any warning fails; run it after a local build, it
needs that build's Qt). runs-on: docker must match a runner
label mapped to Docker/Podman containers, e.g. in the forgejo-runner
config.yml:
runner:
labels:
- "docker:docker://debian:trixie"
container:
docker_host: "unix:///run/podman/podman.sock"
Releases
The version lives in Cargo.toml (workspace.package.version). Every
release has notes in release-notes/:
<version>.md: what changed, for the release page (Markdown).<version>.fdroid.txt: the same in short, at most 500 characters, for F-Droid's "What's new" (plain text).
Notes changed on master later reach the release page of their version by
themselves (.forgejo/workflows/release-notes.yml).
To release, write those, bump the version, commit, and push an annotated tag:
git tag -a v0.2.0 -m "Release 0.2.0" && git push origin v0.2.0
CI then builds the Windows zip, the AppImage and signed APKs for arm64-v8a, armeabi-v7a and x86_64, publishes them as a Forgejo release with the notes (or, without a notes file, the tag message) and regenerates the F-Droid repository from the newest three releases, with each version's short notes as its changelog.
Keys
Both keys are permanent: Android refuses updates signed with a different app key, and F-Droid clients pin the repository key. Keep offline backups.
# App signing key (one password for keystore and key)
keytool -genkeypair -keystore anime-center-release.p12 -storetype PKCS12 \
-alias anime-center -keyalg RSA -keysize 4096 -validity 36500 -dname "CN=anime-center"
# F-Droid repository key
keytool -genkeypair -keystore fdroid-repo.p12 -storetype PKCS12 \
-alias fdroid -keyalg RSA -keysize 4096 -validity 36500 -dname "CN=fdroid.fagott.pw"
Secrets (repository settings → Actions → Secrets)
| Secret | Value |
|---|---|
ANDROID_KEYSTORE_BASE64 |
base64 -w0 anime-center-release.p12 |
ANDROID_KEYSTORE_PASS |
its password |
ANDROID_KEY_ALIAS |
anime-center |
FDROID_KEYSTORE_BASE64 |
base64 -w0 fdroid-repo.p12 |
FDROID_KEYSTORE_PASS |
its password |
FDROID_KEY_ALIAS |
fdroid |
FDROID_DEPLOY_TARGET |
rsync destination, e.g. deploy@fdroid.fagott.pw:/srv/fdroid/repo/ |
FDROID_SSH_KEY |
private SSH key allowed to write there |
FDROID_KNOWN_HOSTS |
ssh-keyscan fdroid.fagott.pw |
RELEASE_TOKEN |
optional: access token with write:repository, if the job's own token may not create releases |
Without the F-Droid secrets the release is still published; the repository is just not built or uploaded.
F-Droid repository
scripts/fdroid-repo.sh builds it from the release APKs with
fdroidserver; app metadata is in fdroid/. The web server only has to
serve the uploaded directory as https://fdroid.fagott.pw/repo (and needs
rsync for the upload). Users add the repository with the link on its
index.html page, which carries the key fingerprint, or by URL plus the
fingerprint from keytool -list -v -keystore fdroid-repo.p12 (SHA-256,
without colons).
Notes
- HTTPS servers are trusted if their certificate chains to a public or system root (including CAs you installed on Linux/Windows). Self-signed certificates (typical for a NAS) can be trusted individually when adding the library or via "Check"; the app then pins exactly that certificate and warns if it changes.
- NFS exports must have the
insecureoption: Linux NFS servers otherwise only accept clients on privileged ports, which an app can't use (e.g./store/anime 192.168.1.0/24(ro,insecure)in/etc/exports, thenexportfs -ra). - Passwords for network libraries are kept in the system's password store:
the Secret Service (GNOME Keyring, KWallet) on Linux, the Credential
Manager on Windows. On Android they are encrypted with a key in the
Android keystore. Passwords from earlier versions move there on the first
start. Without a password store (a Linux desktop without a secret
service), they stay in plain text in
libraries.tomlin the app's config directory. - The Android emulator's OpenGL ES emulation draws Qt Quick rectangles and
images with half their triangles missing (with any
-gpumode tried); Vulkan renders correctly there, but mpv needs OpenGL. Test on a device.
License
GPL-3.0-or-later, see LICENSE. Release builds bundle Qt (LGPL-3.0),
libmpv and FFmpeg (GPL builds) and their dependencies, under their own
licenses.