Use primary constructor everywhere
This commit is contained in:
parent
ca9a167ad5
commit
fc830a5e6f
@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using ConfusedPolarBear.Plugin.IntroSkipper.Data;
|
using ConfusedPolarBear.Plugin.IntroSkipper.Data;
|
||||||
|
using ConfusedPolarBear.Plugin.IntroSkipper.Manager;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace ConfusedPolarBear.Plugin.IntroSkipper.Tests;
|
namespace ConfusedPolarBear.Plugin.IntroSkipper.Tests;
|
||||||
|
@ -5,13 +5,13 @@ using ConfusedPolarBear.Plugin.IntroSkipper.Configuration;
|
|||||||
using ConfusedPolarBear.Plugin.IntroSkipper.Data;
|
using ConfusedPolarBear.Plugin.IntroSkipper.Data;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace ConfusedPolarBear.Plugin.IntroSkipper;
|
namespace ConfusedPolarBear.Plugin.IntroSkipper.Analyzers
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Analyzer Helper.
|
|
||||||
/// </summary>
|
|
||||||
public class AnalyzerHelper
|
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Analyzer Helper.
|
||||||
|
/// </summary>
|
||||||
|
public class AnalyzerHelper
|
||||||
|
{
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly double _silenceDetectionMinimumDuration;
|
private readonly double _silenceDetectionMinimumDuration;
|
||||||
|
|
||||||
@ -113,4 +113,5 @@ public class AnalyzerHelper
|
|||||||
silenceRange.Duration >= _silenceDetectionMinimumDuration &&
|
silenceRange.Duration >= _silenceDetectionMinimumDuration &&
|
||||||
silenceRange.Start >= adjustedIntro.Start;
|
silenceRange.Start >= adjustedIntro.Start;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,8 +23,4 @@
|
|||||||
<EmbeddedResource Include="Configuration\visualizer.js" />
|
<EmbeddedResource Include="Configuration\visualizer.js" />
|
||||||
<EmbeddedResource Include="Configuration\inject.js" />
|
<EmbeddedResource Include="Configuration\inject.js" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<Folder Include="Manager\" />
|
|
||||||
<Folder Include="Services\" />
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -6,7 +6,7 @@ using System.Runtime.Serialization;
|
|||||||
using System.Xml;
|
using System.Xml;
|
||||||
using ConfusedPolarBear.Plugin.IntroSkipper.Data;
|
using ConfusedPolarBear.Plugin.IntroSkipper.Data;
|
||||||
|
|
||||||
namespace ConfusedPolarBear.Plugin.IntroSkipper
|
namespace ConfusedPolarBear.Plugin.IntroSkipper.Helper
|
||||||
{
|
{
|
||||||
internal sealed class XmlSerializationHelper
|
internal sealed class XmlSerializationHelper
|
||||||
{
|
{
|
||||||
|
@ -4,13 +4,13 @@ using System.IO;
|
|||||||
using ConfusedPolarBear.Plugin.IntroSkipper.Data;
|
using ConfusedPolarBear.Plugin.IntroSkipper.Data;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace ConfusedPolarBear.Plugin.IntroSkipper;
|
namespace ConfusedPolarBear.Plugin.IntroSkipper.Manager
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Update EDL files associated with a list of episodes.
|
|
||||||
/// </summary>
|
|
||||||
public static class EdlManager
|
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Update EDL files associated with a list of episodes.
|
||||||
|
/// </summary>
|
||||||
|
public static class EdlManager
|
||||||
|
{
|
||||||
private static ILogger? _logger;
|
private static ILogger? _logger;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -113,4 +113,5 @@ public static class EdlManager
|
|||||||
{
|
{
|
||||||
return Path.ChangeExtension(mediaPath, "edl");
|
return Path.ChangeExtension(mediaPath, "edl");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,18 +10,18 @@ using MediaBrowser.Controller.Entities.TV;
|
|||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace ConfusedPolarBear.Plugin.IntroSkipper;
|
namespace ConfusedPolarBear.Plugin.IntroSkipper.Manager
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Manages enqueuing library items for analysis.
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>
|
|
||||||
/// Initializes a new instance of the <see cref="QueueManager"/> class.
|
|
||||||
/// </remarks>
|
|
||||||
/// <param name="logger">Logger.</param>
|
|
||||||
/// <param name="libraryManager">Library manager.</param>
|
|
||||||
public class QueueManager(ILogger<QueueManager> logger, ILibraryManager libraryManager)
|
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Manages enqueuing library items for analysis.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Initializes a new instance of the <see cref="QueueManager"/> class.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="logger">Logger.</param>
|
||||||
|
/// <param name="libraryManager">Library manager.</param>
|
||||||
|
public class QueueManager(ILogger<QueueManager> logger, ILibraryManager libraryManager)
|
||||||
|
{
|
||||||
private readonly ILibraryManager _libraryManager = libraryManager;
|
private readonly ILibraryManager _libraryManager = libraryManager;
|
||||||
private readonly ILogger<QueueManager> _logger = logger;
|
private readonly ILogger<QueueManager> _logger = logger;
|
||||||
private readonly Dictionary<Guid, List<QueuedEpisode>> _queuedEpisodes = [];
|
private readonly Dictionary<Guid, List<QueuedEpisode>> _queuedEpisodes = [];
|
||||||
@ -293,4 +293,5 @@ public class QueueManager(ILogger<QueueManager> logger, ILibraryManager libraryM
|
|||||||
|
|
||||||
return (verified, reqModes);
|
return (verified, reqModes);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ using System.Linq;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using ConfusedPolarBear.Plugin.IntroSkipper.Configuration;
|
using ConfusedPolarBear.Plugin.IntroSkipper.Configuration;
|
||||||
using ConfusedPolarBear.Plugin.IntroSkipper.Data;
|
using ConfusedPolarBear.Plugin.IntroSkipper.Data;
|
||||||
|
using ConfusedPolarBear.Plugin.IntroSkipper.Helper;
|
||||||
using MediaBrowser.Common;
|
using MediaBrowser.Common;
|
||||||
using MediaBrowser.Common.Configuration;
|
using MediaBrowser.Common.Configuration;
|
||||||
using MediaBrowser.Common.Plugins;
|
using MediaBrowser.Common.Plugins;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using ConfusedPolarBear.Plugin.IntroSkipper.Providers;
|
using ConfusedPolarBear.Plugin.IntroSkipper.Providers;
|
||||||
|
using ConfusedPolarBear.Plugin.IntroSkipper.Services;
|
||||||
using MediaBrowser.Controller;
|
using MediaBrowser.Controller;
|
||||||
using MediaBrowser.Controller.Plugins;
|
using MediaBrowser.Controller.Plugins;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
@ -6,6 +6,7 @@ using System.Threading;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using ConfusedPolarBear.Plugin.IntroSkipper.Analyzers;
|
using ConfusedPolarBear.Plugin.IntroSkipper.Analyzers;
|
||||||
using ConfusedPolarBear.Plugin.IntroSkipper.Data;
|
using ConfusedPolarBear.Plugin.IntroSkipper.Data;
|
||||||
|
using ConfusedPolarBear.Plugin.IntroSkipper.Manager;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ using System.IO;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using ConfusedPolarBear.Plugin.IntroSkipper.Manager;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Model.Tasks;
|
using MediaBrowser.Model.Tasks;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
@ -4,6 +4,7 @@ using System.Collections.ObjectModel;
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using ConfusedPolarBear.Plugin.IntroSkipper.Data;
|
using ConfusedPolarBear.Plugin.IntroSkipper.Data;
|
||||||
|
using ConfusedPolarBear.Plugin.IntroSkipper.Services;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Model.Tasks;
|
using MediaBrowser.Model.Tasks;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
@ -4,6 +4,7 @@ using System.Collections.ObjectModel;
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using ConfusedPolarBear.Plugin.IntroSkipper.Data;
|
using ConfusedPolarBear.Plugin.IntroSkipper.Data;
|
||||||
|
using ConfusedPolarBear.Plugin.IntroSkipper.Services;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Model.Tasks;
|
using MediaBrowser.Model.Tasks;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
@ -4,6 +4,7 @@ using System.Collections.ObjectModel;
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using ConfusedPolarBear.Plugin.IntroSkipper.Data;
|
using ConfusedPolarBear.Plugin.IntroSkipper.Data;
|
||||||
|
using ConfusedPolarBear.Plugin.IntroSkipper.Services;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Model.Tasks;
|
using MediaBrowser.Model.Tasks;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
@ -15,23 +15,23 @@ using Microsoft.Extensions.Hosting;
|
|||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Timer = System.Timers.Timer;
|
using Timer = System.Timers.Timer;
|
||||||
|
|
||||||
namespace ConfusedPolarBear.Plugin.IntroSkipper;
|
namespace ConfusedPolarBear.Plugin.IntroSkipper.Services
|
||||||
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Automatically skip past introduction sequences.
|
/// Automatically skip past introduction sequences.
|
||||||
/// Commands clients to seek to the end of the intro as soon as they start playing it.
|
/// Commands clients to seek to the end of the intro as soon as they start playing it.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// Initializes a new instance of the <see cref="AutoSkip"/> class.
|
/// Initializes a new instance of the <see cref="AutoSkip"/> class.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <param name="userDataManager">User data manager.</param>
|
/// <param name="userDataManager">User data manager.</param>
|
||||||
/// <param name="sessionManager">Session manager.</param>
|
/// <param name="sessionManager">Session manager.</param>
|
||||||
/// <param name="logger">Logger.</param>
|
/// <param name="logger">Logger.</param>
|
||||||
public class AutoSkip(
|
public class AutoSkip(
|
||||||
IUserDataManager userDataManager,
|
IUserDataManager userDataManager,
|
||||||
ISessionManager sessionManager,
|
ISessionManager sessionManager,
|
||||||
ILogger<AutoSkip> logger) : IHostedService, IDisposable
|
ILogger<AutoSkip> logger) : IHostedService, IDisposable
|
||||||
{
|
{
|
||||||
private readonly object _sentSeekCommandLock = new();
|
private readonly object _sentSeekCommandLock = new();
|
||||||
|
|
||||||
private ILogger<AutoSkip> _logger = logger;
|
private ILogger<AutoSkip> _logger = logger;
|
||||||
@ -227,4 +227,5 @@ public class AutoSkip(
|
|||||||
_userDataManager.UserDataSaved -= UserDataManager_UserDataSaved;
|
_userDataManager.UserDataSaved -= UserDataManager_UserDataSaved;
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,23 +15,23 @@ using Microsoft.Extensions.Hosting;
|
|||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Timer = System.Timers.Timer;
|
using Timer = System.Timers.Timer;
|
||||||
|
|
||||||
namespace ConfusedPolarBear.Plugin.IntroSkipper;
|
namespace ConfusedPolarBear.Plugin.IntroSkipper.Services
|
||||||
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Automatically skip past credit sequences.
|
/// Automatically skip past credit sequences.
|
||||||
/// Commands clients to seek to the end of the credits as soon as they start playing it.
|
/// Commands clients to seek to the end of the credits as soon as they start playing it.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// Initializes a new instance of the <see cref="AutoSkipCredits"/> class.
|
/// Initializes a new instance of the <see cref="AutoSkipCredits"/> class.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <param name="userDataManager">User data manager.</param>
|
/// <param name="userDataManager">User data manager.</param>
|
||||||
/// <param name="sessionManager">Session manager.</param>
|
/// <param name="sessionManager">Session manager.</param>
|
||||||
/// <param name="logger">Logger.</param>
|
/// <param name="logger">Logger.</param>
|
||||||
public class AutoSkipCredits(
|
public class AutoSkipCredits(
|
||||||
IUserDataManager userDataManager,
|
IUserDataManager userDataManager,
|
||||||
ISessionManager sessionManager,
|
ISessionManager sessionManager,
|
||||||
ILogger<AutoSkipCredits> logger) : IHostedService, IDisposable
|
ILogger<AutoSkipCredits> logger) : IHostedService, IDisposable
|
||||||
{
|
{
|
||||||
private readonly object _sentSeekCommandLock = new();
|
private readonly object _sentSeekCommandLock = new();
|
||||||
|
|
||||||
private ILogger<AutoSkipCredits> _logger = logger;
|
private ILogger<AutoSkipCredits> _logger = logger;
|
||||||
@ -227,4 +227,5 @@ public class AutoSkipCredits(
|
|||||||
_userDataManager.UserDataSaved -= UserDataManager_UserDataSaved;
|
_userDataManager.UserDataSaved -= UserDataManager_UserDataSaved;
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ using System.Threading;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using ConfusedPolarBear.Plugin.IntroSkipper.Configuration;
|
using ConfusedPolarBear.Plugin.IntroSkipper.Configuration;
|
||||||
using ConfusedPolarBear.Plugin.IntroSkipper.Data;
|
using ConfusedPolarBear.Plugin.IntroSkipper.Data;
|
||||||
|
using ConfusedPolarBear.Plugin.IntroSkipper.Manager;
|
||||||
using ConfusedPolarBear.Plugin.IntroSkipper.ScheduledTasks;
|
using ConfusedPolarBear.Plugin.IntroSkipper.ScheduledTasks;
|
||||||
using MediaBrowser.Controller.Entities.TV;
|
using MediaBrowser.Controller.Entities.TV;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
@ -13,13 +14,13 @@ using MediaBrowser.Model.Tasks;
|
|||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace ConfusedPolarBear.Plugin.IntroSkipper;
|
namespace ConfusedPolarBear.Plugin.IntroSkipper.Services
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Server entrypoint.
|
|
||||||
/// </summary>
|
|
||||||
public sealed class Entrypoint : IHostedService, IDisposable
|
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Server entrypoint.
|
||||||
|
/// </summary>
|
||||||
|
public sealed class Entrypoint : IHostedService, IDisposable
|
||||||
|
{
|
||||||
private readonly ITaskManager _taskManager;
|
private readonly ITaskManager _taskManager;
|
||||||
private readonly ILibraryManager _libraryManager;
|
private readonly ILibraryManager _libraryManager;
|
||||||
private readonly ILogger<Entrypoint> _logger;
|
private readonly ILogger<Entrypoint> _logger;
|
||||||
@ -323,4 +324,5 @@ public sealed class Entrypoint : IHostedService, IDisposable
|
|||||||
_cancellationTokenSource?.Dispose();
|
_cancellationTokenSource?.Dispose();
|
||||||
_autoTaskCompletEvent.Dispose();
|
_autoTaskCompletEvent.Dispose();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user