Jump to content

JellyFinPoster

From MindAttic Docs

JellyFinPoster

Keep your Jellyfin library tiles fresh: JellyFinPoster builds a poster collage from each library's newest additions and uploads it as that library's image, once a day, on its own.

Python-3.10%2B-3776AB.svg Pillow-imaging-4B8BBE.svg Jellyfin-API-00A4DC.svg Platform-Windows-0078D6.svg Status-working-2f7a4f.svg

 One library tile, as JellyFinPoster draws it (up to 5 x 2 posters, 500 x 750 px each)

 ╭────────┬────────┬────────┬────────┬────────╮
 │ newest │ newest │ newest │ newest │ newest │
 │ poster │ poster │ poster │ poster │ poster │
 │████████████████████████████████████████████│  <- translucent black banner
 │███████████████    MOVIES    ███████████████│  <- white label, black outline
 │████████████████████████████████████████████│
 │ newest │ newest │ newest │ newest │ newest │
 │ poster │ poster │ poster │ poster │ poster │
 ╰────────┴────────┴────────┴────────┴────────╯  rounded corners, saved as JPEG

JellyFinPoster pulls the artwork straight from Jellyfin itself and uploads the finished collage as the Primary image for your Movies, TV Shows, Books and Music libraries, so the library folder art refreshes automatically instead of staying a static icon. The image goes to the Jellyfin server over its API, so once it is pushed every client (tablet, phone, browser, TV app) sees the new poster immediately.

Why

  • See what was just added the moment you open Jellyfin, right on the library tiles.
  • Stop maintaining library artwork by hand; the nightly MindAttic.Scheduler job JellyFinPoster.Refresh does it for you.
  • Set it up with one double-click: Start.bat installs Python and asks for two values.
  • Keep the tiles clean: duplicate artwork and blank posters are skipped, and a library with too few usable posters is left alone rather than given a broken collage.
  • Use your own server's artwork only; nothing is fetched from outside Jellyfin.

Features

  • Four libraries: Movies (Movie items), TV (Series), Books (Book) and Music (MusicAlbum), labelled MOVIES, TV, BOOKS and MUSIC.
  • Automatic library lookup, so two libraries of the same type (e.g. Movies and 4K Movies) can be told apart: a VirtualFolder matching both the Jellyfin collection type (movies, tvshows, books, music) and the configured library name wins outright; otherwise the first collection-type match wins; otherwise the first name match. No manual ParentId lookup.
  • Movies and TV draw from the whole library (a random sample, not just the newest additions), so the grid isn't dominated by whatever was added most recently. Books and Music still use recently added items. Either way, Jellyfin returns three times the needed count as headroom, then the client shuffles them so the grid changes each run.
  • Clean grids: posters are de-duplicated by an MD5 hash of the image bytes (not just by item ID), near-blank images are rejected, and a grid needs at least 3 usable posters. Rows shrink to fit a partial batch.
  • Readable label: Noto Sans Bold (bundled in fonts/), auto-sized to fit long labels, on a translucent banner with a black outline.
  • Unattended: runs nightly as the MindAttic.Scheduler job JellyFinPoster.Refresh, a WatchDog job that launches pythonw jellyfin_poster.py straight from this repo's checkout (no console window, no separately registered Windows task) and catches up on the next wake or logon if a run was missed.
  • Logging to the console and to jellyfin_poster.log.

Quick start

Double-click Start.bat. On each run it:

  1. Installs Python 3.10 or newer if it is not already present (per-user, no admin rights needed).
  2. Installs the project's dependencies (requests, pillow, python-dotenv).
  3. If .env does not exist yet, asks for JF_URL and JF_API_KEY right in the console (with a hint on where to find each) and creates .env from your answers.
  4. Runs the refresh once immediately, so you see it working right away.

Then open Jellyfin: the library tiles show the new collages.

After this first run, JellyFinPoster itself doesn't register anything for repeat runs -- nightly refreshes are the MindAttic.Scheduler job JellyFinPoster.Refresh, which runs pythonw jellyfin_poster.py against this same checkout.

Manual path

pip install -r requirements.txt
copy .env.example .env
python jellyfin_poster.py

Fill in .env before the last command. Output is logged to the console and to jellyfin_poster.log.

Configuration

Settings and the Jellyfin key live in MindAttic Vault, not .env: the server URL and library-name fallbacks are in %APPDATA%\MindAttic\JellyFinPoster\settings.json, and the API key is in the shared jellyfin named key list (%APPDATA%\MindAttic\LLM\providers.json) -- both edited from MindAttic.Vault.Desktop. On the very first run, vault.import_env_once() copies whatever is already in .env / the environment into Vault once (it never overwrites a value Vault already has), and .env stays a live fallback after that on a machine with no Vault installed. vault.resolve() reads Vault first and falls back to the environment for anything Vault doesn't have.

