diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Controllers/TroubleshootingController.cs b/ConfusedPolarBear.Plugin.IntroSkipper/Controllers/TroubleshootingController.cs
index 7f7d27d..2218bf0 100644
--- a/ConfusedPolarBear.Plugin.IntroSkipper/Controllers/TroubleshootingController.cs
+++ b/ConfusedPolarBear.Plugin.IntroSkipper/Controllers/TroubleshootingController.cs
@@ -1,3 +1,4 @@
+using System;
using System.Net.Mime;
using System.Text;
using MediaBrowser.Common;
@@ -47,8 +48,23 @@ public class TroubleshootingController : ControllerBase
bundle.Append(_applicationHost.ApplicationVersionString);
bundle.Append('\n');
+ var version = Plugin.Instance!.Version.ToString(3);
+
+ try
+ {
+ var commit = Plugin.Instance!.GetCommit();
+ if (!string.IsNullOrWhiteSpace(commit))
+ {
+ version += string.Concat("+", commit.AsSpan(0, 12));
+ }
+ }
+ catch (Exception ex)
+ {
+ _logger.LogWarning("Unable to append commit to version: {Exception}", ex);
+ }
+
bundle.Append("* Plugin version: ");
- bundle.Append(Plugin.Instance!.Version.ToString(3));
+ bundle.Append(version);
bundle.Append('\n');
bundle.Append("* Queue contents: ");
diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Entrypoint.cs b/ConfusedPolarBear.Plugin.IntroSkipper/Entrypoint.cs
index 6a5dff2..9a04831 100644
--- a/ConfusedPolarBear.Plugin.IntroSkipper/Entrypoint.cs
+++ b/ConfusedPolarBear.Plugin.IntroSkipper/Entrypoint.cs
@@ -48,10 +48,6 @@ public class Entrypoint : IServerEntryPoint
{
FFmpegWrapper.Logger = _logger;
-#if DEBUG
- LogVersion();
-#endif
-
// TODO: when a new item is added to the server, immediately analyze the season it belongs to
// instead of waiting for the next task interval. The task start should be debounced by a few seconds.
@@ -75,40 +71,6 @@ public class Entrypoint : IServerEntryPoint
return Task.CompletedTask;
}
-#if DEBUG
- ///
- /// Logs the exact commit that created this version of the plugin. Only used in unstable builds.
- ///
- private void LogVersion()
- {
- var assembly = GetType().Assembly;
- var path = GetType().Namespace + ".Configuration.version.txt";
-
- using (var stream = assembly.GetManifestResourceStream(path))
- {
- if (stream is null)
- {
- _logger.LogWarning("Unable to read embedded version information");
- return;
- }
-
- var version = string.Empty;
- using (var reader = new StreamReader(stream))
- {
- version = reader.ReadToEnd().TrimEnd();
- }
-
- if (version == "unknown")
- {
- _logger.LogTrace("Embedded version information was not valid, ignoring");
- return;
- }
-
- _logger.LogInformation("Unstable version built from commit {Version}", version);
- }
- }
-#endif
-
///
/// Dispose.
///
diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Plugin.cs b/ConfusedPolarBear.Plugin.IntroSkipper/Plugin.cs
index cf76406..0091538 100644
--- a/ConfusedPolarBear.Plugin.IntroSkipper/Plugin.cs
+++ b/ConfusedPolarBear.Plugin.IntroSkipper/Plugin.cs
@@ -203,6 +203,35 @@ public 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;
+ }
+
internal BaseItem GetItem(Guid id)
{
return _libraryManager.GetItemById(id);