Repository navigation
fix(jellycompat): Wholphin (jellyfin-sdk-kotlin) playback & genre compatibility - #100
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📥 CommitsReviewing files that changed from the base of the PR and between 7486c635a39b9e343f69fd1c77e950753da9f4e9 and 277766e. 📒 Files selected for processing (17)
📝 WalkthroughWalkthroughThis PR adds backdrop filtering to browse requests, makes Jellyfin-compatible query parameter lookups case-insensitive for auth and playback session IDs, and compares media-source IDs by UUID equivalence to tolerate format variations. ChangesJellyfin Compatibility Improvements
🎯 2 (Simple) | ⏱️ ~12 minutes
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Wholphin genre cards request /Items?imageTypes=Backdrop&limit=1&sortBy=Random and assume every returned item has a backdrop. Silo ignored ImageTypes, so a random pick could lack a backdrop (BackdropImageTags: null), crashing Wholphin. Push the filter down to the catalog browse SQL (NULLIF(BTRIM(backdrop_path),'') IS NOT NULL) so random/limited selections only ever consider backdrop-having items; empty genres correctly return [].
…auth
Wholphin's jellyfin-sdk-kotlin builds its own direct-play URL
(/Videos/{id}/stream?static=true&playSessionId=...&mediaSourceId=...) with a
lowercase 'playSessionId', no api_key, and no auth header (ExoPlayer's data
source drops it). PlaybackSessionAuth read 'PlaySessionId'/'PlaySessionID'
case-sensitively, so the fallback never matched -> 401 on every direct-play
stream -> forced (often failing) transcode fallback. Resolve PlaySessionId via
newCaseInsensitiveQuery, and likewise accept case-variant api_key in
ExtractToken.
7486c63 to
a5cdd06
Compare
…patibility (#100) * fix(jellycompat): match MediaSourceId across UUID formats (compact vs dashed) * fix(jellycompat): honor ImageTypes=Backdrop as a filter on /Items Wholphin genre cards request /Items?imageTypes=Backdrop&limit=1&sortBy=Random and assume every returned item has a backdrop. Silo ignored ImageTypes, so a random pick could lack a backdrop (BackdropImageTags: null), crashing Wholphin. Push the filter down to the catalog browse SQL (NULLIF(BTRIM(backdrop_path),'') IS NOT NULL) so random/limited selections only ever consider backdrop-having items; empty genres correctly return []. * fix(jellycompat): case-insensitive PlaySessionId + api_key in stream auth Wholphin's jellyfin-sdk-kotlin builds its own direct-play URL (/Videos/{id}/stream?static=true&playSessionId=...&mediaSourceId=...) with a lowercase 'playSessionId', no api_key, and no auth header (ExoPlayer's data source drops it). PlaybackSessionAuth read 'PlaySessionId'/'PlaySessionID' case-sensitively, so the fallback never matched -> 401 on every direct-play stream -> forced (often failing) transcode fallback. Resolve PlaySessionId via newCaseInsensitiveQuery, and likewise accept case-variant api_key in ExtractToken. * fix(jellycompat): support Wholphin season item queries --------- Co-authored-by: Quick <[email protected]>
…patibility (#100) * fix(jellycompat): match MediaSourceId across UUID formats (compact vs dashed) * fix(jellycompat): honor ImageTypes=Backdrop as a filter on /Items Wholphin genre cards request /Items?imageTypes=Backdrop&limit=1&sortBy=Random and assume every returned item has a backdrop. Silo ignored ImageTypes, so a random pick could lack a backdrop (BackdropImageTags: null), crashing Wholphin. Push the filter down to the catalog browse SQL (NULLIF(BTRIM(backdrop_path),'') IS NOT NULL) so random/limited selections only ever consider backdrop-having items; empty genres correctly return []. * fix(jellycompat): case-insensitive PlaySessionId + api_key in stream auth Wholphin's jellyfin-sdk-kotlin builds its own direct-play URL (/Videos/{id}/stream?static=true&playSessionId=...&mediaSourceId=...) with a lowercase 'playSessionId', no api_key, and no auth header (ExoPlayer's data source drops it). PlaybackSessionAuth read 'PlaySessionId'/'PlaySessionID' case-sensitively, so the fallback never matched -> 401 on every direct-play stream -> forced (often failing) transcode fallback. Resolve PlaySessionId via newCaseInsensitiveQuery, and likewise accept case-variant api_key in ExtractToken. * fix(jellycompat): support Wholphin season item queries --------- Co-authored-by: Quick <[email protected]>
Summary
Three independent fixes to the Jellyfin-compatibility API, each addressing a case where the Wholphin Android TV client (jellyfin-sdk-kotlin / Media3 ExoPlayer) fails against Silo but works against upstream Jellyfin. All three were diagnosed from live request logs + client logcat and verified against a populated server.
1. Match
MediaSourceIdacross UUID formats (compact vs dashed)PlaybackInfoand the stream/route resolvers compared a client-suppliedMediaSourceIdto the canonical source id with raw string equality. Silo emits the dashed compat UUID (03000000-0000-0000-0000-00000019e8c2); Wholphin echoes it back in the compact 32-char form (0300000000000000000000000019e8c2). Same UUID, different bytes →404 Media source not found.Fix: a
mediaSourceIDsEqualhelper (exact match fast-path, else compareuuid.Parse'd values) used at all four match sites (HandlePlaybackInfo,audioSelectionChanged,setSelectedAudioStream,findMediaSource). The decoder already accepted both forms — only the comparisons were wrong.2. Honor
ImageTypes=Backdropas a filter on/ItemsImageTypeswas parsed nowhere, so/Items?imageTypes=Backdrop&limit=1&sortBy=Random(Wholphin genre cards) could return items withBackdropImageTags: null, which the client assumes are present. The filter is pushed down to the catalog browse SQL (BrowseFilters.RequireBackdrop→NULLIF(BTRIM(mi.backdrop_path), '') IS NOT NULL) so random/limited selections only ever consider backdrop-having items; an empty genre correctly returns[]. (Filtering after the LIMIT would wrongly return empty pages.)3. Case-insensitive
PlaySessionId(andapi_key) in stream authWholphin's jellyfin-sdk-kotlin builds its own direct-play URL —
/Videos/{id}/stream?static=true&playSessionId=…&mediaSourceId=…— with a lowercaseplaySessionId, noapi_key, and no auth header (ExoPlayer's data source doesn't forward it).PlaybackSessionAuthresolvedPlaySessionId/PlaySessionIDcase-sensitively (Go'surl.Values.Get), so the playback-session fallback never matched →401on every direct-play request → the client was forced into a needless transcode fallback. Resolved via the existing case-insensitive query helper;ExtractToken'sapi_keylookup is made case-insensitive too for the same class of issue. (Silo's own HLS segment URLs use capitalPlaySessionId, so those always worked — which masked the bug.)Testing
TestMediaSourceIDsEqual,TestParseItemsQuery_ImageTypesBackdropFilter,TestPlaybackSessionAuth_CaseInsensitivePlaySessionId(incl. the exact lowercase-playSessionIdrepro),TestExtractToken_CaseInsensitiveAPIKey.go vet+go buildclean;go test ./internal/jellycompat/passes.Notes
Each fix is in its own commit. No new DB migrations. The backdrop predicate is parameterless and operates on already-filtered rows.
Summary by CodeRabbit
New Features
Improvements
Tests