mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-07-03 12:23:27 +02:00
Fix progress
This commit is contained in:
parent
768b76b999
commit
b9d4cbf3e8
|
@ -63,32 +63,27 @@ public class KeyframeExtractionScheduledTask : IScheduledTask
|
||||||
|
|
||||||
var videos = _libraryManager.GetItemList(query);
|
var videos = _libraryManager.GetItemList(query);
|
||||||
var numberOfVideos = videos.Count;
|
var numberOfVideos = videos.Count;
|
||||||
var numComplete = 0;
|
|
||||||
|
|
||||||
// TODO parallelize with Parallel.ForEach?
|
// TODO parallelize with Parallel.ForEach?
|
||||||
for (var i = 0; i < numberOfVideos; i++)
|
for (var i = 0; i < numberOfVideos; i++)
|
||||||
{
|
{
|
||||||
var video = videos[i];
|
var video = videos[i];
|
||||||
// Only local files supported
|
// Only local files supported
|
||||||
if (!video.IsFileProtocol || !File.Exists(video.Path))
|
if (video.IsFileProtocol && File.Exists(video.Path))
|
||||||
{
|
{
|
||||||
continue;
|
for (var j = 0; j < _keyframeExtractors.Length; j++)
|
||||||
}
|
|
||||||
|
|
||||||
for (var j = 0; j < _keyframeExtractors.Length; j++)
|
|
||||||
{
|
|
||||||
var extractor = _keyframeExtractors[j];
|
|
||||||
// The cache decorator will make sure to save them in the data dir
|
|
||||||
if (extractor.TryExtractKeyframes(video.Path, out _))
|
|
||||||
{
|
{
|
||||||
break;
|
var extractor = _keyframeExtractors[j];
|
||||||
|
// The cache decorator will make sure to save them in the data dir
|
||||||
|
if (extractor.TryExtractKeyframes(video.Path, out _))
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update progress
|
// Update progress
|
||||||
numComplete++;
|
double percent = (double)(i + 1) / numberOfVideos;
|
||||||
double percent = (double)numComplete / numberOfVideos;
|
|
||||||
|
|
||||||
progress.Report(100 * percent);
|
progress.Report(100 * percent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue