You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Add incremental scheduler (#43)
* feat(update-cache): incremental updates — add last_updated, TTL, and isStale; update only stale/missing entries; add tests and utils
* docs(env): unify cache TTL env var to CACHE_TTL (seconds), remove duplicate vars
* feat: replace JSON file cache with SQLite persistent storage (#44)
* Add filmaffinity rating badges to posters image overlay (#45)
* feat(ui): add poster badge in films and series when you starts service schedule in docker
* fix: now download badge of series correctly and add schedule script for compose
The `docker-compose.yml` includes a `scheduler` service that performs an initial full library cache population by running `node src/scripts/updateCache.js` on startup, then runs the same update once per day. The scheduler shares the `./data` volume so the generated `data/ratings.json` is persisted and available to the API container.
101
-
102
-
You can control the interval with the `SLEEP_SECONDS` environment variable (default `86400` seconds = 24h). To run the scheduler with Docker Compose:
98
+
Run scheduler only:
103
99
104
100
```bash
105
101
docker compose up -d scheduler
106
102
```
107
103
108
-
Or start the full stack (API + scheduler):
104
+
The scheduler runs `updateCache` and then `sync-jellyfin` on startup and each cycle, so poster badges are updated automatically when enabled.
105
+
It is implemented in `scripts/scheduler.js` and can force the first sync pass on startup to fill missing poster badges.
106
+
107
+
Run full stack:
109
108
110
109
```bash
111
110
docker compose up -d
112
111
```
113
112
114
-
115
113
---
116
114
117
115
## 🔗 Integrations
@@ -121,168 +119,71 @@ This service is designed to work with:
121
119
* Jellyfin
122
120
* Jellyseerr
123
121
124
-
Future integrations may include:
125
-
126
-
* Kodi
127
-
* Plex
128
-
129
122
---
130
123
131
-
## 🔌 Jellyfin integration (client)
132
-
133
-
This project includes a reusable Jellyfin API client at [src/services/jellyfinClient.js](src/services/jellyfinClient.js). The client is configurable via constructor options or environment variables and supports both API key header auth and query-based `ApiKey` authentication.
-`JELLYFIN_BASE_URL`: base URL of your Jellyfin server (e.g. `http://192.168.1.31:8096`)
140
-
-`JELLYFIN_API_KEY`: Jellyfin API key
141
-
-`JELLYFIN_TIMEOUT`: request timeout in milliseconds (optional)
142
-
-`JELLYFIN_AUTH_MODE`: authentication mode (`auto`|`header`|`query`) — default is `auto`
132
+
Required env vars:
143
133
144
-
### Jellyfin configuration via environment variables
145
-
146
-
You can configure the Jellyfin integration purely via environment variables. The application validates required values and will fail with a clear message if they are missing when strict validation is used (for example by scripts).
147
-
148
-
-`JELLYFIN_BASE_URL` (required): base URL of your Jellyfin server (e.g. `http://192.168.1.31:8096`).
149
-
-`JELLYFIN_API_KEY` (required): Jellyfin API key.
150
-
-`JELLYFIN_USER_ID` (optional): a Jellyfin user id to scope queries.
-`JELLYFIN_TIMEOUT` (optional): request timeout in milliseconds.
153
-
154
-
Examples:
155
-
156
-
Set values in a `.env` file or export them before running scripts:
157
-
158
-
```bash
159
-
JELLYFIN_BASE_URL=http://192.168.1.31:8096
160
-
JELLYFIN_API_KEY=your_api_key_here
161
-
```
134
+
*`JELLYFIN_BASE_URL`
135
+
*`JELLYFIN_API_KEY`
162
136
163
-
The sync and updater scripts use a centralized config helper which will throw a helpful error if `JELLYFIN_BASE_URL` or `JELLYFIN_API_KEY` are not set when strict validation is requested.
- Start with a dry-run and small `--limit` to confirm payloads look correct.
208
-
- Use `SYNC_JELLYFIN_BATCH_SIZE` and `SYNC_JELLYFIN_DELAY_MS` to tune concurrency and avoid overloading your Jellyfin server.
209
-
- If you get `401` errors, try `JELLYFIN_AUTH_MODE=query`.
210
-
211
-
212
-
Auth behaviour:
213
-
214
-
-`auto` (default): the client sends the recommended `Authorization: MediaBrowser Token="..."` header and will retry once using the `ApiKey` query parameter if the server responds `401`.
215
-
-`header`: always use the `Authorization: MediaBrowser ...` header.
216
-
-`query`: always use the `ApiKey` query parameter and do not send the header.
217
-
218
-
Basic usage example (prefer query mode for API key-only setups):
This project includes a helper script to update Jellyfin movie metadata with ratings retrieved from FilmAffinity. The script iterates your Jellyfin movie library, queries FilmAffinity for ratings and updates the Jellyfin item fields when necessary.
243
-
244
-
Run the updater (by default it runs in dry-run mode):
245
-
246
-
```bash
247
-
npm run update-jellyfin
248
-
```
249
-
250
-
Environment variables used by the updater and the newer `sync-jellyfin` script:
251
-
252
-
-`UPDATE_JELLYFIN_DRY_RUN` / `SYNC_JELLYFIN_DRY_RUN`: `true`/`false` — when `true` the script will only show the payload it would send to Jellyfin and will not perform updates. Default: `true`.
253
-
-`UPDATE_JELLYFIN_SET_CRITIC` / `SYNC_JELLYFIN_SET_CRITIC`: `true`/`false` — when `true` the updater will also set the `CriticRating` field (optional) if available from FilmAffinity. Default: `false`.
254
-
-`UPDATE_JELLYFIN_FORCE` / `SYNC_JELLYFIN_FORCE`: `true`/`false` — when `true` the updater will skip fetching existing metadata and forcibly apply updates. Default: `false`.
255
-
-`UPDATE_JELLYFIN_PAGE_SIZE` / `SYNC_JELLYFIN_PAGE_SIZE`: integer — page size used when iterating items (default `50` for updater, `100` for sync script).
256
-
-`SYNC_JELLYFIN_LIMIT`: integer — maximum number of items to process (useful for testing). Default: no limit.
257
-
-`SYNC_JELLYFIN_BATCH_SIZE`: integer — number of concurrent tasks per batch (default `5`).
258
-
-`SYNC_JELLYFIN_DELAY_MS`: integer — milliseconds to wait between batches (default `500`).
259
-
-`SYNC_JELLYFIN_RETRIES`: integer — number of retries for transient operations (default `3`).
260
-
-`SYNC_JELLYFIN_RETRY_DELAY`: integer — base retry delay in milliseconds for exponential backoff (default `1000`).
261
-
-`SYNC_JELLYFIN_INCLUDE_ITEM_TYPES`: comma-separated list — include item types to iterate, e.g. `Movie,Series,Episode` (default `Movie`).
0 commit comments