Check cancellation token
This commit is contained in:
parent
cf99dde0e2
commit
7612e6cdaf
@ -126,8 +126,7 @@ public class AnalyzeEpisodesTask : IScheduledTask
|
|||||||
// Log EDL settings
|
// Log EDL settings
|
||||||
EdlManager.LogConfiguration();
|
EdlManager.LogConfiguration();
|
||||||
|
|
||||||
// Include the previously processed episodes in the percentage reported to the UI.
|
var totalProcessed = 0;
|
||||||
var totalProcessed = CountProcessedEpisodes();
|
|
||||||
var options = new ParallelOptions()
|
var options = new ParallelOptions()
|
||||||
{
|
{
|
||||||
MaxDegreeOfParallelism = Plugin.Instance!.Configuration.MaxParallelism
|
MaxDegreeOfParallelism = Plugin.Instance!.Configuration.MaxParallelism
|
||||||
@ -151,6 +150,11 @@ public class AnalyzeEpisodesTask : IScheduledTask
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
if (cancellationToken.IsCancellationRequested)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var episodes = new ReadOnlyCollection<QueuedEpisode>(season.Value);
|
var episodes = new ReadOnlyCollection<QueuedEpisode>(season.Value);
|
||||||
|
|
||||||
// Increment totalProcessed by the number of episodes in this season that were actually analyzed
|
// Increment totalProcessed by the number of episodes in this season that were actually analyzed
|
||||||
@ -268,6 +272,11 @@ public class AnalyzeEpisodesTask : IScheduledTask
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
fingerprintCache[episode.EpisodeId] = FFmpegWrapper.Fingerprint(episode);
|
fingerprintCache[episode.EpisodeId] = FFmpegWrapper.Fingerprint(episode);
|
||||||
|
|
||||||
|
if (cancellationToken.IsCancellationRequested)
|
||||||
|
{
|
||||||
|
return episodes.Count;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (FingerprintException ex)
|
catch (FingerprintException ex)
|
||||||
{
|
{
|
||||||
@ -324,6 +333,11 @@ public class AnalyzeEpisodesTask : IScheduledTask
|
|||||||
// If no intro is found at this point, the popped episode is not reinserted into the queue.
|
// If no intro is found at this point, the popped episode is not reinserted into the queue.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cancellationToken.IsCancellationRequested)
|
||||||
|
{
|
||||||
|
return episodes.Count;
|
||||||
|
}
|
||||||
|
|
||||||
// Adjust all introduction end times so that they end at silence.
|
// Adjust all introduction end times so that they end at silence.
|
||||||
seasonIntros = AdjustIntroEndTimes(episodes, seasonIntros);
|
seasonIntros = AdjustIntroEndTimes(episodes, seasonIntros);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user