Commit Graph

1097 Commits

Author SHA1 Message Date
Cody Robibero 2a8d168796 Merge pull request #17579 from Shadowghost/fix-removal-notification
Fix missing ItemRemoved events and search fallback after access filtering
2026-08-10 18:28:22 -04:00
Cody Robibero 35e86416af Merge pull request #17576 from obiwantoby/perf/batch-mediasourcecount-dto
Bugfix: #17547 | Batching MediaSourceCount into one call
2026-08-10 16:15:54 -04:00
TOomaAh 5f3e938d09 fix: bound remote provider pagination 2026-08-09 17:18:54 +02:00
brandon 10d108a1f4 Address review on MediaSourceCount batching
Rename GetItemsWithAlternateVersions to GetItemIdsWithAlternateVersions
across the interfaces and implementations since it returns ids. Return
the hashset straight from the query instead of materializing an array
first. Rename the DtoService guard to mayHaveAlternateVersions and
invert it so the computed path is the explicit case. Assert the media
source count value in the batch skip test and add a test covering an
item that is in the returned set still resolving to the correct count.
2026-08-08 12:33:11 -04:00
Shadowghost e63c05137a Fix missing ItemRemoved events and search fallback after access filtering 2026-08-08 10:59:37 +02:00
brandon c091ffdc6b Batch alternate version detection in DtoService to remove MediaSourceCount N+1
Browsing a page of videos with the MediaSourceCount field ran one alternate
version query per item, each opening a fresh DbContext. On a large library that
turned a single page into hundreds of sequential round trips and made the Items
endpoint take tens of seconds while holding a request thread the whole time.

Detect which videos own alternate versions once per page with a single query,
mirroring the existing people batch. Videos absent from that set have a single
media source, so the per item lookups are skipped for the common case. Behavior
is unchanged: a video with no alternates already resolved to a count of one.

Adds a regression test asserting the count resolves from the batch and the per
item lookups are never called.
2026-08-07 22:51:45 -04:00
brandon d6da6906a4 Batch people lookups when building item DTOs
GetBaseItemDtos already batch fetches user data, child counts, played counts
and artists before its per item loop, but AttachPeople still ran one GetPeople
query per item. Rendering a page of items (for example a large playlist) fired
one extra query per row.

Add GetPeopleByItems to IPeopleRepository, which reads every requested item in a
single query over the people mapping table and returns full PersonInfo (role,
type and sort order) grouped by item id. GetBaseItemDtos prefetches this once
when the People field is requested and passes it into AttachPeople, which reads
from the batch instead of querying per item. The single item GetBaseItemDto path
keeps its existing per item behaviour when no batch is supplied.

