Skip to content

fix: Emby: episodes with several versions no longer repeat in the season list - #2253

Merged
RadicalMuffinMan merged 1 commit into
Moonfin-Client:mainfrom
jrodzar:fix/emby-episodes-userid
Nov 14, 2026
Merged

RadicalMuffinMan merged 1 commit into
Moonfin-Client:mainfrom
jrodzar:fix/emby-episodes-userid

Conversation

@jrodzar

@jrodzar jrodzar commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

Pull Request

Summary

On Emby, a season whose episodes are held in more than one version (4K and 1080p, for example) lists every episode once per version. A 6 episode season shows 12 entries: 1, 1, 2, 2 and so on.

EmbyItemsApi.getEpisodes asks /Shows/{id}/Episodes without a user, and Emby only folds the versions of an episode into one item when the query names one. This adds UserId to that query, the same way getSeasons right above it already does.

Jellyfin is not affected, and its code is not touched.

Related Issues

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Performance improvement
  • UI/UX update
  • Documentation update
  • Build/CI change
  • Other (describe):

Changes Made

  • packages/server_emby/lib/src/api/emby_items_api.dart: getEpisodes sends UserId.
  • packages/server_emby/test/emby_items_api_test.dart: a test that the episodes query carries it.

Platform

  • Android
  • Android TV
  • iOS
  • tvOS
  • Web
  • macOS
  • Windows
  • Linux
  • All / Shared code

Testing

  • Tested on emulator / simulator
  • Tested on physical device
  • Manual testing completed
  • Not tested (explain why):

Emby 4.10.2.0, a season of 6 episodes with two versions each (2160p and 1080p).

Asking the server directly:

  • /Shows/{id}/Episodes?SeasonId=... returns 12 items (1, 1, 2, 2 ... 6, 6)
  • the same query with UserId returns 6

In the app, on Windows, with two builds from the same base that differ only by this commit:

  • without it the season shows 12 episodes
  • with it the season shows 6. Opening an episode still lets me choose between the two versions, it plays, and "next" goes on to episode 2

The Checks workflow passes on this commit in my fork.

Test Steps

  1. On an Emby server, open a season where each episode has more than one version.
  2. Before this change every episode appears once per version.
  3. After it every episode appears once, and the versions are still there to choose from when you open it.

getEpisodes is also what the play queue, the episode browser and season downloads read, so they were getting each episode once per version as well. Of those, I did not try downloads.

Screenshots (if applicable)

None attached.

Checklist

  • Code builds successfully
  • Code follows project style and conventions
  • No unnecessary commented-out code
  • No new warnings introduced

I used an AI assistant (Claude Code) to track this down and write the change. I ran both builds and checked the result on screen myself.

🤖 Generated with Claude Code

Emby only groups the versions of an episode into one item when the
query carries a UserId. /Shows/{id}/Episodes went out without it, so a
season held in 1080p and 4K listed every episode twice. Jellyfin reads
the user from the session and was never affected.

Measured against Emby 4.10.2.0 on a 6 episode season with two versions
each: 12 items without UserId, 6 with it.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@github-actions github-actions Bot added All Bug Something isn't working labels Nov 12, 2026
@coderabbitai

coderabbitai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Bug Fixes
    • Episode requests now include the current user’s ID alongside the selected season and requested fields, improving how episode versions are returned.

EmbyItemsApi.getEpisodes now includes the current user's ID in the episodes query. A test checks that the request includes the expected endpoint, season ID, and user ID.

Changes: Emby episode query

Layer / File(s) Summary
Add user ID to episode requests
packages/server_emby/lib/src/api/emby_items_api.dart, packages/server_emby/test/emby_items_api_test.dart
getEpisodes adds the current user's ID to the query. The test checks the endpoint, season ID, and user ID.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Suggested reviewers: radicalmuffinman

Merge Risk: Minimal · up to 5faae

Emby episode lists should no longer show one entry per version, and both versions stay selectable when an episode is opened. The change is small and limited to the Emby package. The author did not test downloads, so existing downloads of non-primary versions are worth a quick manual check, but no concrete defect was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: Emby episodes with several versions no longer repeat in the season list. The raw summary confirms the change adds UserId to the getEpisodes query, which is the fix for…
Description check Passed The description follows the repository template. It has a Summary that explains the cause (the episodes query omits UserId, so Emby does not fold versions), a Related Issues section (linked to #1700, …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: Emby episodes with several versions no longer repeat in the season list. The raw summary confirms the change adds UserId to the getEpisodes query, which is the fix for that repetition. The title is specific and uses the conventional fix: prefix.

Full details: Description check

Explanation

The description follows the repository template. It has a Summary that explains the cause (the episodes query omits UserId, so Emby does not fold versions), a Related Issues section (linked to #1700, though not a Closes or Fixes link), a Type of Change with Bug fix checked, a Changes Made list that matches the raw summary, a Platform section, a Testing section with device and manual test details and test steps, a Screenshots note, and a completed Checklist. The description is detailed and matches the code changes. Minor gaps: the Related Issues entry is only 'Related to', and the Tested on emulator box is unchecked, which is accurate since the author tested on a physical device.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between e07b3ea and 5faae1c.

Files selected for processing: 2

  • packages/server_emby/lib/src/api/emby_items_api.dart
  • packages/server_emby/test/emby_items_api_test.dart

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

✅ Build Successful

All platform builds and tests passed. You can download the test artifacts below.

Tests ✅ 9113 passed, analyzer clean

Touched lines ✅ no new diagnostics

Coverage 🧪 tests run all 4 measurable changed lines

Platform Status Artifact
Android ✅ Passed Moonfin_Android_v* (apk/aab)
Android TV ✅ Passed Moonfin_AndroidTV_v* (apk/aab)
iOS ✅ Passed Moonfin_iOS_v*_unsigned.ipa
macOS ✅ Passed Moonfin_macOS_v*.dmg
tvOS ✅ Passed Moonfin_tvOS_v*_unsigned.ipa
Apple tests ✅ Passed test-results.json
Windows x64 ✅ Passed Moonfin_Windows_v*.exe
Windows ARM64 ✅ Passed Moonfin_WindowsARM64_v*.exe
Linux x64 ✅ Passed Moonfin_Linux_v* (deb/rpm/AppImage/snap/flatpak/tar.gz)
Linux ARM64 ✅ Passed Moonfin_LinuxARM64_v* (deb/rpm/AppImage/snap/flatpak/tar.gz)
Web ✅ Passed build/web (static site, serve over HTTP)
Property Value
Commit 5faae1c
Checks run Checks #309
Build run Build #2319
Coverage run Coverage #96

@RadicalMuffinMan
RadicalMuffinMan merged commit d2dac9e into Moonfin-Client:main Nov 14, 2026
27 checks passed
@jrodzar
jrodzar deleted the fix/emby-episodes-userid branch November 14, 2026 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

All Bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants