Ensure no duplicate Ids are permitted. (#147)
This commit is contained in:
parent
ce7fa682d8
commit
cfba1ed39b
@ -200,6 +200,19 @@ public class QueueManager
|
||||
return;
|
||||
}
|
||||
|
||||
// Allocate a new list for each new season
|
||||
_queuedEpisodes.TryAdd(episode.SeasonId, new List<QueuedEpisode>());
|
||||
|
||||
if (_queuedEpisodes[episode.SeasonId].Any(e => e.EpisodeId == episode.Id))
|
||||
{
|
||||
_logger.LogDebug(
|
||||
"\"{Name}\" from series \"{Series}\" ({Id}) is already queued",
|
||||
episode.Name,
|
||||
episode.SeriesName,
|
||||
episode.Id);
|
||||
return;
|
||||
}
|
||||
|
||||
// Limit analysis to the first X% of the episode and at most Y minutes.
|
||||
// X and Y default to 25% and 10 minutes.
|
||||
var duration = TimeSpan.FromTicks(episode.RunTimeTicks ?? 0).TotalSeconds;
|
||||
@ -214,9 +227,6 @@ public class QueueManager
|
||||
fingerprintDuration,
|
||||
60 * Plugin.Instance!.Configuration.AnalysisLengthLimit);
|
||||
|
||||
// Allocate a new list for each new season
|
||||
_queuedEpisodes.TryAdd(episode.SeasonId, new List<QueuedEpisode>());
|
||||
|
||||
// Queue the episode for analysis
|
||||
var maxCreditsDuration = Plugin.Instance!.Configuration.MaximumCreditsDuration;
|
||||
_queuedEpisodes[episode.SeasonId].Add(new QueuedEpisode()
|
||||
|
Loading…
x
Reference in New Issue
Block a user