Adds a DtoService test asserting people resolve from the batch and the per item
GetPeople is never called.
2026-08-07 11:59:17 -04:00
Cody Robibero 17b0453cfb Merge pull request #17466 from Shadowghost/fix-byname-queries
Improve People deduplication, fix search and restrict ItemByName responses
2026-08-05 18:39:55 -04:00
Shadowghost 4e2089b6a1 Keep folder extras with the item that owns the folder 2026-08-03 10:50:33 +02:00
Shadowghost 8044534774 Merge remote-tracking branch 'upstream/master' into fix-byname-queries 2026-08-02 22:12:57 +02:00
Cody Robibero 24022092ad Merge pull request #17456 from Shadowghost/fix-extras
Fix extras naming and version assignment
2026-08-02 14:25:00 -04:00
Shadowghost 705368ee49 Merge remote-tracking branch 'upstream/master' into fix-byname-queries
# Conflicts:
#	src/Jellyfin.Database/Jellyfin.Database.Providers.Sqlite/Migrations/JellyfinDbModelSnapshot.cs
2026-08-01 21:41:16 +02:00
Cody Robibero e816870f67 Merge pull request #17416 from Shadowghost/enable-duplicate-playlist-children
Allow duplicate LinkedChildren for Playlists
2026-08-01 08:06:02 -04:00
Shadowghost e123a13e38 Apply the by-name access exemption in the search candidate query 2026-07-30 09:53:44 +02:00
Shadowghost 8293eb26b9 Fix playlist entries being lost on migration and library scans 2026-07-29 14:40:49 +02:00
Shadowghost 79a55327dc Fix extras naming and version assignment 2026-07-27 12:12:17 +02:00
Cody Robibero dbc796b0b0 Merge pull request #16409 from elio42/fix/create_library_thumbs_on_first_scan
Fix missing collection folder posters after initial scans.
2026-07-26 16:19:25 -04:00
Cody Robibero 7f26bd1091 Merge pull request #17399 from Shadowghost/fix-extra-year
Fix incorrect year on local trailers
2026-07-25 12:52:51 -04:00
Cody Robibero 86ac1aaa6b Merge branch 'master' into fix/create_library_thumbs_on_first_scan 2026-07-25 12:52:11 -04:00
Cody Robibero ebb66f6ca3 Merge pull request #17395 from paoloantinori/fix/userdata-null-user-nre-master
Avoid NRE when sorting by user-dependent keys without a user
2026-07-25 08:38:43 -04:00
Paolo Antinori 8b70582561 Remove added comments (#17395 review) 2026-07-25 12:50:32 +02:00
Shadowghost 6382563440 Prefer null checks over HasValue everywhere 2026-07-22 08:09:33 +02:00
Paolo Antinori 5d580abb08 fix: avoid NRE when sorting by user-dependent keys without a user
A query sorted by a user-dependent key (PlayCount, IsFavoriteOrLiked,
DatePlayed, IsPlayed, IsUnplayed) but carrying no User caused a
NullReferenceException inside UserDataManager.GetUserData, surfacing as
"Failed to compare two elements in the array" (InvalidOperationException
wrapping the NRE from the LINQ sort) and 500-ing the /Items request.

Root cause: LibraryManager.GetComparer assigned comparer.User = user
without a null guard, so PlayCountComparer.GetValue called
UserDataManager.GetUserData(null, item), dereferencing user.Id.

Two-part fix:
- LibraryManager.GetComparer: when user is null and the sort key requires a
  user (IUserBaseItemComparer), substitute the SortName comparer so the
  result stays deterministic instead of 500-ing. SortName is the project's
  canonical tiebreaker (ItemsController injects it for album-by-artist).
- UserDataManager.GetUserData: ArgumentNullException.ThrowIfNull(user) as
  defense in depth (matches the existing guards on the SaveUserData
  overloads in the same file). On master this overload was rewritten to use
  ResolveUserDataRow, so the NRE dereferences user.Id rather than
  user.InternalId as on the release branch — same bug, different line.

Also fixes DateLastMediaAddedComparer being statically mis-tagged as
IUserBaseItemComparer: its GetDate is static and never reads User, so it
does not need one. Without this, the SortName fallback above would wrongly
engage for DateLastContentAdded on anonymous queries (returning SortName
order instead of date order). Re-tagged to IBaseItemComparer and dropped the
unused User/UserManager/UserDataManager properties.

Tests:
- UserDataManagerTests.GetUserData_NullUser_ThrowsArgumentNullException:
  reproduces the crash (NRE -> now ArgumentNullException). Added to master's
  existing UserDataManagerTests.
- LibraryManagerSortTests.Sort_UserDependentKey_NullUser_FallsBackToSortNameWithoutThrowing:
  Sort with a user-dependent key + null user no longer throws and returns
  items ordered by the SortName fallback (direction preserved).
- LibraryManagerSortTests.Sort_DateLastContentAdded_NullUser_OrdersByDateNotSortName:
  guards that DateLastContentAdded still sorts by date with no user (fixture
  chosen so date-desc and SortName-desc disagree, so a revert is caught).

Full Jellyfin.Server.Implementations.Tests suite: 642 passed, 0 failed.

Fixes #17393
2026-07-22 07:43:58 +02:00
Cody Robibero 526f4051e9 Merge pull request #16980 from TheMelmacian/feature/library_specific_language_filter_values
Improve language filters to only fetch language codes that match the requested items/libraries (follow up to #9787)
2026-07-21 20:43:31 -04:00
Shadowghost ca1f7af445 Fix incorrect year on local trailers 2026-07-21 20:27:04 +02:00
Shadowghost b99703301f Merge remote-tracking branch 'upstream/master' into security-path-traversal-fixes
# Conflicts:
#	Jellyfin.Api/Controllers/HlsSegmentController.cs
#	Jellyfin.Api/Controllers/PluginsController.cs
2026-07-21 07:14:47 +02:00
Cody Robibero bea016c962 Merge pull request #17320 from TaterTechStudios/fix/item-correct-selector
Fix: Fetch the correct row matching the most up to date file
2026-07-20 19:57:28 -04:00
Cody Robibero 191be0931e Merge pull request #17254 from sjakub/attribute_aliases
Add additional attribute aliases and improve attribute detection
2026-07-20 19:45:06 -04:00
theguymadmax ffe075650c Add TVDB provider ID support for movies (#17255)
Add TVDB provider ID support for movies
2026-07-20 12:23:20 +02:00
Bond-009 236db6d2f6 Merge pull request #17365 from Shadowghost/fix-resume-perf
Fix Resume query performance
2026-07-20 08:17:38 +02:00
Bond-009 96727072c8 Merge pull request #17327 from Shadowghost/remove-playbackpositionticks-mediasourceinfo
Remove PlaybackPositionTicks from MediaSourceInfo
2026-07-17 22:21:21 +02:00
Shadowghost 1a45fc82b5 Sanitize media attachment and lyric paths against traversal 2026-07-17 17:07:27 +02:00
Shadowghost cdf7ce0fc4 Fix user data batch query perf 2026-07-16 14:21:03 +02:00
Jordan Rushing 3f96790904 Move GetUserDataBatch to use ResolveUserDataRow when item.UserData isn't preloaded 2026-07-15 16:21:42 -05:00
Shadowghost c6545a8b68 Limit similar items to user accessible libraries 2026-07-15 11:47:59 +02:00
Shadowghost b8bac71270 remove PlaybackPositionTicks from MediaSourceInfo 2026-07-14 10:05:32 +02:00
Jordan Rushing fcce108948 Fix: Fetch the correct row matching the most up to date file 2026-07-13 15:40:40 -05:00
Jakub Schmidtke 08f6627a24 Replaced string.Empty with ReadOnlySpan<char>.Empty 2026-07-08 01:40:26 +02:00
Jakub Schmidtke 1294990f4f Added more aliases for attributes
Adds tvdb alias for tvdbid and imdb alias for imdbid.

It also fixes an issue where tmdb alias was being ignored
if it was followed by something like "tmdbidfoo".
The same issue prevented imdb pattern matching from
working, if it was followed by something like "imdbidfoo".

It also allows for detecting the first matching occurence,
whether it was an alias or not.

Finally, it ignores attributes with values consisting of only whitespaces.
2026-07-07 15:39:09 +02:00
Cody Robibero 6e728b009f Merge pull request #17044 from Shadowghost/version-model-and-handling
Fixes for multi version handling
2026-07-05 16:21:02 -04:00
theguymadmax 43a152359e Fix ghost entries when deleting library paths 2026-07-03 14:12:56 -04:00
Shadowghost 38f1d9749e Fix review comments 2026-07-02 08:49:11 +02:00
Bond-009 3741d71965 Merge pull request #17116 from theguymadmax/fix-root-folder-parsing 2026-06-21 00:10:26 +02:00
Shadowghost 0fb042b740 Surface the played version for resume 2026-06-19 21:51:57 +02:00
Bond-009 bebb7ce803 Merge pull request #17112 from theguymadmax/add-year-to-series-resolver
Fix series year lost during name parsing
2026-06-18 17:46:23 +02:00
theguymadmax b9271eb199 Skip parsing root-level folders in SeriesResolver 2026-06-15 19:37:39 -04:00
theguymadmax 068bbb7981 Fix series year lost during parsing 2026-06-15 11:42:17 -04:00
dkanada f4bab458a2 improve book resolution from filename 2026-06-15 11:31:49 +09:00
Shadowghost 0aeee8233b Fix performance 2026-06-12 08:35:30 +02:00
Shadowghost 95de28cdda Merge remote-tracking branch 'upstream/master' into version-model-and-handling 2026-06-10 08:05:03 +02:00