From f92806c2468a9856d714fc7ac3c5cc418ba3c1e9 Mon Sep 17 00:00:00 2001 From: cvium Date: Tue, 11 Jan 2022 23:32:39 +0100 Subject: [PATCH] Use local var for the length --- .../ScheduledTasks/KeyframeExtractionScheduledTask.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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); }