aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Server.Implementations
diff options
context:
space:
mode:
authorTheMelmacian <76712303+TheMelmacian@users.noreply.github.com>2026-05-12 01:47:07 +0200
committerTheMelmacian <76712303+TheMelmacian@users.noreply.github.com>2026-05-12 02:12:14 +0200
commit39049a726e1a88e8acf1d8cc5c217bc8d86be9ae (patch)
tree5239b36e5511781bbb4abea70054b3c7600bbb92 /Jellyfin.Server.Implementations
parent5701cdce684dbbcdfdd5cc4c79586fe623e9f2d0 (diff)
move language filters from QueryFiltersLegacy to QueryFilters
Diffstat (limited to 'Jellyfin.Server.Implementations')
-rw-r--r--Jellyfin.Server.Implementations/Item/BaseItemRepository.Querying.cs36
-rw-r--r--Jellyfin.Server.Implementations/Item/BaseItemRepository.TranslateQuery.cs1
-rw-r--r--Jellyfin.Server.Implementations/Item/MediaStreamRepository.cs11
3 files changed, 13 insertions, 35 deletions
diff --git a/Jellyfin.Server.Implementations/Item/BaseItemRepository.Querying.cs b/Jellyfin.Server.Implementations/Item/BaseItemRepository.Querying.cs
index 71b46b3cb5..dc16c3b1b3 100644
--- a/Jellyfin.Server.Implementations/Item/BaseItemRepository.Querying.cs
+++ b/Jellyfin.Server.Implementations/Item/BaseItemRepository.Querying.cs
@@ -535,46 +535,12 @@ public sealed partial class BaseItemRepository
.OrderBy(g => g)
.ToArray();
- // At the moment language filters are only available for video types (Movie and Series libraries).
- // They are fetched directly from the MediaStreamInfos table and only filtered by StreamType.
- // This is the fastest and most perfomant way to get the list of available languages,
- // but the filter values can include language tags that are not linked to any item in the current library.
- var subtitleLanguages = IncludesVideoTypes(filter)
- ? context.MediaStreamInfos
- .Where(s => s.StreamType == MediaStreamTypeEntity.Subtitle)
- .Select(s => string.IsNullOrEmpty(s.Language) ? "und" : s.Language) // und = undetermined
- .Distinct()
- .OrderBy(l => l)
- .ToArray()
- : [];
-
- var audioLanguages = IncludesVideoTypes(filter)
- ? context.MediaStreamInfos
- .Where(s => s.StreamType == MediaStreamTypeEntity.Audio)
- .Select(s => string.IsNullOrEmpty(s.Language) ? "und" : s.Language) // und = undetermined
- .Distinct()
- .OrderBy(l => l)
- .ToArray()
- : [];
-
return new QueryFiltersLegacy
{
Years = years,
OfficialRatings = officialRatings,
Tags = tags,
- Genres = genres,
- SubtitleLanguages = subtitleLanguages,
- AudioLanguages = audioLanguages
+ Genres = genres
};
}
-
- private bool IncludesVideoTypes(InternalItemsQuery filter)
- {
- return filter.IncludeItemTypes.Contains(BaseItemKind.Movie)
- || filter.IncludeItemTypes.Contains(BaseItemKind.Video)
- || filter.IncludeItemTypes.Contains(BaseItemKind.Series)
- || filter.IncludeItemTypes.Contains(BaseItemKind.Season)
- || filter.IncludeItemTypes.Contains(BaseItemKind.Episode)
- || filter.IncludeItemTypes.Contains(BaseItemKind.Trailer);
- }
}
diff --git a/Jellyfin.Server.Implementations/Item/BaseItemRepository.TranslateQuery.cs b/Jellyfin.Server.Implementations/Item/BaseItemRepository.TranslateQuery.cs
index b58e7fffe3..3d1aafd72e 100644
--- a/Jellyfin.Server.Implementations/Item/BaseItemRepository.TranslateQuery.cs
+++ b/Jellyfin.Server.Implementations/Item/BaseItemRepository.TranslateQuery.cs
@@ -1078,6 +1078,7 @@ public sealed partial class BaseItemRepository
{
// Dvds and Blu-rays can either be stored in a folder structure or as an iso file
// => to find all matches we need to check both: VideoType and IsoType
+ // alternatively, we could provide specific IsoType filters
var videoTypeBs = filter.VideoTypes.Select(vt => $"\"VideoType\":\"{vt}\"").ToArray();
var isoTypeBs = filter.VideoTypes.Select(vt => $"\"IsoType\":\"{vt}\"").ToArray();
Expression<Func<BaseItemEntity, bool>> hasVideoType = e => videoTypeBs.Any(f => e.Data!.Contains(f)) || isoTypeBs.Any(f => e.Data!.Contains(f));
diff --git a/Jellyfin.Server.Implementations/Item/MediaStreamRepository.cs b/Jellyfin.Server.Implementations/Item/MediaStreamRepository.cs
index dd0446f49a..7fa33c8639 100644
--- a/Jellyfin.Server.Implementations/Item/MediaStreamRepository.cs
+++ b/Jellyfin.Server.Implementations/Item/MediaStreamRepository.cs
@@ -55,6 +55,17 @@ public class MediaStreamRepository : IMediaStreamRepository
return TranslateQuery(context.MediaStreamInfos.AsNoTracking(), filter).AsEnumerable().Select(Map).ToArray();
}
+ /// <inheritdoc />
+ public IReadOnlyList<string> GetMediaStreamLanguages(MediaStreamType mediaStreamType)
+ {
+ using var context = _dbProvider.CreateDbContext();
+ return context.MediaStreamInfos
+ .Where(e => e.StreamType == (MediaStreamTypeEntity)mediaStreamType)
+ .Select(s => string.IsNullOrEmpty(s.Language) ? "und" : s.Language) // und = undetermined
+ .Distinct()
+ .ToArray();
+ }
+
private string? GetPathToSave(string? path)
{
if (path is null)