Ensure no duplicate Ids are permitted
This commit is contained in:
parent
fe60457091
commit
7ea26e8fea
@ -191,6 +191,19 @@ public class QueueManager
|
|||||||
return;
|
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.
|
// Limit analysis to the first X% of the episode and at most Y minutes.
|
||||||
// X and Y default to 25% and 10 minutes.
|
// X and Y default to 25% and 10 minutes.
|
||||||
var duration = TimeSpan.FromTicks(episode.RunTimeTicks ?? 0).TotalSeconds;
|
var duration = TimeSpan.FromTicks(episode.RunTimeTicks ?? 0).TotalSeconds;
|
||||||
@ -205,9 +218,6 @@ public class QueueManager
|
|||||||
fingerprintDuration,
|
fingerprintDuration,
|
||||||
60 * Plugin.Instance.Configuration.AnalysisLengthLimit);
|
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
|
// Queue the episode for analysis
|
||||||
var maxCreditsDuration = Plugin.Instance.Configuration.MaximumCreditsDuration;
|
var maxCreditsDuration = Plugin.Instance.Configuration.MaximumCreditsDuration;
|
||||||
_queuedEpisodes[episode.SeasonId].Add(new QueuedEpisode
|
_queuedEpisodes[episode.SeasonId].Add(new QueuedEpisode
|
||||||
|
Loading…
x
Reference in New Issue
Block a user