From 822bd31c8fc84a44a6c7ac9c2de41c310b559e37 Mon Sep 17 00:00:00 2001
From: TwistedUmbrellaX
Date: Sat, 2 Mar 2024 22:19:51 -0500
Subject: [PATCH 1/8] Add parameters for ffmpeg options
---
.../Configuration/PluginConfiguration.cs | 11 +++++++++++
.../ConfusedPolarBear.Plugin.IntroSkipper.csproj | 4 ++--
.../FFmpegWrapper.cs | 16 ++++++++++++++--
3 files changed, 27 insertions(+), 4 deletions(-)
diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/PluginConfiguration.cs b/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/PluginConfiguration.cs
index 294f565..0d4407e 100644
--- a/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/PluginConfiguration.cs
+++ b/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/PluginConfiguration.cs
@@ -1,3 +1,4 @@
+using System.Diagnostics;
using MediaBrowser.Model.Plugins;
namespace ConfusedPolarBear.Plugin.IntroSkipper.Configuration;
@@ -181,4 +182,14 @@ public class PluginConfiguration : BasePluginConfiguration
/// Gets or sets the notification text sent after automatically skipping an introduction.
///
public string AutoSkipNotificationText { get; set; } = "Intro skipped";
+
+ ///
+ /// Gets or sets the number of threads for an ffmpeg process.
+ ///
+ public int ProcessThreads { get; set; } = 0;
+
+ ///
+ /// Gets or sets the relative priority for an ffmpeg process.
+ ///
+ public ProcessPriorityClass ProcessPriority { get; set; } = ProcessPriorityClass.BelowNormal;
}
diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/ConfusedPolarBear.Plugin.IntroSkipper.csproj b/ConfusedPolarBear.Plugin.IntroSkipper/ConfusedPolarBear.Plugin.IntroSkipper.csproj
index 51ee209..3970a4e 100644
--- a/ConfusedPolarBear.Plugin.IntroSkipper/ConfusedPolarBear.Plugin.IntroSkipper.csproj
+++ b/ConfusedPolarBear.Plugin.IntroSkipper/ConfusedPolarBear.Plugin.IntroSkipper.csproj
@@ -3,8 +3,8 @@
net6.0ConfusedPolarBear.Plugin.IntroSkipper
- 0.1.14.0
- 0.1.14.0
+ 0.1.15.0
+ 0.1.15.0truetrueenable
diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/FFmpegWrapper.cs b/ConfusedPolarBear.Plugin.IntroSkipper/FFmpegWrapper.cs
index fc0c9d4..95779e6 100644
--- a/ConfusedPolarBear.Plugin.IntroSkipper/FFmpegWrapper.cs
+++ b/ConfusedPolarBear.Plugin.IntroSkipper/FFmpegWrapper.cs
@@ -400,8 +400,9 @@ public static class FFmpegWrapper
// for each file that is fingerprinted.
var prependArgument = string.Format(
CultureInfo.InvariantCulture,
- "-hide_banner -loglevel {0} ",
- logLevel);
+ "-hide_banner -loglevel {0} -threads {1} ",
+ logLevel,
+ Plugin.Instance?.Configuration.ProcessThreads ?? 0);
var info = new ProcessStartInfo(ffmpegPath, args.Insert(0, prependArgument))
{
@@ -425,6 +426,17 @@ public static class FFmpegWrapper
ffmpeg.Start();
+ try
+ {
+ ffmpeg.PriorityClass = Plugin.Instance?.Configuration.ProcessPriority ?? ProcessPriorityClass.BelowNormal;
+ }
+ catch (Exception e)
+ {
+ Logger?.LogDebug(
+ "ffmpeg priority could not be modified. {Message}",
+ e.Message);
+ }
+
using (MemoryStream ms = new MemoryStream())
{
var buf = new byte[4096];
From 01c5c1df51ec0353fc34af69c8370ef386dbeb05 Mon Sep 17 00:00:00 2001
From: TwistedUmbrellaX
Date: Sun, 3 Mar 2024 08:08:55 -0500
Subject: [PATCH 2/8] Support modifying ffmpeg priority
---
.../Configuration/configPage.html | 36 +++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/configPage.html b/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/configPage.html
index 0475d82..f79761b 100644
--- a/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/configPage.html
+++ b/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/configPage.html
@@ -59,6 +59,41 @@
+
+
+
+
+
+ Sets the relative priority of the ffmpeg process during detection
+ If you notice excessive RAM usage, try setting a lower value
+ If you would like to speed up detection, increase this value
+
+
+
-
-
-
-
-
- Sets the relative priority of the ffmpeg process during detection
- If you notice excessive RAM usage, try setting a lower value
- If you would like to speed up detection, increase this value
-
-
-
-
-
-
-
- If checked, episode fingerprints will be cached to the filesystem
-
- WARNING: Disabling cache may result in lengthy detection
-
-
+ If checked, episode fingerprints will be saved on the filesystem to improve analysis speed.
+
+ WARNING: May result in lengthy detection! Not recommended for large libraries!
+
+
+
+
+
+
+
+
+
+ Sets the relative priority of the analysis ffmpeg process to other parallel operations
+ (ie. transcoding, chapter detection, etc).
+
+
+
+
+
+
+
+ Number of simultaneous processes to use for ffmpeg operations.
+
+ This value is most often defined as 1 thread per CPU core,
+ but setting a value of 0 (default) will use the maximum threads available.
+
+
+
+
-
- EDL File Generation
-
-
-
-
-
-
-
- If set to a value other than None, specifies which action to write to
- MPlayer compatible EDL files
- alongside your episode files.
-
- If this value is changed after EDL files are generated, you must check the
- "Regenerate EDL files" checkbox below.
-
-
-
-
-
-
-
- If checked, the plugin will overwrite all EDL files associated with
- your episodes with the currently discovered introduction timestamps and EDL action.
-
+ If set to a value other than None, specifies which action to write to
+ MPlayer compatible EDL files
+ alongside your episode files.
+
+ If this value is changed after EDL files are generated, you must check the
+ "Regenerate EDL files" checkbox below.
+
+
+
+
+
+
+
+ If checked, the plugin will overwrite all EDL files associated with
+ your episodes with the currently discovered introduction timestamps and EDL action.
+
@@ -271,7 +271,6 @@
but setting a value of 0 (default) will use the maximum threads available.
-
@@ -322,7 +321,7 @@
- If checked, skip button will appear through entire intro (offset and timeout are ignored).
+ If checked, skip button will appear throughout entire intro (offset and timeout are ignored).
@@ -442,13 +441,13 @@
-
-
-
+
+
+
@@ -674,6 +673,7 @@
// show changed, populate seasons
async function showChanged() {
clearSelect(selectSeason);
+ btnSeasonEraseTimestamps.style.display = "none";
// add all seasons from this show to the season select
for (var season of shows[selectShow.value]) {
@@ -690,6 +690,7 @@
clearSelect(selectEpisode1);
clearSelect(selectEpisode2);
+ btnSeasonEraseTimestamps.style.display = "block";
let i = 1;
for (let episode of episodes) {
@@ -770,7 +771,7 @@
// make an authenticated GET to the server and parse the response as JSON
async function getJson(url) {
- return await fetchWithAuth(url, "GET").then(r => { return r.json(); });
+ return await fetchWithAuth(url, "GET").then(r => { return r.json(); }).catch(err => { console.debug(err) });
}
// make an authenticated fetch to the server
diff --git a/manifest.json b/manifest.json
index d23259b..d7ab2fd 100644
--- a/manifest.json
+++ b/manifest.json
@@ -4,7 +4,7 @@
"name": "Intro Skipper",
"overview": "Automatically detect and skip intros in television episodes",
"description": "Analyzes the audio of television episodes and detects introduction sequences.",
- "owner": "ConfusedPolarBear",
+ "owner": "jumoog (forked from ConfusedPolarBear)",
"category": "General",
"imageUrl": "https://raw.githubusercontent.com/jumoog/intro-skipper/master/images/logo.png",
"versions": [
From 0107c92d0f105e05239a66ec2c74199dd86dbde3 Mon Sep 17 00:00:00 2001
From: TwistedUmbrellaX
Date: Mon, 4 Mar 2024 08:20:46 -0500
Subject: [PATCH 6/8] Stop calling optional items "required"
---
.../Configuration/configPage.html | 2 +-
README.md | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/configPage.html b/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/configPage.html
index 39f8699..151a77d 100644
--- a/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/configPage.html
+++ b/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/configPage.html
@@ -60,7 +60,7 @@
- Modify Intro Requirements
+ Modify Intro Parameters
diff --git a/README.md b/README.md
index 7048bf4..d7ed50c 100644
--- a/README.md
+++ b/README.md
@@ -17,14 +17,14 @@ This fork doesn't ship the custom web interface on your server. So the plugin ne
* Debian Linux based native installs: provided by the `jellyfin-ffmpeg5` package
* MacOS native installs: build ffmpeg with chromaprint support ([instructions](#installation-instructions-for-macos))
-## Introduction requirements
+## Introduction parameters
-Show introductions will only be detected if they are:
+Show introductions will be detected if they are:
-* Located within the first 25% of an episode, or the first 10 minutes, whichever is smaller
+* Located within the first 25% of an episode or the first 10 minutes, whichever is smaller
* Between 15 seconds and 2 minutes long
-Ending credits will only be detected if they are shorter than 4 minutes.
+Ending credits will be detected if they are shorter than 4 minutes.
All of these requirements can be customized as needed.
From 31365442b181a3a359e2afca8d47dd900f94ac6f Mon Sep 17 00:00:00 2001
From: TwistedUmbrellaX
Date: Mon, 4 Mar 2024 08:58:15 -0500
Subject: [PATCH 7/8] Chromaprint is for scan, not config
---
ConfusedPolarBear.Plugin.IntroSkipper/QueueManager.cs | 7 -------
.../ScheduledTasks/BaseItemAnalyzerTask.cs | 7 +++++++
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/QueueManager.cs b/ConfusedPolarBear.Plugin.IntroSkipper/QueueManager.cs
index 30239a4..c27ff62 100644
--- a/ConfusedPolarBear.Plugin.IntroSkipper/QueueManager.cs
+++ b/ConfusedPolarBear.Plugin.IntroSkipper/QueueManager.cs
@@ -43,13 +43,6 @@ public class QueueManager
/// Queued media items.
public ReadOnlyDictionary> GetMediaItems()
{
- // Assert that ffmpeg with chromaprint is installed
- if (!FFmpegWrapper.CheckFFmpegVersion())
- {
- throw new FingerprintException(
- "ffmpeg with chromaprint is not installed on this system - episodes will not be analyzed. If Jellyfin is running natively, install jellyfin-ffmpeg5. If Jellyfin is running in a container, upgrade it to the latest version of 10.8.0.");
- }
-
Plugin.Instance!.TotalQueued = 0;
LoadAnalysisSettings();
diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/BaseItemAnalyzerTask.cs b/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/BaseItemAnalyzerTask.cs
index 940e0a0..ca72342 100644
--- a/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/BaseItemAnalyzerTask.cs
+++ b/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/BaseItemAnalyzerTask.cs
@@ -53,6 +53,13 @@ public class BaseItemAnalyzerTask
IProgress progress,
CancellationToken cancellationToken)
{
+ // Assert that ffmpeg with chromaprint is installed
+ if (!FFmpegWrapper.CheckFFmpegVersion())
+ {
+ throw new FingerprintException(
+ "ffmpeg with chromaprint is not installed on this system - episodes will not be analyzed. If Jellyfin is running natively, install jellyfin-ffmpeg5. If Jellyfin is running in a container, upgrade it to the latest version of 10.8.0.");
+ }
+
var queueManager = new QueueManager(
_loggerFactory.CreateLogger(),
_libraryManager);
From ad8677dc2913087aaa35ddc9626abb826118d4da Mon Sep 17 00:00:00 2001
From: TwistedUmbrellaX
Date: Mon, 4 Mar 2024 09:15:29 -0500
Subject: [PATCH 8/8] v0.1.15.0
---
manifest.json | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/manifest.json b/manifest.json
index d7ab2fd..9dde9b2 100644
--- a/manifest.json
+++ b/manifest.json
@@ -4,10 +4,18 @@
"name": "Intro Skipper",
"overview": "Automatically detect and skip intros in television episodes",
"description": "Analyzes the audio of television episodes and detects introduction sequences.",
- "owner": "jumoog (forked from ConfusedPolarBear)",
+ "owner": "jumoog, AbandonedCart (forked from ConfusedPolarBear)",
"category": "General",
"imageUrl": "https://raw.githubusercontent.com/jumoog/intro-skipper/master/images/logo.png",
"versions": [
+ {
+ "version": "0.1.15.0",
+ "changelog": "- See the full changelog at [GitHub](https://github.com/jumoog/intro-skipper/blob/master/CHANGELOG.md)\n",
+ "targetAbi": "10.8.4.0",
+ "sourceUrl": "https://github.com/jumoog/intro-skipper/releases/download/v0.1.15/intro-skipper-v0.1.15.zip",
+ "checksum": "cf05593afbb2be39b8de31dcb7fd8a50",
+ "timestamp": "2024-03-03T09:08:10Z"
+ },
{
"version": "0.1.14.0",
"changelog": "- See the full changelog at [GitHub](https://github.com/jumoog/intro-skipper/blob/master/CHANGELOG.md)\n",