Merge pull request #16322 from poytiis/remove-ToList-calls

Remove unnecessary ToList calls in TrickplayManager
This commit is contained in:
Bond-009
2026-05-06 17:40:12 +02:00
committed by GitHub
2 changed files with 3 additions and 2 deletions

View File

@@ -118,6 +118,7 @@
- [Phlogi](https://github.com/Phlogi)
- [pjeanjean](https://github.com/pjeanjean)
- [ploughpuff](https://github.com/ploughpuff)
- [poytiis](https://github.com/poytiis)
- [pR0Ps](https://github.com/pR0Ps)
- [PrplHaz4](https://github.com/PrplHaz4)
- [RazeLighter777](https://github.com/RazeLighter777)

View File

@@ -198,13 +198,13 @@ public class TrickplayManager : ITrickplayManager
// Cleanup old trickplay files
if (Directory.Exists(trickplayDirectory))
{
var existingFolders = Directory.GetDirectories(trickplayDirectory).ToList();
var existingFolders = Directory.GetDirectories(trickplayDirectory);
var trickplayInfos = await dbContext.TrickplayInfos
.AsNoTracking()
.Where(i => i.ItemId.Equals(video.Id))
.ToListAsync(cancellationToken)
.ConfigureAwait(false);
var expectedFolders = trickplayInfos.Select(i => GetTrickplayDirectory(video, i.TileWidth, i.TileHeight, i.Width, saveWithMedia)).ToList();
var expectedFolders = trickplayInfos.Select(i => GetTrickplayDirectory(video, i.TileWidth, i.TileHeight, i.Width, saveWithMedia));
var foldersToRemove = existingFolders.Except(expectedFolders);
foreach (var folder in foldersToRemove)
{