Variable Required Meaning
JF_URL yes Base URL of your Jellyfin server, for example http://192.168.1.10:8096
JF_API_KEY yes A Jellyfin API key (Dashboard, Advanced, API Keys)
JF_MOVIES_LIBRARY_NAME no Fallback display name, default Movies
JF_TV_LIBRARY_NAME no Fallback display name, default TV Shows
JF_BOOKS_LIBRARY_NAME no Fallback display name, default Books
JF_MUSIC_LIBRARY_NAME no Fallback display name, default Music

Library IDs are looked up automatically by collection type (see "How it works" below for the exact pick rule). Only set the library name variables if your libraries use non-default names and the automatic lookup does not find them.

How it works

 for each library (movies, tvshows, books, music):
   GET  {JF_URL}/Library/VirtualFolders            find the library (see pick rule below)
   GET  {JF_URL}/Items?ParentId=..&SortBy=DateCreated&SortOrder=Descending&Limit=30
   GET  {JF_URL}/Items/{id}/Images/Primary         for each item until 10 good posters
        skip duplicates (MD5) and near-blank images
   Pillow: fit to 500 x 750, paste into a 5-column grid, draw banner + label, round corners
   POST {JF_URL}/Items/{libraryId}/Images/Primary  JPEG, quality 85, base64 body

Every request carries the API key in the X-Emby-Token header.

Library pick rule (get_library_item_id): scan every VirtualFolder once. A folder matching both the configured collection type and the configured library name wins immediately -- this is how two libraries of the same type (e.g. Movies and 4K Movies) get told apart. Otherwise the first collection-type-only match wins; otherwise the first name-only match wins; otherwise no folder is found, that library is skipped for this run, and the run exits nonzero so the Scheduler's retry fires.

Project layout

Path What it is
Start.bat Double-click launcher; runs bootstrap.ps1
bootstrap.ps1 Finds or installs Python, installs requirements, creates .env, runs a refresh
jellyfin_poster.py The refresh: fetch, compose, upload
vault.py Reads/writes settings and the jellyfin key in MindAttic Vault; the one-time .env import
fonts/NotoSans.ttf Label font
.env.example Configuration template

Limitations

  • Windows only for the unattended run (the MindAttic.Scheduler job); the Python script itself has fallback font paths for Linux, but scheduling there is up to you.
  • A library with fewer than 3 usable posters is skipped and keeps its current image.
  • bootstrap.ps1 writes only the Movies and TV name fallbacks into a new .env; Books and Music use their built-in defaults unless you add them.

Deploy

JellyFinPoster ships as a script, not a packaged app: there is no built exe and no R:\MindAttic\Apps\JellyFinPoster deploy target (.agent/publish.json, kind none). It only ever runs two ways, both straight from this repo's own checkout: a person double-clicking Start.bat for one-time setup and a first run, and the MindAttic.Scheduler WatchDog job JellyFinPoster.Refresh, which launches pythonw jellyfin_poster.py against this checkout nightly.

Scope

The complete product, every epic, feature and story built or still to build, is in SPEC.md, including what is never in the product. The current finish line is RELEASE.md (MS-35, which is also the finished product).

Documentation

  • SPEC.md: the complete product specification.
  • RELEASE.md: the current milestone and its epics.
  • AGENTS.md: entry point for AI agents working in this repo; it points at the shared MindAttic agent standard.

License

This repository has no LICENSE file; all rights are reserved. The bundled fonts/NotoSans.ttf is the Noto Sans typeface and keeps its own font license.

Part of MindAttic — see more projects at github.com/mindattic. Related: Audible-To-GoodReads, another self-installing Python tool for your media library.

Pages in this repository

  • JellyFinPoster — Project Bible — A Python script that builds a poster collage from each Jellyfin library's own artwork (Movies, TV Shows, Books, Music) and uploads it as…
  • Code ledger: JellyFinPoster — Every tracked source file and the ticket in this repo's tree that accounts for it (MAT-T484; method:…
  • JellyFinPoster — Release charter — A Python script that redraws the owner's Jellyfin library tiles (Movies, TV Shows, Books, Music) as poster collages from the server's own…
  • JellyFinPoster — Product specification — Place in the ecosystem: A product (App) in docs/ECOSYSTEM.md §2.2: the poster collages on the owner's Jellyfin library tiles.…
From JellyFinPoster/docs/overview.md via MindAttic.Docs; synced automatically, so edit the repo, not this page.