aboutsummaryrefslogtreecommitdiff
path: root/src/Jellyfin.Database/Jellyfin.Database.Implementations
diff options
context:
space:
mode:
authorBond-009 <bond.009@outlook.com>2026-05-15 15:44:22 +0200
committerGitHub <noreply@github.com>2026-05-15 15:44:22 +0200
commit9d420271ad4d9468683fda79d906bcd348f4979c (patch)
treed6adbc5e2bc327242c50c81e200167720cdbd3d2 /src/Jellyfin.Database/Jellyfin.Database.Implementations
parentd93e2d6667872ea16c523202f200c873fc8191ad (diff)
parentfae4950ac2b5918081198ee5f876dd82ca81ae5d (diff)
Merge pull request #9787 from TheMelmacian/feature/language_filters
New filters for audio and subtitle languages
Diffstat (limited to 'src/Jellyfin.Database/Jellyfin.Database.Implementations')
-rw-r--r--src/Jellyfin.Database/Jellyfin.Database.Implementations/DescendantQueryHelper.cs4
-rw-r--r--src/Jellyfin.Database/Jellyfin.Database.Implementations/MatchCriteria/HasMediaStreamType.cs23
2 files changed, 23 insertions, 4 deletions
diff --git a/src/Jellyfin.Database/Jellyfin.Database.Implementations/DescendantQueryHelper.cs b/src/Jellyfin.Database/Jellyfin.Database.Implementations/DescendantQueryHelper.cs
index 43e6a8bc00..88a2c684ff 100644
--- a/src/Jellyfin.Database/Jellyfin.Database.Implementations/DescendantQueryHelper.cs
+++ b/src/Jellyfin.Database/Jellyfin.Database.Implementations/DescendantQueryHelper.cs
@@ -111,7 +111,9 @@ public static class DescendantQueryHelper
private static HashSet<Guid> GetMatchingMediaStreamItemIds(JellyfinDbContext context, HasMediaStreamType criteria)
{
var query = context.MediaStreamInfos
- .Where(ms => ms.StreamType == criteria.StreamType && ms.Language == criteria.Language);
+ .Where(ms => ms.StreamType == criteria.StreamType
+ && (criteria.Language.Contains(ms.Language)
+ || (criteria.Language.Contains("und") && string.IsNullOrEmpty(ms.Language)))); // und = undetermined
if (criteria.IsExternal.HasValue)
{
diff --git a/src/Jellyfin.Database/Jellyfin.Database.Implementations/MatchCriteria/HasMediaStreamType.cs b/src/Jellyfin.Database/Jellyfin.Database.Implementations/MatchCriteria/HasMediaStreamType.cs
index 68f2ca2786..c1f6ab16a9 100644
--- a/src/Jellyfin.Database/Jellyfin.Database.Implementations/MatchCriteria/HasMediaStreamType.cs
+++ b/src/Jellyfin.Database/Jellyfin.Database.Implementations/MatchCriteria/HasMediaStreamType.cs
@@ -1,3 +1,6 @@
+#pragma warning disable SA1313 // Parameter names should begin with lower-case letter
+
+using System.Collections.Generic;
using Jellyfin.Database.Implementations.Entities;
namespace Jellyfin.Database.Implementations.MatchCriteria;
@@ -6,9 +9,23 @@ namespace Jellyfin.Database.Implementations.MatchCriteria;
/// Matches folders containing descendants with a specific media stream type and language.
/// </summary>
/// <param name="StreamType">The type of media stream to match (Audio, Subtitle, etc.).</param>
-/// <param name="Language">The language to match.</param>
+/// <param name="Language">List of languages to match.</param>
/// <param name="IsExternal">If not null, filters by internal (false) or external (true) streams. Only applicable to subtitles.</param>
public sealed record HasMediaStreamType(
MediaStreamTypeEntity StreamType,
- string Language,
- bool? IsExternal = null) : FolderMatchCriteria;
+ IReadOnlyCollection<string> Language,
+ bool? IsExternal = null) : FolderMatchCriteria
+{
+ /// <summary>
+ /// Initializes a new instance of the <see cref="HasMediaStreamType"/> class.
+ /// </summary>
+ /// <param name="StreamType">The type of media stream to match (Audio, Subtitle, etc.).</param>
+ /// <param name="Language">The language to match.</param>
+ /// <param name="IsExternal">If not null, filters by internal (false) or external (true) streams. Only applicable to subtitles.</param>
+ public HasMediaStreamType(
+ MediaStreamTypeEntity StreamType,
+ string Language,
+ bool? IsExternal = null) : this(StreamType, [Language], IsExternal)
+ {
+ }
+}