Add option to analyze specials

Part of #67
This commit is contained in:
ConfusedPolarBear 2022-09-27 21:42:51 -05:00
parent 90ca76210f
commit ed9f3cbde8
4 changed files with 19 additions and 13 deletions

View File

@ -10,6 +10,7 @@
* Amount played is customizable and defaults to 2 seconds * Amount played is customizable and defaults to 2 seconds
* Support modifying introduction detection algorithm settings * Support modifying introduction detection algorithm settings
* Add option to not skip the introduction in the first episode of a season * Add option to not skip the introduction in the first episode of a season
* Add option to analyze show extras (specials)
* Fixes * Fixes
* Fix scheduled task interval (#79) * Fix scheduled task interval (#79)

View File

@ -31,6 +31,11 @@ public class PluginConfiguration : BasePluginConfiguration
/// </summary> /// </summary>
public string SelectedLibraries { get; set; } = string.Empty; public string SelectedLibraries { get; set; } = string.Empty;
/// <summary>
/// Gets or sets a value indicating whether to analyze season 0.
/// </summary>
public bool AnalyzeSeasonZero { get; set; } = false;
// ===== EDL handling ===== // ===== EDL handling =====
/// <summary> /// <summary>

View File

@ -16,14 +16,12 @@
<div class="checkboxContainer checkboxContainer-withDescription"> <div class="checkboxContainer checkboxContainer-withDescription">
<label class="emby-checkbox-label"> <label class="emby-checkbox-label">
<input id="CacheFingerprints" type="checkbox" is="emby-checkbox" /> <input id="AnalyzeSeasonZero" type="checkbox" is="emby-checkbox" />
<span>Cache fingerprints to disk</span> <span>Analyze show extras</span>
</label> </label>
<div class="fieldDescription"> <div class="fieldDescription">
If checked, will store the audio fingerprints for all subsequently scanned files to Analyze show extras (specials).
disk. Caching fingerprints avoids having to re-run ffmpeg on each file, at the expense
of disk usage.
</div> </div>
</div> </div>
@ -203,8 +201,8 @@
</label> </label>
<div class="fieldDescription"> <div class="fieldDescription">
If checked, intros will be automatically skipped. Will only work if web If checked, intros will be automatically skipped. If you access Jellyfin through a reverse proxy, it must be configured to proxy web
sockets are configured correctly.<br /> sockets.<br />
</div> </div>
</div> </div>
@ -400,7 +398,7 @@
] ]
var booleanConfigurationFields = [ var booleanConfigurationFields = [
"CacheFingerprints", "AnalyzeSeasonZero",
"RegenerateEdlFiles", "RegenerateEdlFiles",
"AutoSkip", "AutoSkip",
"SkipFirstEpisode" "SkipFirstEpisode"

View File

@ -235,16 +235,18 @@ public class AnalyzeEpisodesTask : IScheduledTask
// Episode analysis queue. // Episode analysis queue.
var episodeAnalysisQueue = new List<QueuedEpisode>(episodes); var episodeAnalysisQueue = new List<QueuedEpisode>(episodes);
/* Don't analyze specials or seasons with an insufficient number of episodes. // Skip seasons with an insufficient number of episodes.
* A season with only 1 episode can't be analyzed as it would compare the episode to itself, if (episodes.Count <= 1)
* which would result in the entire episode being marked as an introduction, as the audio is identical.
*/
if (episodes.Count < 2 || episodes[0].SeasonNumber == 0)
{ {
return episodes.Count; return episodes.Count;
} }
// Only analyze specials (season 0) if the user has opted in.
var first = episodes[0]; var first = episodes[0];
if (first.SeasonNumber == 0 && !Plugin.Instance!.Configuration.AnalyzeSeasonZero)
{
return 0;
}
_logger.LogInformation( _logger.LogInformation(
"Analyzing {Count} episodes from {Name} season {Season}", "Analyzing {Count} episodes from {Name} season {Season}",