mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-05 21:37:10 -04:00
Paginate movies query
Signed-off-by: Petrus.Z <silencly07@gmail.com>
This commit is contained in:
parent
6d74c83ddb
commit
b635b5a7e3
@ -62,30 +62,40 @@ namespace Emby.Server.Implementations.Library.Validators
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var movies = _libraryManager.GetItemList(new InternalItemsQuery
|
var startIndex = 0;
|
||||||
{
|
var pagesize = 1000;
|
||||||
MediaTypes = new string[] { MediaType.Video },
|
|
||||||
IncludeItemTypes = new[] { nameof(Movie) },
|
|
||||||
IsVirtualItem = false,
|
|
||||||
OrderBy = new[] { (ItemSortBy.SortName, SortOrder.Ascending) },
|
|
||||||
Parent = library,
|
|
||||||
Recursive = true
|
|
||||||
});
|
|
||||||
|
|
||||||
foreach (var m in movies)
|
while (true)
|
||||||
{
|
{
|
||||||
if (m is Movie movie && !string.IsNullOrEmpty(movie.CollectionName))
|
var movies = _libraryManager.GetItemList(new InternalItemsQuery
|
||||||
{
|
{
|
||||||
if (collectionNameMoviesMap.TryGetValue(movie.CollectionName, out var movieList))
|
MediaTypes = new string[] { MediaType.Video },
|
||||||
|
IncludeItemTypes = new[] { nameof(Movie) },
|
||||||
|
IsVirtualItem = false,
|
||||||
|
OrderBy = new[] { (ItemSortBy.SortName, SortOrder.Ascending) },
|
||||||
|
Parent = library,
|
||||||
|
StartIndex = startIndex,
|
||||||
|
Limit = pagesize,
|
||||||
|
Recursive = true
|
||||||
|
});
|
||||||
|
startIndex += pagesize;
|
||||||
|
|
||||||
|
if (!movies.Any()) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var m in movies)
|
||||||
|
{
|
||||||
|
if (m is Movie movie && !string.IsNullOrEmpty(movie.CollectionName))
|
||||||
{
|
{
|
||||||
if (!movieList.Contains(movie.Id))
|
if (collectionNameMoviesMap.TryGetValue(movie.CollectionName, out var movieList))
|
||||||
{
|
{
|
||||||
movieList.Add(movie.Id);
|
movieList.Add(movie.Id);
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
else
|
{
|
||||||
{
|
collectionNameMoviesMap[movie.CollectionName] = new HashSet<Guid> { movie.Id };
|
||||||
collectionNameMoviesMap[movie.CollectionName] = new HashSet<Guid> { movie.Id };
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user