JellyFinPoster/BIBLE: Difference between revisions
md2wiki: sync from MindAttic.Docs |
md2wiki: sync from MindAttic.Docs |
||
| Line 41: | Line 41: | ||
* <code>bootstrap.ps1</code> / <code>Start.bat</code> — one double-click setup: Python, requirements, <code>.env</code>, first run. | * <code>bootstrap.ps1</code> / <code>Start.bat</code> — one double-click setup: Python, requirements, <code>.env</code>, first run. | ||
* <code>tests/test_vault_settings.py</code> — tests for <code>vault.py</code>. | * <code>tests/test_vault_settings.py</code> — tests for <code>vault.py</code>. | ||
* <code>tests/test_library_lookup.py</code> — tests for <code>get_library_item_id</code>'s both-match/type-only/name-only pick order. | |||
* <code>fonts/NotoSans.ttf</code> — the label font. | * <code>fonts/NotoSans.ttf</code> — the label font. | ||
=== 4.2 Domain model (the nouns) === | === 4.2 Domain model (the nouns) === | ||
* <strong>Library</strong> — a Jellyfin VirtualFolder | * <strong>Library</strong> — a Jellyfin VirtualFolder: a both-match on CollectionType (<code>movies</code>, <code>tvshows</code>, <code>books</code>, <code>music</code>) and the configured Name wins outright, else the first CollectionType-only match, else the first Name-only match. | ||
* <strong>MEDIA</strong> — the four library specs: item type, label, collection type, name, whole-library or newest sampling. | * <strong>MEDIA</strong> — the four library specs: item type, label, collection type, name, whole-library or newest sampling. | ||
* <strong>Collage</strong> — the finished JPEG (quality 85) for one library. | * <strong>Collage</strong> — the finished JPEG (quality 85) for one library. | ||
| Line 65: | Line 66: | ||
* All four libraries refresh; whole-library sampling for Movies/TV (0fa8d09, JFP-T24); type-before-name lookup (b697d58, JFP-T25); nonzero exit on failure and daily/four-library wording (0112f9b, JFP-T26); Vault settings (bce162d, JFP-T19). | * All four libraries refresh; whole-library sampling for Movies/TV (0fa8d09, JFP-T24); type-before-name lookup (b697d58, JFP-T25); nonzero exit on failure and daily/four-library wording (0112f9b, JFP-T26); Vault settings (bce162d, JFP-T19). | ||
* The nightly run is a MindAttic.Scheduler job, <code>JellyFinPoster.Refresh</code>, which replaces the Windows scheduled task (M.SCHD-T7, closed); <code>bootstrap.ps1</code> | * The nightly run is a MindAttic.Scheduler job, <code>JellyFinPoster.Refresh</code>, which replaces the Windows scheduled task (M.SCHD-T7, closed); <code>bootstrap.ps1</code> no longer registers any task, and <code>scripts/register_scheduled_task.ps1</code> is gone (JFP-T8, closed). | ||
== 7. Active frontier <span id="JFP-7"></span> == | == 7. Active frontier <span id="JFP-7"></span> == | ||
Latest revision as of 06:32, 1 December 2026
JellyFinPoster — Project Bible
Single source of truth for what JellyFinPoster IS, is NOT, and the rules that keep it coherent. README says how to build and run it; this says how to think about it. The finish line lives in
docs/RELEASE.md.
1. The one sentence
A Python script that builds a poster collage from each Jellyfin library's own artwork (Movies, TV Shows, Books, Music) and uploads it as that library's Primary image, run once a day unattended.
2. The product promise
- Fresh tiles, no hand work. Every run redraws all four library tiles; every Jellyfin client sees them at once.
- Jellyfin's own artwork only. Posters come from
GET /Items/{id}/Images/Primary; nothing is fetched from TMDB or any outside service. - Clean grids. Up to 5 x 2 posters at 500 x 750; duplicates dropped by MD5 of the image bytes, near-blank images rejected, fewer than 3 usable posters leaves the library's current image alone.
- Unattended. Runs once per invocation and exits nonzero when a lookup, fetch or upload fails, so the scheduler's retries fire.
- Settings in Vault. Server URL and library names live in MindAttic Vault (
JellyFinPostersettings app), the key in the sharedjellyfinnamed key;.envis imported once and stays a fallback.
3. What it is NOT
- NOT a Jellyfin plugin: it talks to the server over its HTTP API from the outside.
- NOT a poster designer: one fixed layout (grid, translucent banner, Noto Sans Bold label, rounded corners).
- NOT a scheduler: it runs once and exits; repeat runs belong to an OS or MindAttic scheduler.
- NOT a metadata or artwork fetcher for items: it reads item images, it never changes them.
4. Architecture canon
vault.py: import .env once -> resolve() -> JF_URL, JF_API_KEY, library names
|
jellyfin_poster.py run(): for movies, tvshows, books, music
get_library_item_id(collection_type, name) GET /Library/VirtualFolders
fetch_item_ids(library, type, limit, whole) GET /Items (random sample or newest)
fetch_item_poster(id) GET /Items/{id}/Images/Primary
build_collage() -> draw_title_label() Pillow
upload_library_image() POST /Items/{libraryId}/Images/Primary (JPEG, base64)
4.1 Modules
jellyfin_poster.py— the whole refresh (about 320 lines);--write-settings-manifestwrites the Vault manifest.vault.py— standard-library-only Vault reader: settings, thejellyfinnamed key, the one-time.envimport.bootstrap.ps1/Start.bat— one double-click setup: Python, requirements,.env, first run.tests/test_vault_settings.py— tests forvault.py.tests/test_library_lookup.py— tests forget_library_item_id's both-match/type-only/name-only pick order.fonts/NotoSans.ttf— the label font.
4.2 Domain model (the nouns)
- Library — a Jellyfin VirtualFolder: a both-match on CollectionType (
movies,tvshows,books,music) and the configured Name wins outright, else the first CollectionType-only match, else the first Name-only match. - MEDIA — the four library specs: item type, label, collection type, name, whole-library or newest sampling.
- Collage — the finished JPEG (quality 85) for one library.
4.3 Key services (the verbs)
Library lookup, item sampling (Movies/TV: random over the whole library; Books/Music: recently added; 3x headroom), poster validation and de-duplication, collage composition, upload.
5. The Laws
Inherits MindAttic.HouseRules.md by reference.
- JFP-LAW-1 — Never break a tile. A library with too few usable posters keeps its current image.
- JFP-LAW-2 — Fail loudly to the scheduler. Any lookup, fetch or upload failure ends the run nonzero.
- JFP-LAW-3 — Secrets never in the repo. The Jellyfin key comes from Vault (or an untracked
.env). - JFP-LAW-4 — One source of artwork: the Jellyfin server itself.
6. Verified state
- All four libraries refresh; whole-library sampling for Movies/TV (0fa8d09, JFP-T24); type-before-name lookup (b697d58, JFP-T25); nonzero exit on failure and daily/four-library wording (0112f9b, JFP-T26); Vault settings (bce162d, JFP-T19).
- The nightly run is a MindAttic.Scheduler job,
JellyFinPoster.Refresh, which replaces the Windows scheduled task (M.SCHD-T7, closed);bootstrap.ps1no longer registers any task, andscripts/register_scheduled_task.ps1is gone (JFP-T8, closed).
7. Active frontier
See docs/RELEASE.md for the milestone, its epics and what is out of scope.
8. Quality bar
A change is done when python -m py_compile jellyfin_poster.py vault.py passes, any new logic has a pytest test in tests/, and the README describes it as built.
9. Glossary
- Primary image — the Jellyfin image slot shown as a library's tile.
- VirtualFolder — Jellyfin's name for a library.