Add option to bypass Chromaprint

This commit is contained in:
TwistedUmbrellaX 2024-03-04 17:50:12 -05:00
parent bcacfc8517
commit d8ebcfe772
4 changed files with 43 additions and 11 deletions

View File

@ -149,12 +149,21 @@ public class ChapterAnalyzer : IMediaFileAnalyzer
continue;
}
// Check for possibility of overlapping keywords
var overlap = Regex.IsMatch(
next.Name,
expression,
RegexOptions.None,
TimeSpan.FromSeconds(1));
if (overlap)
{
continue;
}
matchingChapter = new(episode.EpisodeId, currentRange);
_logger.LogTrace("{Base}: okay", baseMessage);
if (i > 0)
{
break;
}
break;
}
return matchingChapter;

View File

@ -17,11 +17,6 @@ public class PluginConfiguration : BasePluginConfiguration
// ===== Analysis settings =====
/// <summary>
/// Gets or sets a value indicating whether the episode's fingerprint should be cached to the filesystem.
/// </summary>
public bool CacheFingerprints { get; set; } = true;
/// <summary>
/// Gets or sets the max degree of parallelism used when analyzing episodes.
/// </summary>
@ -37,6 +32,16 @@ public class PluginConfiguration : BasePluginConfiguration
/// </summary>
public bool AnalyzeSeasonZero { get; set; } = false;
/// <summary>
/// Gets or sets a value indicating whether the episode's fingerprint should be cached to the filesystem.
/// </summary>
public bool CacheFingerprints { get; set; } = true;
/// <summary>
/// Gets or sets a value indicating whether analysis will use Chromaprint to determine fingerprints.
/// </summary>
public bool UseChromaprint { get; set; } = true;
// ===== EDL handling =====
/// <summary>

View File

@ -213,6 +213,20 @@
<summary>Process Configuration</summary>
<br/>
<div class="checkboxContainer checkboxContainer-withDescription">
<label class="emby-checkbox-label">
<input id="UseChromaprint" type="checkbox" is="emby-checkbox" />
<span>Chromaprint analysis</span>
</label>
<div class="fieldDescription">
If checked, analysis will use Chromaprint to compare episode audio and identify intros.
<br />
<strong>WARNING: Disabling this option may result in incomplete or innaccurate analysis!</strong>
<br />
</div>
</div>
<div class="checkboxContainer checkboxContainer-withDescription">
<label class="emby-checkbox-label">
<input id="CacheFingerprints" type="checkbox" is="emby-checkbox" />
@ -568,6 +582,7 @@
var booleanConfigurationFields = [
"AnalyzeSeasonZero",
"RegenerateEdlFiles",
"UseChromaprint",
"CacheFingerprints",
"AutoSkip",
"SkipFirstEpisode",

View File

@ -54,7 +54,7 @@ public class BaseItemAnalyzerTask
CancellationToken cancellationToken)
{
// Assert that ffmpeg with chromaprint is installed
if (!FFmpegWrapper.CheckFFmpegVersion())
if (Plugin.Instance!.Configuration.UseChromaprint && !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.");
@ -186,7 +186,10 @@ public class BaseItemAnalyzerTask
var analyzers = new Collection<IMediaFileAnalyzer>();
analyzers.Add(new ChapterAnalyzer(_loggerFactory.CreateLogger<ChapterAnalyzer>()));
analyzers.Add(new ChromaprintAnalyzer(_loggerFactory.CreateLogger<ChromaprintAnalyzer>()));
if (Plugin.Instance!.Configuration.UseChromaprint)
{
analyzers.Add(new ChromaprintAnalyzer(_loggerFactory.CreateLogger<ChromaprintAnalyzer>()));
}
if (this._analysisMode == AnalysisMode.Credits)
{