From 002f82d6e6b39c53c7c8613fe1203cf2dba32c76 Mon Sep 17 00:00:00 2001 From: Kilian von Pflugk Date: Sat, 21 Sep 2024 18:35:10 +0200 Subject: [PATCH] cleanup and organize --- ...nfusedPolarBear.Plugin.IntroSkipper.csproj | 4 +++ .../Controllers/TroubleshootingController.cs | 3 +- .../Helper/Commit.cs | 13 +++++++++ .../{ => Helper}/XmlSerializationHelper.cs | 0 .../{ => Manager}/EdlManager.cs | 0 .../{ => Manager}/QueueManager.cs | 0 .../Plugin.cs | 29 ------------------- .../{ => Services}/AutoSkip.cs | 0 .../{ => Services}/AutoSkipCredits.cs | 0 .../{ => Services}/Entrypoint.cs | 0 10 files changed, 19 insertions(+), 30 deletions(-) create mode 100644 ConfusedPolarBear.Plugin.IntroSkipper/Helper/Commit.cs rename ConfusedPolarBear.Plugin.IntroSkipper/{ => Helper}/XmlSerializationHelper.cs (100%) rename ConfusedPolarBear.Plugin.IntroSkipper/{ => Manager}/EdlManager.cs (100%) rename ConfusedPolarBear.Plugin.IntroSkipper/{ => Manager}/QueueManager.cs (100%) rename ConfusedPolarBear.Plugin.IntroSkipper/{ => Services}/AutoSkip.cs (100%) rename ConfusedPolarBear.Plugin.IntroSkipper/{ => Services}/AutoSkipCredits.cs (100%) rename ConfusedPolarBear.Plugin.IntroSkipper/{ => Services}/Entrypoint.cs (100%) diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/ConfusedPolarBear.Plugin.IntroSkipper.csproj b/ConfusedPolarBear.Plugin.IntroSkipper/ConfusedPolarBear.Plugin.IntroSkipper.csproj index a386756..85bfafb 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/ConfusedPolarBear.Plugin.IntroSkipper.csproj +++ b/ConfusedPolarBear.Plugin.IntroSkipper/ConfusedPolarBear.Plugin.IntroSkipper.csproj @@ -24,4 +24,8 @@ + + + + diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Controllers/TroubleshootingController.cs b/ConfusedPolarBear.Plugin.IntroSkipper/Controllers/TroubleshootingController.cs index f042c78..24fc87d 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/Controllers/TroubleshootingController.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/Controllers/TroubleshootingController.cs @@ -4,6 +4,7 @@ using System.IO; using System.Net.Mime; using System.Text; using ConfusedPolarBear.Plugin.IntroSkipper.Data; +using ConfusedPolarBear.Plugin.IntroSkipper.Helper; using MediaBrowser.Common; using MediaBrowser.Common.Api; using MediaBrowser.Controller.Library; @@ -63,7 +64,7 @@ public class TroubleshootingController : ControllerBase try { - var commit = Plugin.Instance.GetCommit(); + var commit = Commit.CommitHash; if (!string.IsNullOrWhiteSpace(commit)) { version += string.Concat("+", commit.AsSpan(0, 12)); diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Helper/Commit.cs b/ConfusedPolarBear.Plugin.IntroSkipper/Helper/Commit.cs new file mode 100644 index 0000000..c83a3d5 --- /dev/null +++ b/ConfusedPolarBear.Plugin.IntroSkipper/Helper/Commit.cs @@ -0,0 +1,13 @@ +namespace ConfusedPolarBear.Plugin.IntroSkipper.Helper +{ + /// + /// Gets the commit used to build the plugin. + /// + public static class Commit + { + /// + /// Gets the commit hash used to build the plugin. + /// + public static string CommitHash => string.Empty; + } +} diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/XmlSerializationHelper.cs b/ConfusedPolarBear.Plugin.IntroSkipper/Helper/XmlSerializationHelper.cs similarity index 100% rename from ConfusedPolarBear.Plugin.IntroSkipper/XmlSerializationHelper.cs rename to ConfusedPolarBear.Plugin.IntroSkipper/Helper/XmlSerializationHelper.cs diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/EdlManager.cs b/ConfusedPolarBear.Plugin.IntroSkipper/Manager/EdlManager.cs similarity index 100% rename from ConfusedPolarBear.Plugin.IntroSkipper/EdlManager.cs rename to ConfusedPolarBear.Plugin.IntroSkipper/Manager/EdlManager.cs diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/QueueManager.cs b/ConfusedPolarBear.Plugin.IntroSkipper/Manager/QueueManager.cs similarity index 100% rename from ConfusedPolarBear.Plugin.IntroSkipper/QueueManager.cs rename to ConfusedPolarBear.Plugin.IntroSkipper/Manager/QueueManager.cs diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Plugin.cs b/ConfusedPolarBear.Plugin.IntroSkipper/Plugin.cs index f1d9451..fc6532c 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/Plugin.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/Plugin.cs @@ -340,35 +340,6 @@ public partial class Plugin : BasePlugin, IHasWebPages ]; } - /// - /// Gets the commit used to build the plugin. - /// - /// Commit. - public string GetCommit() - { - var commit = string.Empty; - - var path = GetType().Namespace + ".Configuration.version.txt"; - using var stream = GetType().Assembly.GetManifestResourceStream(path); - if (stream is null) - { - _logger.LogWarning("Unable to read embedded version information"); - return commit; - } - - using var reader = new StreamReader(stream); - commit = reader.ReadToEnd().TrimEnd(); - - if (commit == "unknown") - { - _logger.LogTrace("Embedded version information was not valid, ignoring"); - return string.Empty; - } - - _logger.LogInformation("Unstable plugin version built from commit {Commit}", commit); - return commit; - } - /// /// Gets the Intro for this item. /// diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/AutoSkip.cs b/ConfusedPolarBear.Plugin.IntroSkipper/Services/AutoSkip.cs similarity index 100% rename from ConfusedPolarBear.Plugin.IntroSkipper/AutoSkip.cs rename to ConfusedPolarBear.Plugin.IntroSkipper/Services/AutoSkip.cs diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/AutoSkipCredits.cs b/ConfusedPolarBear.Plugin.IntroSkipper/Services/AutoSkipCredits.cs similarity index 100% rename from ConfusedPolarBear.Plugin.IntroSkipper/AutoSkipCredits.cs rename to ConfusedPolarBear.Plugin.IntroSkipper/Services/AutoSkipCredits.cs diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Entrypoint.cs b/ConfusedPolarBear.Plugin.IntroSkipper/Services/Entrypoint.cs similarity index 100% rename from ConfusedPolarBear.Plugin.IntroSkipper/Entrypoint.cs rename to ConfusedPolarBear.Plugin.IntroSkipper/Services/Entrypoint.cs