Cleanup
This commit is contained in:
parent
98b4b66a27
commit
46355d19d4
@ -127,7 +127,7 @@ public class AutoSkip : IServerEntryPoint
|
||||
// Don't send the seek command more than once in the same session.
|
||||
lock (_sentSeekCommandLock)
|
||||
{
|
||||
if (_sentSeekCommand[deviceId])
|
||||
if (_sentSeekCommand.TryGetValue(deviceId, out var sent) && sent)
|
||||
{
|
||||
_logger.LogTrace("Already sent seek command for session {Session}", deviceId);
|
||||
continue;
|
||||
|
@ -52,12 +52,7 @@ public class SkipIntroController : ControllerBase
|
||||
/// <returns>Intro object if the provided item has an intro, null otherwise.</returns>
|
||||
private Intro? GetIntro(Guid id)
|
||||
{
|
||||
if (!Plugin.Instance!.Intros.ContainsKey(id))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return Plugin.Instance!.Intros[id];
|
||||
return Plugin.Instance!.Intros.TryGetValue(id, out var intro) ? intro : null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -147,14 +147,6 @@ public class QueueManager
|
||||
return;
|
||||
}
|
||||
|
||||
var queue = Plugin.Instance.AnalysisQueue;
|
||||
|
||||
// Allocate a new list for each new season
|
||||
if (!queue.ContainsKey(episode.SeasonId))
|
||||
{
|
||||
Plugin.Instance.AnalysisQueue[episode.SeasonId] = new List<QueuedEpisode>();
|
||||
}
|
||||
|
||||
// Only fingerprint up to 25% of the episode and at most 10 minutes.
|
||||
var duration = TimeSpan.FromTicks(episode.RunTimeTicks ?? 0).TotalSeconds;
|
||||
if (duration >= 5 * 60)
|
||||
@ -164,6 +156,10 @@ public class QueueManager
|
||||
|
||||
duration = Math.Min(duration, 10 * 60);
|
||||
|
||||
// Allocate a new list for each new season
|
||||
Plugin.Instance!.AnalysisQueue.TryAdd(episode.SeasonId, new List<QueuedEpisode>());
|
||||
|
||||
// Queue the episode for analysis
|
||||
Plugin.Instance.AnalysisQueue[episode.SeasonId].Add(new QueuedEpisode()
|
||||
{
|
||||
SeriesName = episode.SeriesName,
|
||||
|
@ -724,11 +724,17 @@ public class FingerprinterTask : IScheduledTask
|
||||
// Analyze the episode again, ignoring whatever is returned for the known good episode.
|
||||
foreach (var lhsFingerprint in goodFingerprints)
|
||||
{
|
||||
if (!_fingerprintCache.TryGetValue(episode.EpisodeId, out var fp))
|
||||
{
|
||||
_logger.LogTrace("Unable to get cached fingerprint for {Id}, skipping", episode.EpisodeId);
|
||||
continue;
|
||||
}
|
||||
|
||||
var (_, newRhs) = FingerprintEpisodes(
|
||||
maxEpisode.EpisodeId,
|
||||
lhsFingerprint,
|
||||
episode.EpisodeId,
|
||||
_fingerprintCache[episode.EpisodeId]);
|
||||
fp);
|
||||
|
||||
// Ensure that the new intro duration is within the targeted bucket and longer than what was found previously.
|
||||
var newDuration = Math.Round(newRhs.IntroEnd - newRhs.IntroStart, 2);
|
||||
|
Loading…
x
Reference in New Issue
Block a user