From d6cebf1e67f30063d572519e31b0459b58f3e4b0 Mon Sep 17 00:00:00 2001 From: theguymadmax Date: Wed, 1 Oct 2025 19:26:48 -0400 Subject: [PATCH] Add tag filtering and random sorting to GetSimilarItems (#14918) --- Emby.Server.Implementations/Library/LibraryManager.cs | 2 +- Jellyfin.Api/Controllers/LibraryController.cs | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.cs index 102779729e..ef497726e2 100644 --- a/Emby.Server.Implementations/Library/LibraryManager.cs +++ b/Emby.Server.Implementations/Library/LibraryManager.cs @@ -528,7 +528,7 @@ namespace Emby.Server.Implementations.Library { Genre => _configurationManager.ApplicationPaths.GenrePath, MusicArtist => _configurationManager.ApplicationPaths.ArtistsPath, - MusicGenre => _configurationManager.ApplicationPaths.GenrePath, + MusicGenre => _configurationManager.ApplicationPaths.MusicGenrePath, Person => _configurationManager.ApplicationPaths.PeoplePath, Studio => _configurationManager.ApplicationPaths.StudioPath, Year => _configurationManager.ApplicationPaths.YearPath, diff --git a/Jellyfin.Api/Controllers/LibraryController.cs b/Jellyfin.Api/Controllers/LibraryController.cs index b18d7e05d4..4c9cc2b1e8 100644 --- a/Jellyfin.Api/Controllers/LibraryController.cs +++ b/Jellyfin.Api/Controllers/LibraryController.cs @@ -779,12 +779,14 @@ public class LibraryController : BaseJellyfinApiController var query = new InternalItemsQuery(user) { Genres = item.Genres, + Tags = item.Tags, Limit = limit, IncludeItemTypes = includeItemTypes.ToArray(), DtoOptions = dtoOptions, EnableTotalRecordCount = !isMovie ?? true, EnableGroupByMetadataKey = isMovie ?? false, - ExcludeItemIds = [itemId] + ExcludeItemIds = [itemId], + OrderBy = [(ItemSortBy.Random, SortOrder.Ascending)] }; // ExcludeArtistIds