diff options
| author | JPVenson <github@jpb.email> | 2024-10-09 23:19:24 +0000 |
|---|---|---|
| committer | JPVenson <github@jpb.email> | 2024-10-09 23:19:24 +0000 |
| commit | 2955f2f56275fca01cd3f586b3475dcdfbea78ed (patch) | |
| tree | c9202c3ad903e704058c9d9b745ef90d1c150ca9 /Jellyfin.Server.Implementations/Item/BaseItemRepository.cs | |
| parent | eb601e944cd392a8007b540ab5627977a37368c6 (diff) | |
Fixed AncestorIds and applied review comments
Diffstat (limited to 'Jellyfin.Server.Implementations/Item/BaseItemRepository.cs')
| -rw-r--r-- | Jellyfin.Server.Implementations/Item/BaseItemRepository.cs | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/Jellyfin.Server.Implementations/Item/BaseItemRepository.cs b/Jellyfin.Server.Implementations/Item/BaseItemRepository.cs index 6ddab9e3d..6603b15e2 100644 --- a/Jellyfin.Server.Implementations/Item/BaseItemRepository.cs +++ b/Jellyfin.Server.Implementations/Item/BaseItemRepository.cs @@ -83,7 +83,7 @@ public sealed class BaseItemRepository(IDbContextFactory<JellyfinDbContext> dbPr using var transaction = context.Database.BeginTransaction(); context.ItemValues.Where(e => e.Type == 6).ExecuteDelete(); - context.ItemValues.AddRange(context.ItemValues.Where(e => e.Type == 4).Select(e => new Data.Entities.ItemValue() + context.ItemValues.AddRange(context.ItemValues.Where(e => e.Type == 4).Select(e => new ItemValue() { CleanValue = e.CleanValue, ItemId = e.ItemId, @@ -93,7 +93,7 @@ public sealed class BaseItemRepository(IDbContextFactory<JellyfinDbContext> dbPr })); context.ItemValues.AddRange( - context.AncestorIds.Where(e => e.AncestorIdText != null).Join(context.ItemValues.Where(e => e.Value != null && e.Type == 4), e => e.Id, e => e.ItemId, (e, f) => new Data.Entities.ItemValue() + context.AncestorIds.Join(context.ItemValues.Where(e => e.Value != null && e.Type == 4), e => e.ParentItemId, e => e.ItemId, (e, f) => new ItemValue() { CleanValue = f.CleanValue, ItemId = e.ItemId, @@ -893,31 +893,31 @@ public sealed class BaseItemRepository(IDbContextFactory<JellyfinDbContext> dbPr if (!string.IsNullOrWhiteSpace(filter.HasNoAudioTrackWithLanguage)) { baseQuery = baseQuery - .Where(e => !e.MediaStreams!.Any(e => e.StreamType == "Audio" && e.Language == filter.HasNoAudioTrackWithLanguage)); + .Where(e => !e.MediaStreams!.Any(e => e.StreamType == MediaStreamTypeEntity.Audio && e.Language == filter.HasNoAudioTrackWithLanguage)); } if (!string.IsNullOrWhiteSpace(filter.HasNoInternalSubtitleTrackWithLanguage)) { baseQuery = baseQuery - .Where(e => !e.MediaStreams!.Any(e => e.StreamType == "Subtitle" && !e.IsExternal && e.Language == filter.HasNoInternalSubtitleTrackWithLanguage)); + .Where(e => !e.MediaStreams!.Any(e => e.StreamType == MediaStreamTypeEntity.Subtitle && !e.IsExternal && e.Language == filter.HasNoInternalSubtitleTrackWithLanguage)); } if (!string.IsNullOrWhiteSpace(filter.HasNoExternalSubtitleTrackWithLanguage)) { baseQuery = baseQuery - .Where(e => !e.MediaStreams!.Any(e => e.StreamType == "Subtitle" && e.IsExternal && e.Language == filter.HasNoExternalSubtitleTrackWithLanguage)); + .Where(e => !e.MediaStreams!.Any(e => e.StreamType == MediaStreamTypeEntity.Subtitle && e.IsExternal && e.Language == filter.HasNoExternalSubtitleTrackWithLanguage)); } if (!string.IsNullOrWhiteSpace(filter.HasNoSubtitleTrackWithLanguage)) { baseQuery = baseQuery - .Where(e => !e.MediaStreams!.Any(e => e.StreamType == "Subtitle" && e.Language == filter.HasNoSubtitleTrackWithLanguage)); + .Where(e => !e.MediaStreams!.Any(e => e.StreamType == MediaStreamTypeEntity.Subtitle && e.Language == filter.HasNoSubtitleTrackWithLanguage)); } if (filter.HasSubtitles.HasValue) { baseQuery = baseQuery - .Where(e => e.MediaStreams!.Any(e => e.StreamType == "Subtitle") == filter.HasSubtitles.Value); + .Where(e => e.MediaStreams!.Any(e => e.StreamType == MediaStreamTypeEntity.Subtitle) == filter.HasSubtitles.Value); } if (filter.HasChapterImages.HasValue) @@ -1062,7 +1062,7 @@ public sealed class BaseItemRepository(IDbContextFactory<JellyfinDbContext> dbPr if (filter.AncestorIds.Length > 0) { - baseQuery = baseQuery.Where(e => e.AncestorIds!.Any(f => filter.AncestorIds.Contains(f.Id))); + baseQuery = baseQuery.Where(e => e.AncestorIds!.Any(f => filter.AncestorIds.Contains(f.ParentItemId))); } if (!string.IsNullOrWhiteSpace(filter.AncestorWithPresentationUniqueKey)) @@ -1273,9 +1273,7 @@ public sealed class BaseItemRepository(IDbContextFactory<JellyfinDbContext> dbPr { entity.AncestorIds.Add(new AncestorId() { - Item = entity, - AncestorIdText = ancestorId.ToString(), - Id = ancestorId, + ParentItemId = ancestorId, ItemId = entity.Id }); } |
