Commit Graph

83 Commits

Author SHA1 Message Date
unkin-agent 1c59e6afcb perf(nextup): batch the user data reads the next episode selection makes
ci/woodpecker/push/ci Pipeline was successful
ci/woodpecker/pr/ci Pipeline was successful
Next Up walked every series in an unpaginated loop and read user data one
episode at a time, so the Home screen row cost two queries per series once the
cache was gone.

- read the played state of every candidate episode in one query
- read the versions the resume check and the last played date need in one query each
- default PrefetchedUserData on IUserBaseItemComparer so plugin comparers still compile
- cover the bounded query count and the plugin comparer with tests
- share one database across the replica tests
2026-09-21 00:36:39 +10:00
unkin-agent a7919b9bac fix(userdata): read user data through to the database
ci/woodpecker/pr/ci Pipeline was successful
ci/woodpecker/push/ci Pipeline was successful
The user data cache and the item's in-memory rows were both filled once per
replica and never invalidated, so a pod serving a playback tick read its own
stale resume position and wrote it back over the position another pod had just
saved, silently losing resume points, played state, favourites and ratings.

- drop the user item data cache
- read single and batched user data from the database on every query
- prefetch user data for in-memory sorts and filters so each stays one query
- cover the lost update against real PostgreSQL with two manager instances
2026-09-20 23:51:29 +10:00
Shadowghost fd016cfb13 Share played state across alternate versions 2026-09-06 17:20:18 +02:00
Shadowghost 50f08d41a4 Find dead people and artists by id, not by name 2026-09-01 19:49:25 +02:00
Shadowghost ea5f83328d Support anime provider ids on season folders 2026-08-28 15:48:17 +02:00
Shadowghost a81b90f570 Fix tests 2026-08-25 21:03:51 +02:00
Shadowghost 79a55327dc Fix extras naming and version assignment 2026-07-27 12:12:17 +02: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
Paolo Antinori 8b70582561 Remove added comments (#17395 review) 2026-07-25 12:50:32 +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
Shadowghost ca1f7af445 Fix incorrect year on local trailers 2026-07-21 20:27:04 +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
Jordan Rushing 3f96790904 Move GetUserDataBatch to use ResolveUserDataRow when item.UserData isn't preloaded 2026-07-15 16:21:42 -05: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 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
Shadowghost 0874a26131 Coalesce alternate-version progress onto primary in resume filter 2026-06-09 23:23:03 +02:00
Shadowghost d5bb7756f1 Implement multiple versions for episodes. 2026-05-11 16:41:22 +02:00
Erik W e1e18e8da0 Add OriginalLanguage as option to PreferredAudioLanguage (#12579)
* Add OriginalLanguage as option to PreferredAudioLanguage

* Support for multiple original languages

* Add original audio stream indicator

* Fetch OriginalLanguage from TMDB

* Adapt to EFCore refactor

* Fix PlayDefaultAudioTrack OriginalLanguage behavior

* Fix better PlayDefaultAudioTrack OriginalLanguage behavior

* Add comment to ItemFields

* Improved PlayDefaultAudioTrack behavior

* Add migration for original language

* Use sting.Equals for string comparisons

* Always set dto OriginalLanguage

* Remove OriginalLanguage from ItemFields

---------

Co-authored-by: Lampan-git <lampan-git@users.noreply.github.com>
2026-05-07 20:07:23 +02:00
Bond-009 33ed52b8ee Merge branch 'master' into feature/season-provider-id-from-path 2026-05-06 20:49:19 +02:00
Shadowghost d20c775daf Implement ignore rule caching 2026-05-03 23:35:33 +02:00
Marc Brooks aa96ff42e6 Parse provider IDs from season and episode folder/file names
Season and episode directories/files can now include provider ID
attributes in their names (e.g. "Season 01 [tvdbid=22222]" or
"Show S01E01 [tmdbid=99999].mkv"), consistent with the existing
behavior for series folders.

Supported providers: imdbid, tvdbid, tvmazeid, tmdbid.

Adds TmdbSeasonExternalId and TmdbEpisodeExternalId so that
the TMDB season and episode IDs are surfaced in the metadata editor.

Seasons do not have their own IMDb IDs, so we don't support imdbid parsing
in SeasonResolver. Instead, generate IMDb season URLs via
ImdbExternalUrlProvider using the parent series' IMDb ID and the
season number, matching the IMDb URL format:
imdb.com/title/{seriesId}/episodes/?season={N}

Add tests for the ExternalUrlProviders.
2026-03-25 18:47:40 -05:00
Bond-009 909e2142d6 Merge pull request #14927 from nileshp87/patch-1
Add curly brace and parentheses support for parsing attribute values
2026-02-02 20:54:06 +01:00
Bond-009 8083ab78b5 Fix tests 2026-02-02 20:46:28 +01:00
theguymadmax 0c274af72c Backport pull request #16077 from jellyfin/release-10.11.z
Revert hidden directory ignore pattern

Original-merge: 644327eb76

Merged-by: crobibero <cody@robibe.ro>

Backported-by: Bond_009 <bond.009@outlook.com>
2026-01-28 12:11:28 -05:00
theguymadmax c9b7c5bb56 Backport pull request #16029 from jellyfin/release-10.11.z
Skip hidden directories and .ignore paths in library monitoring

Original-merge: 2cb7fb52d2

Merged-by: crobibero <cody@robibe.ro>

Backported-by: Bond_009 <bond.009@outlook.com>
2026-01-18 11:30:43 -05:00
Shadowghost b9cf26db2f Backport pull request #15746 from jellyfin/release-10.11.z
Skip invalid ignore rules

Original-merge: 6e60634c9f

Merged-by: crobibero <cody@robibe.ro>

Backported-by: Bond_009 <bond.009@outlook.com>
2025-12-28 07:22:20 -05:00
Nilesh Patel acb9da6f93 Add curly brace and parentheses support for parsing attribute values from paths 2025-12-10 12:23:05 -08:00
Sven Cazier 7785b51f57 Enhance extra rules for video and audio file naming; update tests for new naming conventions 2025-07-26 23:24:58 +02:00
Tim Eisele a0b3b7335f Add .gitignore style ignoring (#13906) 2025-04-26 09:35:57 -06:00
Jordan Fearnley 730a75a88a Chore: Adds unit tests to support (#11351) 2024-04-13 09:41:17 +02:00
Bond_009 7bf831da62 Fix tests 2023-12-18 22:02:31 +01:00
Cody Robibero 033cfa59c4 Convert CollectionType to use lowercase enum names 2023-12-08 15:45:36 -07:00
Cody Robibero 906f701fa8 Convert CollectionType, SpecialFolderType to enum (#9764)
* Convert CollectionType, SpecialFolderType to enum

* Hide internal enum CollectionType values

* Apply suggestions from code review

Co-authored-by: Shadowghost <Shadowghost@users.noreply.github.com>

* Fix recent change

* Update Jellyfin.Data/Attributes/OpenApiIgnoreEnumAttribute.cs

Co-authored-by: Patrick Barron <barronpm@gmail.com>

---------

Co-authored-by: Shadowghost <Shadowghost@users.noreply.github.com>
Co-authored-by: Patrick Barron <barronpm@gmail.com>
2023-11-09 14:00:29 -07:00
Stepan Goremykin 8ea812b65d Reduce string literal length by using verbatim string 2023-10-08 00:26:12 +02:00
Bond_009 cc15ea7f65 Ignore .zfs folder
Maybe helps with #10215 ?
2023-09-27 20:35:00 +02:00
AmbulantRex 891b9f7a99 Add DLL whitelist support for plugins 2023-03-30 08:59:21 -06:00
SenorSmartyPants b9f7e3971e Add test for cleaning extra names 2023-03-18 21:52:04 -05:00
Joe Rogers 361fff3a0c Fix cases where multiple files are resolved as a single book 2023-03-06 23:27:21 -05:00
Joe Rogers 18b8efa7e0 Add tests for audio book resolving 2023-03-06 23:22:37 -05:00
Joe Rogers 1c3a97bf6a Inject IDirectoryService where needed instead of passing it through ItemResolveArgs 2023-03-06 23:00:55 -05:00
Joe Rogers 160baa02fd Remove some BaseItem references to make ItemResolveArgs more usable for testing. 2023-03-06 22:18:26 -05:00
Bond-009 769c48c629 Deduplicate media stream ordering code (#9014) 2023-01-07 11:30:55 -07:00
Bond-009 3462676a8f Fix debug builds (#8909) 2022-12-14 22:03:03 +01:00
Joe Rogers 644e774040 Fix default audio selection ignoring type 2022-05-17 21:03:51 +02:00
Joe Rogers e89d1a3be5 Add tests for preferred audio language selection 2022-04-30 15:36:09 +02:00
Stanislav Ionascu 554d1b2ca8 Fix #7100 by catching the exception on opening invalid UDF images
When an invalid UDF image is opened by the UdfReader, it may throw
and exception. This change is to catch and log the exception.
2022-02-20 13:30:55 +00:00
Bond_009 dbd7be091d Fix MediaStreamSelector 2022-02-14 15:03:08 +01:00
Joe Rogers 8b706cebef Add alternate resolver test, generate extra folder names 2022-01-16 23:00:30 +01:00