diff options
| author | JPVenson <github@jpb.email> | 2025-02-19 18:25:00 +0000 |
|---|---|---|
| committer | JPVenson <github@jpb.email> | 2025-02-19 18:25:00 +0000 |
| commit | d8030147ffea8bd6b2753ac52e56b92fb15a1b47 (patch) | |
| tree | 834693b6ccc31280a1a8bf28ac781e18a28ea1dc /Jellyfin.Server.Implementations/Item/BaseItemRepository.cs | |
| parent | ddc20b74bf2eddd686c14c084260ca457011f8be (diff) | |
| parent | 712908d53c7ca38d13e03ea7809e0c40e862a5fb (diff) | |
Merge remote-tracking branch 'jellyfinorigin/master' into feature/DatabaseRefactor
Diffstat (limited to 'Jellyfin.Server.Implementations/Item/BaseItemRepository.cs')
| -rw-r--r-- | Jellyfin.Server.Implementations/Item/BaseItemRepository.cs | 18 |
1 files changed, 10 insertions, 8 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()) |
