diff --git a/src/Jellyfin.MediaEncoding.Hls/ScheduledTasks/KeyframeExtractionScheduledTask.cs b/src/Jellyfin.MediaEncoding.Hls/ScheduledTasks/KeyframeExtractionScheduledTask.cs index 42f48785c8..d0e3b00d03 100644 --- a/src/Jellyfin.MediaEncoding.Hls/ScheduledTasks/KeyframeExtractionScheduledTask.cs +++ b/src/Jellyfin.MediaEncoding.Hls/ScheduledTasks/KeyframeExtractionScheduledTask.cs @@ -62,10 +62,11 @@ public class KeyframeExtractionScheduledTask : IScheduledTask }; var videos = _libraryManager.GetItemList(query); + var numberOfVideos = videos.Count; var numComplete = 0; // TODO parallelize with Parallel.ForEach? - for (var i = 0; i < videos.Count; i++) + for (var i = 0; i < numberOfVideos; i++) { var video = videos[i]; // Only local files supported @@ -86,7 +87,7 @@ public class KeyframeExtractionScheduledTask : IScheduledTask // Update progress numComplete++; - double percent = (double)numComplete / videos.Count; + double percent = (double)numComplete / numberOfVideos; progress.Report(100 * percent); }