Repository navigation
feat(metadata): read banner, thumb, clear art, disc art and every backdrop from local sidecars - #2321
Merged
Merged
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Related issue: #216
Validation tasks: none
Kodi- and Jellyfin-style libraries keep more artwork beside the media than Silo reads: a banner, a landscape thumb, clear art, disc art, and several backdrops (
fanart-1.jpg,extrafanart/). Silo stores only a poster, one backdrop and a logo per item, so it ignores the rest. Jellyfin apps connected to Silo ask forBanner,Thumb,Art,Discand indexedBackdropimages and get nothing useful back.Thumbreturns the backdrop,Banner,ArtandDiscreturn 404,BackdropImageTagshas at most one entry, and everyBackdrop/{index}returns the first backdrop. Their banner and thumb views stay blank.This change stores those images, finds them under the names Kodi and Jellyfin use, and serves them on
/api/v2movie and series detail and on the Jellyfin-compatible API.Approach
media_itemsgets banner, thumb, clear art and disc slots. Each has a served path and a source path, and banner and thumb also get a thumbhash, following the poster, backdrop and logo columns. Backdrops after the first go in a newmedia_item_backdropstable, ordered by ordinal.media_items.backdrop_*stays the primary backdrop, so existing readers are unchanged. The image cache, the revision GC triggers, the artwork sweep surfaces, and item and folder deletion all cover the new slots and table. A cache job for an extra backdrop targets its row (item_backdrop). Its local cache key carries a hash of the sidecar's path, so two sidecars with the same bytes never share a key, a backdrop keeps its key when its row moves, and re-caching one backdrop never deletes another's files.internal/metadata/nfo). The names follow Jellyfin'sLocalImageProvider:banner;landscape, thenthumb;clearart(art.jpgstays a backdrop);disc, thencdart, thendiscart, for movies only. Each name can also take the media file's basename as a prefix, which wins over the plain name. After the named backdrops, which keep fix(metadata): find local artwork the way Kodi and Jellyfin name it, and keep it #2300's order so the primary doesn't change, comefanart-N(or Kodi'sfanartN),background-N,art-NandbackdropN. Each numbered family stops after three missing numbers in a row. Every image inextrafanart/follows. An item keeps at most 20 backdrops. Jellyfin'sbackdrops/folder holds theme videos, so it is not read. fix(metadata): find local artwork the way Kodi and Jellyfin name it, and keep it #2300's case-insensitive listing covers all of these names.extrafanartfolder counts once the folder holding it answers. This is fix(metadata): find local artwork the way Kodi and Jellyfin name it, and keep it #2300's rule for the poster, so an unmounted share keeps the images. Plugin image kindsbanner,thumb,clearartanddiscnow map to these slots instead of falling back to poster. No plugin sends them yet.getCatalogItemaddsbanner_url,banner_thumbhash,thumb_url,thumb_thumbhash,clearart_url,disc_urlandbackdrop_urls(every backdrop,backdrop_urlfirst) for movies and series.getImageCapabilitiesreportsextended_item_artworkand the widths of the new types./api/v1, cards and lists are unchanged.Banner,Thumb,ArtandDiscinImageTagsand every backdrop inBackdropImageTags, on lists and detail. The tags are seeded by cached path, so they change only when the image changes./Items/{id}/Images/{Banner,Thumb,Art,Disc}serve the images.Thumbstill falls back to the backdrop and then the poster.Backdrop/{index}serves that position and returns 404 past the last backdrop.Season banners, thumbs and backdrops, and NFO
<thumb aspect=…>art, are left for follow-ups (below). The architecture doc lists both under known limitations.User manual: Silo-Server/siloserver.org#183 (draft, stacked on siloserver.org#166) adds the new names to Add artwork.
Validation
go build,gofmt,go vetandmake lint-changed(againstmain) are clean. The web, settings-binding, playback, route-inventory, ledger, scenario, offline-route, OpenAPI, contract, fixture, web-type, local-path and case-collision checks pass.make test-go: the only failures are two real-FFmpeg tests ininternal/mediasample, which fail the same way on fix(metadata): find local artwork the way Kodi and Jellyfin name it, and keep it #2300's branch with this host's FFmpeg.migrations,catalog,metadata,jellycompat,apiv2,imagecache,taskmanager,storagetransitionandsectionspass against a freshly migrated PostgreSQL. Six new tests are added toscripts/ci/db-contracts.txtand pass through its runner. They cover the migration's Up and Down (including the GC triggers and job constraints), slot write-back, backdrop row identity and GC queueing, the folder-delete reference check over the new columns, provider backfill and repair of the new slots, and Jellyfin recommendations listing every backdrop. Ininternal/api/handlers, two DB tests outside this change (TestAdminSubtitleListPageDB,TestCatalogTransferPersistsJobsAndSignedLink) fail the same way on fix(metadata): find local artwork the way Kodi and Jellyfin name it, and keep it #2300's branch.extrafanart/, the cap, the ignoredbackdrops/folder, and flat folders. They also cover selection and retention, an unmounted share, locked artwork, a locked provider backdrop, cache keys and write-back, the sweep surfaces, the v2 detail and capability shape, jellycompat tags and routes, and v1 staying unchanged.extrafanartimage, or the wholeextrafanartfolder dropped them on the next refresh, and restoring them brought them back./Items/Latestlists the same image tags as the other list paths. That check found a bug: queue preparation restored the removed banner's cached copy. It is fixed here and covered by a test.mainafter fix(metadata): find local artwork the way Kodi and Jellyfin name it, and keep it #2300 and fix(jellycompat): honor every repeated enableImageTypes value #2324 merged, with every commit unchanged (git range-diff); the latest fixes are in f72033c.Review findings dismissed
existingImage*helpers rebuild the seven-slot list per lookup. That is a few dozen pointers per item write, next to several database writes.extrafanartto every sidecar folder would also drop a moved item's old local art, which fix(metadata): find local artwork the way Kodi and Jellyfin name it, and keep it #2300 deliberately keeps until the new folder supplies some.media_itemskeys, rather than one surface emitting four rows per item. That keeps the backfill's one-column-per-surface page bound; it runs only when an admin starts it.IS NOT NULLindexes, which the reference check still uses./Movies/RecommendationsthroughpresignCompatListItemsinstead of only loading extra backdrops: that helper drops an image whose path it cannot resolve, which recommendations have never done, so the change would go beyond this fix.extrafanartfolder that exists but is empty, or is missing while the item folder answers, counts as removed, for the primary backdrop too. Round 2 settled this for extra backdrops (an emptied folder must drop them); a symlinked folder whose target is down is kept.ImageTagsmap inapplyExtraImageTagscannot happen:itemFromListcreates the map.Replaceor the cache job rewrites a row: the table'sAFTER UPDATE OF pathandAFTER DELETEtriggers already queue it in the same transaction, as for themedia_itemsartwork columns.extrafanartis dropped if that mount comes back empty while its parent answers. An emptiedextrafanartfolder looks the same, and it must drop its backdrops. Closing this needs the item's library roots inlocalArtworkRetention, which fix(metadata): find local artwork the way Kodi and Jellyfin name it, and keep it #2300's retention does not carry.Evidence: https://evidence.siloserver.org/r/silo-server/local-image-types/
Risks
media_itemsGC triggers, and widens the cache-job constraints, addedNOT VALIDso its transaction does not scan the job queue while it holdsmedia_items. The second validates those constraints without blocking writers and builds four partial indexesCONCURRENTLY, like20260914145000, but on non-empty paths, since most items have none of these images. The artwork reference check (artworkReferenceUnionSQL, shared by the revision GC and the storage sweep) now also skips empty paths on every surface, so a generic plan can use those indexes; the olderIS NOT NULLindexes are still used.banner,thumb,clearartordiscimages goes through the same selection as the logo: a local sidecar wins, and rated remote art can replace stored remote art.applyBestImages.Follow-ups
seasonNN-fanart,seasonNN-banner,seasonNN-landscapeand the season-folder forms).<thumb aspect="banner|landscape|clearart|discart">and<fanart>art. A provider returnsImageBanner,ImageThumb,ImageClearArtorImageDiscimages andapplyBestImagesfills the slot./api/v2cards and lists for the new artwork.Checklist
AI Disclosure
🤖 Generated with Claude Code