remove redundant suppression
This commit is contained in:
parent
28689a917a
commit
58f4617ebc
@ -52,7 +52,7 @@ public class ChapterAnalyzer : IMediaFileAnalyzer
|
||||
|
||||
var skipRange = FindMatchingChapter(
|
||||
episode,
|
||||
new(Plugin.Instance!.GetChapters(episode.EpisodeId)),
|
||||
new(Plugin.Instance.GetChapters(episode.EpisodeId)),
|
||||
expression,
|
||||
mode);
|
||||
|
||||
@ -64,7 +64,7 @@ public class ChapterAnalyzer : IMediaFileAnalyzer
|
||||
skippableRanges.Add(episode.EpisodeId, skipRange);
|
||||
}
|
||||
|
||||
Plugin.Instance!.UpdateTimestamps(skippableRanges, mode);
|
||||
Plugin.Instance.UpdateTimestamps(skippableRanges, mode);
|
||||
|
||||
return analysisQueue
|
||||
.Where(x => !skippableRanges.ContainsKey(x.EpisodeId))
|
||||
|
@ -146,7 +146,7 @@ public class AutoSkip : IHostedService, IDisposable
|
||||
}
|
||||
|
||||
// Notify the user that an introduction is being skipped for them.
|
||||
var notificationText = Plugin.Instance!.Configuration.AutoSkipNotificationText;
|
||||
var notificationText = Plugin.Instance.Configuration.AutoSkipNotificationText;
|
||||
if (!string.IsNullOrWhiteSpace(notificationText))
|
||||
{
|
||||
_sessionManager.SendMessageCommand(
|
||||
@ -163,7 +163,7 @@ public class AutoSkip : IHostedService, IDisposable
|
||||
|
||||
_logger.LogDebug("Sending seek command to {Session}", deviceId);
|
||||
|
||||
var introEnd = (long)intro.IntroEnd - Plugin.Instance!.Configuration.SecondsOfIntroToPlay;
|
||||
var introEnd = (long)intro.IntroEnd - Plugin.Instance.Configuration.SecondsOfIntroToPlay;
|
||||
|
||||
_sessionManager.SendPlaystateCommand(
|
||||
session.Id,
|
||||
@ -221,7 +221,7 @@ public class AutoSkip : IHostedService, IDisposable
|
||||
_playbackTimer.AutoReset = true;
|
||||
_playbackTimer.Elapsed += PlaybackTimer_Elapsed;
|
||||
|
||||
AutoSkipChanged(null, Plugin.Instance!.Configuration);
|
||||
AutoSkipChanged(null, Plugin.Instance.Configuration);
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ public class SkipIntroController : ControllerBase
|
||||
// Operate on a copy to avoid mutating the original Intro object stored in the dictionary.
|
||||
var segment = new Intro(timestamp);
|
||||
|
||||
var config = Plugin.Instance!.Configuration;
|
||||
var config = Plugin.Instance.Configuration;
|
||||
segment.IntroEnd -= config.SecondsOfIntroToPlay;
|
||||
if (config.PersistSkipButton)
|
||||
{
|
||||
@ -153,7 +153,7 @@ public class SkipIntroController : ControllerBase
|
||||
foreach (var intro in timestamps)
|
||||
{
|
||||
// Get the details of the item from Jellyfin
|
||||
var rawItem = Plugin.Instance!.GetItem(intro.Key);
|
||||
var rawItem = Plugin.Instance.GetItem(intro.Key);
|
||||
if (rawItem is not Episode episode)
|
||||
{
|
||||
throw new InvalidCastException("Unable to cast item id " + intro.Key + " to an Episode");
|
||||
|
@ -49,11 +49,11 @@ public class TroubleshootingController : ControllerBase
|
||||
bundle.Append(_applicationHost.ApplicationVersionString);
|
||||
bundle.Append('\n');
|
||||
|
||||
var version = Plugin.Instance!.Version.ToString(3);
|
||||
var version = Plugin.Instance.Version.ToString(3);
|
||||
|
||||
try
|
||||
{
|
||||
var commit = Plugin.Instance!.GetCommit();
|
||||
var commit = Plugin.Instance.GetCommit();
|
||||
if (!string.IsNullOrWhiteSpace(commit))
|
||||
{
|
||||
version += string.Concat("+", commit.AsSpan(0, 12));
|
||||
@ -69,9 +69,9 @@ public class TroubleshootingController : ControllerBase
|
||||
bundle.Append('\n');
|
||||
|
||||
bundle.Append("* Queue contents: ");
|
||||
bundle.Append(Plugin.Instance!.TotalQueued);
|
||||
bundle.Append(Plugin.Instance.TotalQueued);
|
||||
bundle.Append(" episodes, ");
|
||||
bundle.Append(Plugin.Instance!.TotalSeasons);
|
||||
bundle.Append(Plugin.Instance.TotalSeasons);
|
||||
bundle.Append(" seasons\n");
|
||||
|
||||
bundle.Append("* Warnings: `");
|
||||
|
@ -159,7 +159,7 @@ public class VisualizationController : ControllerBase
|
||||
{
|
||||
var tr = new TimeRange(timestamps.IntroStart, timestamps.IntroEnd);
|
||||
Plugin.Instance!.Intros[id] = new Intro(id, tr);
|
||||
Plugin.Instance!.SaveTimestamps();
|
||||
Plugin.Instance.SaveTimestamps();
|
||||
|
||||
return NoContent();
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ public static class EdlManager
|
||||
public static void UpdateEDLFiles(ReadOnlyCollection<QueuedEpisode> episodes)
|
||||
{
|
||||
var regenerate = Plugin.Instance!.Configuration.RegenerateEdlFiles;
|
||||
var action = Plugin.Instance!.Configuration.EdlAction;
|
||||
var action = Plugin.Instance.Configuration.EdlAction;
|
||||
if (action == EdlAction.None)
|
||||
{
|
||||
_logger?.LogDebug("EDL action is set to none, not updating EDL files");
|
||||
@ -63,7 +63,7 @@ public static class EdlManager
|
||||
{
|
||||
var id = episode.EpisodeId;
|
||||
|
||||
if (!Plugin.Instance!.Intros.TryGetValue(id, out var intro))
|
||||
if (!Plugin.Instance.Intros.TryGetValue(id, out var intro))
|
||||
{
|
||||
_logger?.LogDebug("Episode {Id} did not have an introduction, skipping", id);
|
||||
continue;
|
||||
@ -74,7 +74,7 @@ public static class EdlManager
|
||||
continue;
|
||||
}
|
||||
|
||||
var edlPath = GetEdlPath(Plugin.Instance!.GetItemPath(id));
|
||||
var edlPath = GetEdlPath(Plugin.Instance.GetItemPath(id));
|
||||
|
||||
_logger?.LogTrace("Episode {Id} has EDL path {Path}", id, edlPath);
|
||||
|
||||
|
@ -132,7 +132,7 @@ public class Entrypoint : IHostedService, IDisposable
|
||||
private void OnItemAdded(object? sender, ItemChangeEventArgs itemChangeEventArgs)
|
||||
{
|
||||
// Don't do anything if auto detection is disabled
|
||||
if (!Plugin.Instance!.Configuration.AutoDetectIntros && !Plugin.Instance!.Configuration.AutoDetectCredits)
|
||||
if (!Plugin.Instance!.Configuration.AutoDetectIntros && !Plugin.Instance.Configuration.AutoDetectCredits)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -148,7 +148,7 @@ public class Entrypoint : IHostedService, IDisposable
|
||||
return;
|
||||
}
|
||||
|
||||
Plugin.Instance!.Configuration.PathRestrictions.Add(itemChangeEventArgs.Item.ContainingFolderPath);
|
||||
Plugin.Instance.Configuration.PathRestrictions.Add(itemChangeEventArgs.Item.ContainingFolderPath);
|
||||
|
||||
StartTimer();
|
||||
}
|
||||
@ -161,7 +161,7 @@ public class Entrypoint : IHostedService, IDisposable
|
||||
private void OnItemModified(object? sender, ItemChangeEventArgs itemChangeEventArgs)
|
||||
{
|
||||
// Don't do anything if auto detection is disabled
|
||||
if (!Plugin.Instance!.Configuration.AutoDetectIntros && !Plugin.Instance!.Configuration.AutoDetectCredits)
|
||||
if (!Plugin.Instance!.Configuration.AutoDetectIntros && !Plugin.Instance.Configuration.AutoDetectCredits)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -177,7 +177,7 @@ public class Entrypoint : IHostedService, IDisposable
|
||||
return;
|
||||
}
|
||||
|
||||
Plugin.Instance!.Configuration.PathRestrictions.Add(itemChangeEventArgs.Item.ContainingFolderPath);
|
||||
Plugin.Instance.Configuration.PathRestrictions.Add(itemChangeEventArgs.Item.ContainingFolderPath);
|
||||
|
||||
StartTimer();
|
||||
}
|
||||
@ -190,7 +190,7 @@ public class Entrypoint : IHostedService, IDisposable
|
||||
private void OnLibraryRefresh(object? sender, TaskCompletionEventArgs eventArgs)
|
||||
{
|
||||
// Don't do anything if auto detection is disabled
|
||||
if (!Plugin.Instance!.Configuration.AutoDetectIntros && !Plugin.Instance!.Configuration.AutoDetectCredits)
|
||||
if (!Plugin.Instance!.Configuration.AutoDetectIntros && !Plugin.Instance.Configuration.AutoDetectCredits)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -260,7 +260,7 @@ public class Entrypoint : IHostedService, IDisposable
|
||||
var progress = new Progress<double>();
|
||||
var cancellationToken = _cancellationTokenSource.Token;
|
||||
|
||||
if (Plugin.Instance!.Configuration.AutoDetectIntros && Plugin.Instance!.Configuration.AutoDetectCredits)
|
||||
if (Plugin.Instance!.Configuration.AutoDetectIntros && Plugin.Instance.Configuration.AutoDetectCredits)
|
||||
{
|
||||
// This is where we can optimize a single scan
|
||||
var baseIntroAnalyzer = new BaseItemAnalyzerTask(
|
||||
@ -279,7 +279,7 @@ public class Entrypoint : IHostedService, IDisposable
|
||||
|
||||
baseCreditAnalyzer.AnalyzeItems(progress, cancellationToken);
|
||||
}
|
||||
else if (Plugin.Instance!.Configuration.AutoDetectIntros)
|
||||
else if (Plugin.Instance.Configuration.AutoDetectIntros)
|
||||
{
|
||||
var baseIntroAnalyzer = new BaseItemAnalyzerTask(
|
||||
AnalysisMode.Introduction,
|
||||
@ -289,7 +289,7 @@ public class Entrypoint : IHostedService, IDisposable
|
||||
|
||||
baseIntroAnalyzer.AnalyzeItems(progress, cancellationToken);
|
||||
}
|
||||
else if (Plugin.Instance!.Configuration.AutoDetectCredits)
|
||||
else if (Plugin.Instance.Configuration.AutoDetectCredits)
|
||||
{
|
||||
var baseCreditAnalyzer = new BaseItemAnalyzerTask(
|
||||
AnalysisMode.Credits,
|
||||
@ -301,7 +301,7 @@ public class Entrypoint : IHostedService, IDisposable
|
||||
}
|
||||
}
|
||||
|
||||
Plugin.Instance!.Configuration.PathRestrictions.Clear();
|
||||
Plugin.Instance.Configuration.PathRestrictions.Clear();
|
||||
_autoTaskCompletEvent.Set();
|
||||
_cancellationTokenSource = null;
|
||||
|
||||
|
@ -213,7 +213,7 @@ public class Plugin : BasePlugin<PluginConfiguration>, IHasWebPages
|
||||
// Serialize credits
|
||||
introList.Clear();
|
||||
|
||||
foreach (var intro in Plugin.Instance!.Credits)
|
||||
foreach (var intro in Plugin.Instance.Credits)
|
||||
{
|
||||
introList.Add(intro.Value);
|
||||
}
|
||||
|
@ -72,11 +72,11 @@ public class QueueManager
|
||||
}
|
||||
}
|
||||
|
||||
Plugin.Instance!.TotalSeasons = _queuedEpisodes.Count;
|
||||
Plugin.Instance!.QueuedMediaItems.Clear();
|
||||
Plugin.Instance.TotalSeasons = _queuedEpisodes.Count;
|
||||
Plugin.Instance.QueuedMediaItems.Clear();
|
||||
foreach (var kvp in _queuedEpisodes)
|
||||
{
|
||||
Plugin.Instance!.QueuedMediaItems[kvp.Key] = kvp.Value;
|
||||
Plugin.Instance.QueuedMediaItems[kvp.Key] = kvp.Value;
|
||||
}
|
||||
|
||||
return new(_queuedEpisodes);
|
||||
@ -159,7 +159,7 @@ public class QueueManager
|
||||
|
||||
if (Plugin.Instance!.Configuration.PathRestrictions.Count > 0)
|
||||
{
|
||||
if (!Plugin.Instance!.Configuration.PathRestrictions.Contains(item.ContainingFolderPath))
|
||||
if (!Plugin.Instance.Configuration.PathRestrictions.Contains(item.ContainingFolderPath))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -200,13 +200,13 @@ public class QueueManager
|
||||
|
||||
fingerprintDuration = Math.Min(
|
||||
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
|
||||
var maxCreditsDuration = Plugin.Instance!.Configuration.MaximumCreditsDuration;
|
||||
var maxCreditsDuration = Plugin.Instance.Configuration.MaximumCreditsDuration;
|
||||
_queuedEpisodes[episode.SeasonId].Add(new QueuedEpisode()
|
||||
{
|
||||
SeriesName = episode.SeriesName,
|
||||
@ -219,7 +219,7 @@ public class QueueManager
|
||||
CreditsFingerprintStart = Convert.ToInt32(duration - maxCreditsDuration),
|
||||
});
|
||||
|
||||
Plugin.Instance!.TotalQueued++;
|
||||
Plugin.Instance.TotalQueued++;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -243,7 +243,7 @@ public class QueueManager
|
||||
{
|
||||
try
|
||||
{
|
||||
var path = Plugin.Instance!.GetItemPath(candidate.EpisodeId);
|
||||
var path = Plugin.Instance.GetItemPath(candidate.EpisodeId);
|
||||
|
||||
if (File.Exists(path))
|
||||
{
|
||||
|
@ -87,7 +87,7 @@ public class BaseItemAnalyzerTask
|
||||
var totalProcessed = 0;
|
||||
var options = new ParallelOptions()
|
||||
{
|
||||
MaxDegreeOfParallelism = Plugin.Instance!.Configuration.MaxParallelism
|
||||
MaxDegreeOfParallelism = Plugin.Instance.Configuration.MaxParallelism
|
||||
};
|
||||
|
||||
Parallel.ForEach(queue, options, (season) =>
|
||||
@ -127,7 +127,7 @@ public class BaseItemAnalyzerTask
|
||||
var analyzed = AnalyzeItems(episodes, cancellationToken);
|
||||
Interlocked.Add(ref totalProcessed, analyzed);
|
||||
|
||||
writeEdl = analyzed > 0 || Plugin.Instance!.Configuration.RegenerateEdlFiles;
|
||||
writeEdl = analyzed > 0 || Plugin.Instance.Configuration.RegenerateEdlFiles;
|
||||
}
|
||||
catch (FingerprintException ex)
|
||||
{
|
||||
@ -140,7 +140,7 @@ public class BaseItemAnalyzerTask
|
||||
|
||||
if (
|
||||
writeEdl &&
|
||||
Plugin.Instance!.Configuration.EdlAction != EdlAction.None &&
|
||||
Plugin.Instance.Configuration.EdlAction != EdlAction.None &&
|
||||
_analysisMode == AnalysisMode.Introduction)
|
||||
{
|
||||
EdlManager.UpdateEDLFiles(episodes);
|
||||
@ -158,11 +158,11 @@ public class BaseItemAnalyzerTask
|
||||
|
||||
if (
|
||||
_analysisMode == AnalysisMode.Introduction &&
|
||||
Plugin.Instance!.Configuration.RegenerateEdlFiles)
|
||||
Plugin.Instance.Configuration.RegenerateEdlFiles)
|
||||
{
|
||||
_logger.LogInformation("Turning EDL file regeneration flag off");
|
||||
Plugin.Instance!.Configuration.RegenerateEdlFiles = false;
|
||||
Plugin.Instance!.SaveConfiguration();
|
||||
Plugin.Instance.Configuration.RegenerateEdlFiles = false;
|
||||
Plugin.Instance.SaveConfiguration();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user