221 Commits

Author SHA1 Message Date
Shadowghost 2644163f57 Count distinct items for byName ItemCounts and batch every kind 2026-09-07 18:39:59 +02:00
Shadowghost 27d898e59e Count a season's episodes by the season they belong to 2026-08-29 21:39:14 +02:00
Shadowghost 2aad6047c8 Fix children count on virtual items 2026-08-26 18:57:50 +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
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
Shadowghost 9aa79682ba Reduce correlated subqueries to improve performance 2026-07-23 20:50:06 +02:00
Shadowghost 38813f7d42 Cleanup PreferEpisodeParentPoster) 2026-07-09 12:07:13 +02:00
Shadowghost 853922443f Remove episode image override hack 2026-07-09 11:54:18 +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
Shadowghost 38f1d9749e Fix review comments 2026-07-02 08:49:11 +02:00
Marc Brooks 70b4589382 Fix Book collections scanning all items
Added static method GetBaseItemKindsForCollectionType in ItemsController (moved from ContentFolderImageProvider to be shared)

Added AudioBook to GetRepresentativeItemTypes for CollectionType.books for consistency

Added GetBooks to GetUserItems for CollectionType.books which gets BaseItemKind.Book and BaseItemKind.AudioBook

Move GetBaseItemKindsForCollectionType to DtoExtensions

