aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Server.Implementations/Item
diff options
context:
space:
mode:
Diffstat (limited to 'Jellyfin.Server.Implementations/Item')
-rw-r--r--Jellyfin.Server.Implementations/Item/BaseItemRepository.cs18
-rw-r--r--Jellyfin.Server.Implementations/Item/MediaStreamRepository.cs4
-rw-r--r--Jellyfin.Server.Implementations/Item/PeopleRepository.cs6
3 files changed, 17 insertions, 11 deletions
diff --git a/Jellyfin.Server.Implementations/Item/BaseItemRepository.cs b/Jellyfin.Server.Implementations/Item/BaseItemRepository.cs
index f9a9837f1..392b7de74 100644
--- a/Jellyfin.Server.Implementations/Item/BaseItemRepository.cs
+++ b/Jellyfin.Server.Implementations/Item/BaseItemRepository.cs
@@ -553,7 +553,7 @@ public sealed class BaseItemRepository
dto.Genres = entity.Genres?.Split('|') ?? [];
dto.DateCreated = entity.DateCreated.GetValueOrDefault();
dto.DateModified = entity.DateModified.GetValueOrDefault();
- dto.ChannelId = string.IsNullOrWhiteSpace(entity.ChannelId) ? Guid.Empty : (Guid.TryParse(entity.ChannelId, out var channelId) ? channelId : Guid.Empty);
+ dto.ChannelId = entity.ChannelId ?? Guid.Empty;
dto.DateLastRefreshed = entity.DateLastRefreshed.GetValueOrDefault();
dto.DateLastSaved = entity.DateLastSaved.GetValueOrDefault();
dto.OwnerId = string.IsNullOrWhiteSpace(entity.OwnerId) ? Guid.Empty : (Guid.TryParse(entity.OwnerId, out var ownerId) ? ownerId : Guid.Empty);
@@ -689,6 +689,7 @@ public sealed class BaseItemRepository
entity.IndexNumber = dto.IndexNumber;
entity.IsLocked = dto.IsLocked;
entity.Name = dto.Name;
+ entity.CleanName = GetCleanValue(dto.Name);
entity.OfficialRating = dto.OfficialRating;
entity.Overview = dto.Overview;
entity.ParentIndexNumber = dto.ParentIndexNumber;
@@ -716,7 +717,7 @@ public sealed class BaseItemRepository
entity.Genres = string.Join('|', dto.Genres);
entity.DateCreated = dto.DateCreated;
entity.DateModified = dto.DateModified;
- entity.ChannelId = dto.ChannelId.ToString();
+ entity.ChannelId = dto.ChannelId;
entity.DateLastRefreshed = dto.DateLastRefreshed;
entity.DateLastSaved = dto.DateLastSaved;
entity.OwnerId = dto.OwnerId.ToString();
@@ -821,10 +822,9 @@ public sealed class BaseItemRepository
entity.StartDate = hasStartDate.StartDate;
}
+ entity.UnratedType = dto.GetBlockUnratedType().ToString();
+
// Fields that are present in the DB but are never actually used
- // dto.UnratedType = entity.UnratedType;
- // dto.TopParentId = entity.TopParentId;
- // dto.CleanName = entity.CleanName;
// dto.UserDataKey = entity.UserDataKey;
if (dto is Folder folder)
@@ -854,7 +854,10 @@ public sealed class BaseItemRepository
}
// query = query.DistinctBy(e => e.CleanValue);
- return query.Select(e => e.ItemValue.CleanValue).ToArray();
+ return query.Select(e => e.ItemValue)
+ .GroupBy(e => e.CleanValue)
+ .Select(e => e.First().Value)
+ .ToArray();
}
private static bool TypeRequiresDeserialization(Type type)
@@ -1448,8 +1451,7 @@ public sealed class BaseItemRepository
if (filter.ChannelIds.Count > 0)
{
- var channelIds = filter.ChannelIds.Select(e => e.ToString("N", CultureInfo.InvariantCulture)).ToArray();
- baseQuery = baseQuery.Where(e => channelIds.Contains(e.ChannelId));
+ baseQuery = baseQuery.Where(e => e.ChannelId != null && filter.ChannelIds.Contains(e.ChannelId.Value));
}
if (!filter.ParentId.IsEmpty())
diff --git a/Jellyfin.Server.Implementations/Item/MediaStreamRepository.cs b/Jellyfin.Server.Implementations/Item/MediaStreamRepository.cs
index d6bfc1a8f..f47e3fdfd 100644
--- a/Jellyfin.Server.Implementations/Item/MediaStreamRepository.cs
+++ b/Jellyfin.Server.Implementations/Item/MediaStreamRepository.cs
@@ -88,7 +88,7 @@ public class MediaStreamRepository : IMediaStreamRepository
query = query.Where(e => e.StreamType == typeValue);
}
- return query;
+ return query.OrderBy(e => e.StreamIndex);
}
private MediaStream Map(MediaStreamInfo entity)
@@ -137,7 +137,7 @@ public class MediaStreamRepository : IMediaStreamRepository
dto.ElPresentFlag = entity.ElPresentFlag;
dto.BlPresentFlag = entity.BlPresentFlag;
dto.DvBlSignalCompatibilityId = entity.DvBlSignalCompatibilityId;
- dto.IsHearingImpaired = entity.IsHearingImpaired;
+ dto.IsHearingImpaired = entity.IsHearingImpaired.GetValueOrDefault();
dto.Rotation = entity.Rotation;
if (dto.Type is MediaStreamType.Audio or MediaStreamType.Subtitle)
diff --git a/Jellyfin.Server.Implementations/Item/PeopleRepository.cs b/Jellyfin.Server.Implementations/Item/PeopleRepository.cs
index d1823514a..a8dfd4cd3 100644
--- a/Jellyfin.Server.Implementations/Item/PeopleRepository.cs
+++ b/Jellyfin.Server.Implementations/Item/PeopleRepository.cs
@@ -11,6 +11,9 @@ using Microsoft.EntityFrameworkCore;
namespace Jellyfin.Server.Implementations.Item;
#pragma warning disable RS0030 // Do not use banned APIs
+#pragma warning disable CA1304 // Specify CultureInfo
+#pragma warning disable CA1311 // Specify a culture or use an invariant version
+#pragma warning disable CA1862 // Use the 'StringComparison' method overloads to perform case-insensitive string comparisons
/// <summary>
/// Manager for handling people.
@@ -155,7 +158,8 @@ public class PeopleRepository(IDbContextFactory<JellyfinDbContext> dbProvider, I
if (!string.IsNullOrWhiteSpace(filter.NameContains))
{
- query = query.Where(e => e.Name.Contains(filter.NameContains));
+ var nameContainsUpper = filter.NameContains.ToUpper();
+ query = query.Where(e => e.Name.ToUpper().Contains(nameContainsUpper));
}
return query;