Download the PHP package detain/phlix-plugin-anilist without Composer
On this page you can find all versions of the php package detain/phlix-plugin-anilist. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download detain/phlix-plugin-anilist
More information about detain/phlix-plugin-anilist
Files in detain/phlix-plugin-anilist
Package phlix-plugin-anilist
Short Description AniList metadata provider for Phlix — anime/manga metadata, watchlist sync, and GraphQL integration.
License MIT
Homepage https://github.com/detain/phlix-plugin-anilist
Informations about the package phlix-plugin-anilist
phlix-plugin-anilist
AniList metadata provider for Phlix — anime metadata and watchlist sync, over the AniList GraphQL API.
Overview
Connects a Phlix server to AniList to enrich your media library with anime metadata:
- Metadata enrichment — fetches titles, descriptions, genres, average scores, and cover images via the AniList GraphQL API.
- Watchlist sync — synchronizes your AniList status lists
(CURRENT/COMPLETED/PLANNING/PAUSED/DROPPED; the rarely-used REPEATING status
is deliberately not synced) back to Phlix: entries are mapped to local items
through the host repository's metadata lookup (
mal_id), and the synced AniList fields are written authoritatively for their own namespace. Host requirement (this leg only): the lookup ships inphlix-servercommitbfd4af98, and no server release tag through v1.2.3 carries it. Release hosts without the hook skip the write-back entirely: the plugin logs a single warning per worker when the skip first fires (once per host, not once per entry) and stays in that mode until the host shipsbfd4af98. Enrichment and progress sync are unaffected. - Episode progress — tracks which episodes you've completed for each series.
- Average score & favourites — surfaces AniList average scores and the community favourites count (how many AniList users favourited a title).
It subscribes to phlix.library.item.added (throttled background enrichment)
and phlix.playback.stopped (episode progress sync). Every AniList feature —
the metadata lookups included — requires both the access token and the AniList
username to be configured: with either one missing, nothing runs (see Settings
below). The master toggle gates every AniList path on top of that: with it off
no periodic sync timer is even armed, and ticks already in flight refuse to
run. The refusal is per-checkpoint, not instantaneous: the gate is re-read at
every sync tick, at every enrichment drain tick, and at every page boundary of
an in-flight watchlist walk — a disable or reconfigure that lands mid-walk
stops the walk before its next page fetch and logs the partial abort, and the
entries the walk already wrote stay written. The event-driven features
(enrichment and progress write-back) and the host-armed list sync behave the
same way.
Install
From the Phlix admin Plugins section, paste this repo's URL:
…or from the CLI:
Settings
Configure these in the Phlix admin Plugins → Configure dialog.
| Setting | Type | Required | Secret | Tier | Default | Description |
|---|---|---|---|---|---|---|
enabled |
boolean | No | No | standard |
false |
Master on/off for AniList sync/matching. |
access_token |
string | No | Yes | standard |
null |
Personal AniList API access token, pasted in by hand. Create one at anilist.co/settings/developer. Phlix does not run an AniList OAuth flow. |
username |
string | No | No | standard |
"" |
Your AniList username. Every AniList feature requires it together with the access token: nothing runs (enrichment included) until both are set. The lists it pulls during sync are addressed by it. |
sync_enabled |
boolean | No | No | advanced |
true |
Sync your watched status and episode progress with your AniList list. |
sync_interval_minutes |
integer | No | No | advanced |
60 |
How often to sync with AniList — per worker process. The host runs a pool of resident workers (~14) and each arms its own sync timer; each tick elects a single syncer per host via a non-blocking flock() on a per-username lockfile inside a private, owner-only (0700) phlix-anilist-<uid> directory under the system temp dir (workers that lose the election skip the tick), and the winner paces its watchlist page-walk at 0.7 s per page. If the election path is unusable the tick fails open — every worker syncs and the multiplication is warned once per enable cycle; set PHLIX_ANILIST_ELECTION_FAIL_CLOSED=1 in the server's environment to skip those ticks instead. See Election lock below. |
auto_match |
boolean | No | No | advanced |
true |
Auto-match anime to AniList entries using the item's MyAnimeList id (mal_id). |
access_tokenis stored in plaintext at rest. The token you paste above is persisted verbatim, unencrypted, in the host's plugin-settings storage (plugins.settings_json) and therefore in every raw database backup and dump — this plugin does not encrypt it. It is never returned to the admin UI (the SPA projection carries only ahas_tokenboolean) and never appears in logs, but anyone with read access to the database or its backups holds a working bearer credential, so protect those accordingly. Encrypting it at rest — precedent: the sibling trakt plugin'sSodiumTokenCipher, keyed by itstoken_encryption_keysetting — is an open owner decision for this plugin.
Election lock
The per-tick single-syncer election (see sync_interval_minutes above) lives
at $(temp)/phlix-anilist-<uid>/phlix-anilist-sync-<sha256(username)>.lock
(<sha256(salt)>-truncated segment appended to the directory name when
PHLIX_ANILIST_LOCK_SALT is set). Rules worth knowing as an operator:
- The directory is created
0700owned by the server's user and lockfiles0600; the plugin refuses to flock a pre-existing file with foreign owner or unexpected mode and says so in the log. Do not run several servers as different users expecting them to share one election — they will not. - Set
PHLIX_ANILIST_LOCK_SALT(any high-entropy string) once in the server's environment — e.g. a systemdEnvironment=line orEnvironmentFile=— never per worker: every forked worker must compute the same path, and a differing salt dissolves the election into full request multiplication. - If the election cannot run (read-only temp dir, planted path), the default
is fail-open: syncing continues (the feature is more important than
the pacing) with a once-per-enable warning naming the directory. To invert
that policy — skip ticks rather than multiply requests — set
PHLIX_ANILIST_ELECTION_FAIL_CLOSED=1. - The lockfile unlinks itself at every release that did not change the
account mid-tick, and
onDisable()sweeps residue: a running install leaves nothing behind in the temp dir between ticks (residue edge: a username reconfigured between acquire and release makes the release unlink the new name — and becauseonDisable()recomputes the lock path from the CURRENT settings, the sweep only names that new one; the old lockfile lingers and is not covered by it. Nothing ever names it again unless the account is reconfigured back, so the operator may remove it by hand; it is harmless once no election uses it, and aPrivateTmp=truehost discards the whole namespace at stop). A host running with systemdPrivateTmp=truekeeps the whole directory in the unit's private namespace, which the kernel discards at stop; on a shared/tmphost an emptiedphlix-anilist-<uid>directory may linger harmlessly and may be removed by the owner at any time.
Uninstall & cleanup
Uninstalling from the admin UI (or php bin/phlix plugin:uninstall) removes
the plugin's plugins row and its settings_json — which contains the
plaintext access_token, so deleting the row deletes the stored credential.
Two classes of data deliberately survive an uninstall:
- *`anilist_
metadata keys already written into media items'metadata_json** —anilist_id,anilist_status,anilist_score,anilist_score_format,anilist_progress. They are plain item metadata (the same shape the MyAnimeList path stores asmal_id), nothing reads them once the plugin is gone, and the plugin never bulk-deletes library data. Removing them is a manual, per-item orUPDATE`-level library cleanup decision for the host operator. - The election lock directory itself (
/tmp/phlix-anilist-<uid>[…]) — lockfiles self-unlink at release andonDisable(), so a clean uninstall leaves at most an empty directory;PrivateTmphosts discard even that. If you configuredPHLIX_ANILIST_LOCK_SALTin an environment file, that file is owner-managed and removed by you, not by the plugin.
Troubleshooting
A pasted token or username is refused ("dirty paste").
A trailing newline from a normal paste is trimmed and accepted. Anything
still dirty after the trim — an interior space, a tab, a control or ANSI
escape sequence carried along with the value — is refused at the settings
boundary: nothing is stored, the plugin reports has_token: false (or an
empty username), and sync stays off until a clean value is saved. Since the
admin UI keeps showing what you pasted, the refusal is announced once per
save with a warning log line naming the refused field
(AniList: stored access_token refused at the settings boundary …); the
warning never echoes the value itself. Self-check: re-paste the token from
the developer page (not from a terminal or chat app that can inject
characters), save, and confirm the warning is gone.
Sync stopped working about a year after setup (expired token).
Phlix does not run AniList's OAuth flow and cannot renew anything: the
personal access token you pasted is a static credential that AniList
expires roughly one year after issue. When it dies, every AniList call
starts failing and the plugin logs warnings such as
AniList: periodic sync failed or AniList: failed to sync status list
each tick, while the settings screen still shows the old (dead) token as
configured. Cure: create a fresh token at
anilist.co/settings/developer,
paste it into access_token, and save — the plugin re-reads settings on
the next configure and rebuilds its client immediately.
Rate limits (HTTP 429) and give-up behavior.
AniList allows roughly 90 requests per minute per client, and any other
service using the same AniList account shares that budget. The plugin
paces itself: enrichment requests are throttled to at most one per second,
the periodic syncer walks list pages at 0.7 s per page, and only one
worker per host is elected (via flock() on the private election lockfile —
see Election lock above) to run each sync tick. A 429
response is retried up to three times — honoring AniList's Retry-After
(clamped to 1–60 s) when present, otherwise backing off exponentially
(2 s, 4 s, 8 s). After the third retry the request gives up loudly:
the caller logs a warning for that operation and the next scheduled tick
retries normally; no sync is marked successful on a given-up request. If
429s persist, raise sync_interval_minutes and check what else is dialing
AniList with the same token.
Development
The entry class is Phlix\Plugins\Metadata\AniList\AniListPlugin (implements
Phlix\Shared\Plugin\LifecycleInterface and
Phlix\Shared\Plugin\ConfigurableInterface). It runs inside a Phlix server host,
which provides the playback/library services at runtime.
License
MIT — see LICENSE.
All versions of phlix-plugin-anilist with dependencies
detain/phlix-shared Version ^0.52.0
ext-mbstring Version *
psr/container Version ^1.1 || ^2.0
psr/log Version ^1.0 || ^2.0 || ^3.0