Cleaned up the missing null checks and used new collection expressions.
Associate Person to Book and AudioBook for related items.
2026-06-26 11:25:58 -05:00
Shadowghost 0874a26131 Coalesce alternate-version progress onto primary in resume filter 2026-06-09 23:23:03 +02:00
Shadowghost a53a533cc4 Respect user permissions in version count 2026-06-07 23:06:14 +02:00
Bond-009 003f01a99a Merge pull request #16520 from beateixeira04/PlaylistPrimaryImageFix
fix(dto): prefer PlaylistsFolder primary image for playlists tiles
2026-06-07 22:56:35 +02:00
Shadowghost 5feb70f489 Fix recently added episode links and posters 2026-05-29 10:41:50 +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
Shadowghost 0d58c773f9 Fix review comments 2026-05-04 21:42:31 +02:00
Shadowghost 88cad2ad1a Speed-up LatestItems for Music 2026-05-04 02:00:38 +02:00
Shadowghost d68d0fa962 Merge remote-tracking branch 'upstream/master' into perf-rebased 2026-05-03 13:31:23 +02:00
Seven Rats f5f75ed2e1 feat/audiobook_chapters (#16518)
feat/audiobook_chapters
2026-05-03 12:18:20 +02:00
Shadowghost 24a0df9a39 Merge remote-tracking branch 'upstream/master' into perf-rebased 2026-04-07 21:36:07 +02:00
HeroBrine1st Erquilenne 9b00854e68 Add AlbumNormalizationGain field to BaseItemDto 2026-04-02 20:03:48 +03:00
Shadowghost 99ad70fbc8 Wrap method parameters 2026-04-01 18:01:25 +02:00
Beatriz Teixeira 8ceb8c23ce fix(dto): prefer PlaylistsFolder primary image for playlists tiles
This patch fixes issue #16032 where the Playlists media folder ignored a user-uploaded Primary image and kept showing the generated collage. The root cause was DTO image precedence on UserView items for CollectionType.playlists. We now prefer the display parent (PlaylistsFolder) Primary image when available by clearing the UserView Primary tag and setting ParentPrimaryImageItemId/ParentPrimaryImageTag. Added tests cover both paths: parent custom image preferred, and fallback to existing UserView Primary when parent has none.
2026-03-29 15:27:32 +01:00
Shadowghost 3a090a5716 Optimize item count calculation for named items 2026-02-18 20:28:42 +01:00
Shadowghost 268d88a5fb Optimize Collection Grouping, NextUp and Latest queries 2026-02-07 01:38:06 +01:00
Shadowghost a650148dfd Merge remote-tracking branch 'upstream/master' into perf-rebased 2026-01-30 21:12:06 +01:00
theguymadmax ec4744709d Backport pull request #15816 from jellyfin/release-10.11.z
Fix artist display order

Original-merge: a2b1936e73

Merged-by: joshuaboniface <joshua@boniface.me>

Backported-by: Bond_009 <bond.009@outlook.com>
2026-01-28 12:11:23 -05:00
Shadowghost 5996c4afce Complete LinkedChildren integration and batch DTO optimizations
This commit integrates remaining performance changes:

- Add batch user data fetching in DtoService to reduce N+1 queries
- Add GetNextUpEpisodesBatch in TVSeriesManager for efficient batch retrieval
- Update Video/Movie/BoxSet to use LibraryManager for alternate versions
- Transition LinkedChild to use ItemId instead of Path (obsolete Path/LibraryItemId)
- Update providers and controllers for LinkedChildren-based references
- Add NextUpEpisodeBatchResult for batched episode queries
- Integrate IDescendantQueryProvider in SqliteDatabaseProvider
2026-01-18 19:48:46 +01:00
JPVenson 5a6d9180fe Add People Dedup and multiple progress fixes (#14848) 2025-09-24 15:20:30 -06:00
Cody Robibero beca405ad4 Refactor to pull item counts in a single query 2025-08-11 21:06:04 -06:00
Evan 0a4ff3f3c0 Fix GetBaseItemDto to return related item counts via SQL count
For API call /Items/{item id} GetBaseItemDto will return the counts of related items e.g. artists, albums, songs.  GetBaseItemDto currently does this by calling GetTaggedItems which retrieves the objects into memory to count them.  Replace with SQL count.

Fixes:
This should be an improvement for any large libraries, but especially large music libraries.  Example:

Request Library -> Genres -> any very popular genre in your large library, e.g. Classical
Number of albums = 1552, songs = 23515, ...

- Before change: Try to retrieve 1552 albums, 23515 songs, ... in memory, API never returns, database on fire
- After change: API returns in 367ms and Genre view opens with 200 albums in 2 seconds

I verified the numbers returned are correct but note that there is a bug somewhere else in Jellyfin that is setting TopParentId to NULL for a large portion of my MusicArtists, which causes them to not be counted by the existing GetCount().  This is not related to this change, also happens with the existing code, and does not seem to affect the Web UI.

Includes Cory's changes in:
- https://github.com/jellyfin/jellyfin/pull/14610#issuecomment-3172211468
- https://github.com/jellyfin/jellyfin/pull/14610#issuecomment-3172239154
2025-08-10 18:02:17 +08:00
Cody Robibero afa2103d42 Use dto instead of db object when returning trickplay 2025-06-16 18:55:21 -06:00
Tim Eisele df5671263f Merge pull request #13847 from Shadowghost/rework-chapter-management
Rework chapter management
2025-04-26 14:01:12 +02:00
Tim Eisele 086fbd49cf Cleanup ItemFields (#13818)
* Cleanup ItemFields

* Update MediaBrowser.Model/Querying/ItemFields.cs
2025-03-31 17:46:21 -06:00
JPVenson 42bdb22bfb Fixed namespaces 2025-03-25 16:45:00 +01:00
JPVenson b09a41ad1f WIP porting new Repository structure 2024-10-09 10:36:08 +00:00
Bond_009 2b3ebb0751 Enable nullable for DtoService and DtoOptions 2024-07-29 21:05:40 +02:00
Bond_009 2ad872001d Address comments 2024-04-28 17:16:33 +02:00
Bond_009 88a38a61b5 Improve audio normalization
* Move calculation of LUFS to a scheduled task as it's pretty slow
* Correctly calculate album LUFS
* Don't try to convert replaygain tags to LUFS values
2024-04-28 15:18:53 +02:00
Bond-009 7d28d08e08 Enable more warnings as errors (#11288) 2024-04-12 17:45:01 -06:00
Niels van Velzen 84b933d835 Use enum for BaseItemDto.ExtraType (#11261) 2024-03-31 14:48:46 -06:00
Cody Robibero 0bc41c015f Store lyrics in the database as media streams (#9951) 2024-02-26 05:09:40 -07:00
Patrick Barron 0370167b8d Add IRecordingsManager service 2024-02-21 09:42:14 -05:00
Niels van Velzen 55916a09eb Remove some unused client capabilities and sync code (#10812) 2024-01-06 13:33:48 -07:00
Nick cd662506a1 Merge branch 'master' into trickplay 2023-10-18 19:27:05 -07:00
Nick 5a860710a8 Make TrickplayManifest dictionary key a string rather than Guid 2023-09-04 12:30:20 -07:00
TelepathicWalrus 4c7fb8f452 Album gain (#10085)
* Add LUFSAlbum DTO

* Get loudest track for smallest gain

* Move gain search to musicalbum
use baseitem LUFS for album

* Use .Max for enumerable

* Update DTO to be consistent with other DTOs

* Remove albumlufs,
Move dto for all types
2023-08-18 10:25:56 +02:00
Nick fc61933748 Minor code changes 2023-06-26 22:04:39 -07:00