Repository navigation
fix(jellycompat): return seasons/episodes when browsing a series via /Items?ParentId= - #160
Conversation
…/Items?ParentId=
Clients that browse a show through the generic /Items?ParentId= endpoint with no
IncludeItemTypes (e.g. the VoidTV Android-TV client's getSeasons/getEpisodes) got
the top-level library views instead of the series' seasons or the season's
episodes. HandleItems only honored an item/season ParentId when
IncludeItemTypes=Season was present and otherwise fell through to the
library-views fallback (or a global type browse), so ParentId was effectively
ignored.
Decode a season ParentId into its own parentSeasonID and route item parents:
- season ParentId -> that season's episodes
- series ParentId -> the series' seasons (or its episodes for
IncludeItemTypes=Episode; an unsatisfiable type filter returns an empty page)
Extract the shared writeSeriesEpisodesResponse used by /Shows/{id}/Episodes and
the new browse paths. The generic /Items browse paths honor StartIndex/Limit
(matching the /Items contract and the sibling seasons listing) while
/Shows/{id}/Episodes keeps its existing whole-season response.
Adds parent_browse_test.go covering series->seasons, season->episodes, the
unsatisfiable-type-filter empty case, paging, and the parser's season/item
ParentId distinction.
|
Warning Review limit reached
More reviews will be available in 50 minutes and 16 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthrough
ChangesSeason-based parent browsing in ItemsHandler
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@internal/jellycompat/handlers_items.go`:
- Around line 224-235: The handleSeasonEpisodeChildren function ignores the
IncludeItemTypes filter and always returns episodes when the parent is a season.
Before calling h.writeSeriesEpisodesResponse, add a check to verify that the
query.IncludeItemTypes actually includes the Episode type. If the Episode type
is not included in the filter, return emptyQueryResult(query.startIndex)
instead, just like the existing error cases in this function.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 431d0763-d382-4bf9-8903-0525a26df966
📒 Files selected for processing (4)
internal/jellycompat/handlers_items.gointernal/jellycompat/parent_browse_test.gointernal/jellycompat/query.gointernal/jellycompat/router.go
…n ParentId handleSeasonEpisodeChildren ignored IncludeItemTypes and always returned the season's episodes. A season's only children are episodes, so a type filter that excludes Episode (e.g. IncludeItemTypes=Movie) now returns an empty page, mirroring the series-parent path's handling of unsatisfiable type filters. Addresses a CodeRabbit review comment.
|
Addressed the review comment in 1f02307: |
…/Items?ParentId= (#160) * fix(jellycompat): return seasons/episodes when browsing a series via /Items?ParentId= Clients that browse a show through the generic /Items?ParentId= endpoint with no IncludeItemTypes (e.g. the VoidTV Android-TV client's getSeasons/getEpisodes) got the top-level library views instead of the series' seasons or the season's episodes. HandleItems only honored an item/season ParentId when IncludeItemTypes=Season was present and otherwise fell through to the library-views fallback (or a global type browse), so ParentId was effectively ignored. Decode a season ParentId into its own parentSeasonID and route item parents: - season ParentId -> that season's episodes - series ParentId -> the series' seasons (or its episodes for IncludeItemTypes=Episode; an unsatisfiable type filter returns an empty page) Extract the shared writeSeriesEpisodesResponse used by /Shows/{id}/Episodes and the new browse paths. The generic /Items browse paths honor StartIndex/Limit (matching the /Items contract and the sibling seasons listing) while /Shows/{id}/Episodes keeps its existing whole-season response. Adds parent_browse_test.go covering series->seasons, season->episodes, the unsatisfiable-type-filter empty case, paging, and the parser's season/item ParentId distinction. * fix(jellycompat): empty result for non-episode type filter on a season ParentId handleSeasonEpisodeChildren ignored IncludeItemTypes and always returned the season's episodes. A season's only children are episodes, so a type filter that excludes Episode (e.g. IncludeItemTypes=Movie) now returns an empty page, mirroring the series-parent path's handling of unsatisfiable type filters. Addresses a CodeRabbit review comment.
Problem
Clients that browse a show through the generic
/Items?ParentId=endpoint withoutIncludeItemTypes— e.g. the VoidTV Android-TV client'sgetSeasons(seriesId)/getEpisodes(seasonId), which sendParentId+SortBy=SortNameand no type filter — received the top-level library views (CollectionFolders) instead of the series' seasons / the season's episodes.HandleItemsonly honored an item/seasonParentIdwhenIncludeItemTypes=Seasonwas also present; otherwiseparentItemIDwas dropped and the request fell through to the library-views fallback (or a global type browse). On a real Jellyfin server/Items?ParentId={series}returns seasons and/Items?ParentId={season}returns episodes.Confirmed live against a production deployment:
/Items?ParentId={series}and{season}both returned the library CollectionFolders, while the dedicated/Shows/{id}/Seasons|Episodesroutes worked — which is why clients using those dedicated routes were unaffected and only/Items?ParentId=browsers (VoidTV) broke.Approach
ParentIdinto a dedicatedparentSeasonID(the codec already kind-tags item vs season ids; decoding season first keeps them distinct).HandleItems:ParentId→ that season's episodesParentId→ the series' seasons (default, and explicitIncludeItemTypes=Season), or the series' episodes forIncludeItemTypes=Episode; a type filter a series can't satisfy (e.g.Movie) returns an empty page rather than a wrong-typed listing.writeSeriesEpisodesResponseas the shared core of/Shows/{id}/Episodesand the new browse paths (avoids duplicated logic). The generic/Itemsbrowse paths honorStartIndex/Limit(matching the/Itemscontract and the sibling seasons listing);/Shows/{id}/Episodeskeeps its existing whole-season response.Testing
parent_browse_test.go: series→seasons, season→episodes, unsatisfiable-type-filter→empty, season-parent paging, season-parent-without-repo→empty-not-views, and the parser's season/itemParentIddistinction. The series/season tests use a content double that panics inListUserLibraries, so a views-fallthrough regression fails the test rather than silently passing.go test ./internal/jellycompat/...,go vet, andgofmtare clean, run in a libvips-capable container (the package needs libvips to build).Compat
Additive:
/Shows/{id}/Seasons|Episodesbehavior is unchanged; movie/episodeParentIds degrade to an empty page (never a 500).AI use
Implemented with AI assistance; the diff was reviewed in a separate pass and the tests were run in a Docker toolchain before submitting.
Summary by CodeRabbit