more progress bar fixes
This commit is contained in:
parent
250c8acfbd
commit
7800b48193
@ -88,6 +88,7 @@ public class BaseItemAnalyzerTask
|
|||||||
}
|
}
|
||||||
|
|
||||||
var totalProcessed = 0;
|
var totalProcessed = 0;
|
||||||
|
var modeCount = _analysisModes.Count;
|
||||||
var options = new ParallelOptions()
|
var options = new ParallelOptions()
|
||||||
{
|
{
|
||||||
MaxDegreeOfParallelism = Plugin.Instance!.Configuration.MaxParallelism
|
MaxDegreeOfParallelism = Plugin.Instance!.Configuration.MaxParallelism
|
||||||
@ -103,23 +104,35 @@ public class BaseItemAnalyzerTask
|
|||||||
season.Value.AsReadOnly(),
|
season.Value.AsReadOnly(),
|
||||||
_analysisModes);
|
_analysisModes);
|
||||||
|
|
||||||
if (episodes.Count == 0)
|
var episodeCount = episodes.Count;
|
||||||
|
|
||||||
|
if (episodeCount == 0)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var first = episodes[0];
|
var first = episodes[0];
|
||||||
|
var requiredModeCount = requiredModes.Count;
|
||||||
|
|
||||||
if (requiredModes.Count == 0)
|
if (requiredModeCount == 0)
|
||||||
{
|
{
|
||||||
_logger.LogDebug(
|
_logger.LogDebug(
|
||||||
"All episodes in {Name} season {Season} have already been analyzed",
|
"All episodes in {Name} season {Season} have already been analyzed",
|
||||||
first.SeriesName,
|
first.SeriesName,
|
||||||
first.SeasonNumber);
|
first.SeasonNumber);
|
||||||
|
|
||||||
|
Interlocked.Add(ref totalProcessed, (episodeCount * modeCount)); // Update totalProcessed directly
|
||||||
|
progress.Report((totalProcessed * 100) / totalQueued);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (modeCount != requiredModeCount)
|
||||||
|
{
|
||||||
|
Interlocked.Add(ref totalProcessed, episodeCount);
|
||||||
|
progress.Report((totalProcessed * 100) / totalQueued); // Partial analysis some modes have already been analyzed
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (cancellationToken.IsCancellationRequested)
|
if (cancellationToken.IsCancellationRequested)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user