mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-03-25 19:46:34 +00:00
Fix distinction queries (#14007)
This commit is contained in:
@@ -125,8 +125,8 @@ namespace Jellyfin.LiveTv
|
||||
IsKids = query.IsKids,
|
||||
IsSports = query.IsSports,
|
||||
IsSeries = query.IsSeries,
|
||||
IncludeItemTypes = new[] { BaseItemKind.LiveTvChannel },
|
||||
TopParentIds = new[] { topFolder.Id },
|
||||
IncludeItemTypes = [BaseItemKind.LiveTvChannel],
|
||||
TopParentIds = [topFolder.Id],
|
||||
IsFavorite = query.IsFavorite,
|
||||
IsLiked = query.IsLiked,
|
||||
StartIndex = query.StartIndex,
|
||||
@@ -199,17 +199,17 @@ namespace Jellyfin.LiveTv
|
||||
if (query.OrderBy.Count == 0)
|
||||
{
|
||||
// Unless something else was specified, order by start date to take advantage of a specialized index
|
||||
query.OrderBy = new[]
|
||||
{
|
||||
query.OrderBy =
|
||||
[
|
||||
(ItemSortBy.StartDate, SortOrder.Ascending)
|
||||
};
|
||||
];
|
||||
}
|
||||
|
||||
RemoveFields(options);
|
||||
|
||||
var internalQuery = new InternalItemsQuery(user)
|
||||
{
|
||||
IncludeItemTypes = new[] { BaseItemKind.LiveTvProgram },
|
||||
IncludeItemTypes = [BaseItemKind.LiveTvProgram],
|
||||
MinEndDate = query.MinEndDate,
|
||||
MinStartDate = query.MinStartDate,
|
||||
MaxEndDate = query.MaxEndDate,
|
||||
@@ -226,7 +226,7 @@ namespace Jellyfin.LiveTv
|
||||
Limit = query.Limit,
|
||||
OrderBy = query.OrderBy,
|
||||
EnableTotalRecordCount = query.EnableTotalRecordCount,
|
||||
TopParentIds = new[] { topFolder.Id },
|
||||
TopParentIds = [topFolder.Id],
|
||||
Name = query.Name,
|
||||
DtoOptions = options,
|
||||
HasAired = query.HasAired,
|
||||
@@ -272,7 +272,7 @@ namespace Jellyfin.LiveTv
|
||||
|
||||
var internalQuery = new InternalItemsQuery(user)
|
||||
{
|
||||
IncludeItemTypes = new[] { BaseItemKind.LiveTvProgram },
|
||||
IncludeItemTypes = [BaseItemKind.LiveTvProgram],
|
||||
IsAiring = query.IsAiring,
|
||||
HasAired = query.HasAired,
|
||||
IsNews = query.IsNews,
|
||||
@@ -281,8 +281,8 @@ namespace Jellyfin.LiveTv
|
||||
IsSports = query.IsSports,
|
||||
IsKids = query.IsKids,
|
||||
EnableTotalRecordCount = query.EnableTotalRecordCount,
|
||||
OrderBy = new[] { (ItemSortBy.StartDate, SortOrder.Ascending) },
|
||||
TopParentIds = new[] { topFolder.Id },
|
||||
OrderBy = [(ItemSortBy.StartDate, SortOrder.Ascending)],
|
||||
TopParentIds = [topFolder.Id],
|
||||
DtoOptions = options,
|
||||
GenreIds = query.GenreIds
|
||||
};
|
||||
@@ -497,19 +497,19 @@ namespace Jellyfin.LiveTv
|
||||
// TotalRecordCount = items.Length
|
||||
// };
|
||||
|
||||
dtoOptions.Fields = dtoOptions.Fields.Concat(new[] { ItemFields.Tags }).Distinct().ToArray();
|
||||
dtoOptions.Fields = dtoOptions.Fields.Concat([ItemFields.Tags]).Distinct().ToArray();
|
||||
}
|
||||
|
||||
var result = _libraryManager.GetItemsResult(new InternalItemsQuery(user)
|
||||
{
|
||||
MediaTypes = new[] { MediaType.Video },
|
||||
MediaTypes = [MediaType.Video],
|
||||
Recursive = true,
|
||||
AncestorIds = folderIds,
|
||||
IsFolder = false,
|
||||
IsVirtualItem = false,
|
||||
Limit = limit,
|
||||
StartIndex = query.StartIndex,
|
||||
OrderBy = new[] { (ItemSortBy.DateCreated, SortOrder.Descending) },
|
||||
OrderBy = [(ItemSortBy.DateCreated, SortOrder.Descending)],
|
||||
EnableTotalRecordCount = query.EnableTotalRecordCount,
|
||||
IncludeItemTypes = includeItemTypes.ToArray(),
|
||||
ExcludeItemTypes = excludeItemTypes.ToArray(),
|
||||
@@ -959,13 +959,13 @@ namespace Jellyfin.LiveTv
|
||||
|
||||
var programs = options.AddCurrentProgram ? _libraryManager.GetItemList(new InternalItemsQuery(user)
|
||||
{
|
||||
IncludeItemTypes = new[] { BaseItemKind.LiveTvProgram },
|
||||
IncludeItemTypes = [BaseItemKind.LiveTvProgram],
|
||||
ChannelIds = channelIds,
|
||||
MaxStartDate = now,
|
||||
MinEndDate = now,
|
||||
Limit = channelIds.Length,
|
||||
OrderBy = new[] { (ItemSortBy.StartDate, SortOrder.Ascending) },
|
||||
TopParentIds = new[] { GetInternalLiveTvFolder(CancellationToken.None).Id },
|
||||
OrderBy = [(ItemSortBy.StartDate, SortOrder.Ascending)],
|
||||
TopParentIds = [GetInternalLiveTvFolder(CancellationToken.None).Id],
|
||||
DtoOptions = options
|
||||
}) : new List<BaseItem>();
|
||||
|
||||
@@ -1269,7 +1269,7 @@ namespace Jellyfin.LiveTv
|
||||
{
|
||||
var folders = _recordingsManager.GetRecordingFolders()
|
||||
.SelectMany(i => i.Locations)
|
||||
.Distinct(StringComparer.OrdinalIgnoreCase)
|
||||
.Distinct()
|
||||
.Select(i => _libraryManager.FindByPath(i, true))
|
||||
.Where(i => i is not null && i.IsVisibleStandalone(user))
|
||||
.SelectMany(i => _libraryManager.GetCollectionFolders(i))
|
||||
|
||||
@@ -230,7 +230,7 @@ public sealed class RecordingsManager : IRecordingsManager, IDisposable
|
||||
if (pathsAdded.Count > 0 || pathsToRemove.Count > 0)
|
||||
{
|
||||
pathsAdded.InsertRange(0, config.MediaLocationsCreated);
|
||||
config.MediaLocationsCreated = pathsAdded.Except(pathsToRemove).Distinct(StringComparer.OrdinalIgnoreCase).ToArray();
|
||||
config.MediaLocationsCreated = pathsAdded.Except(pathsToRemove).Distinct().ToArray();
|
||||
_config.SaveConfiguration("livetv", config);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user