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
* Support modifying introduction detection algorithm settings
* Add option to not skip the introduction in the first episode of a season
* Add option to analyze show extras (specials)
* Fixes
* Fix scheduled task interval (#79)

View File

@ -31,6 +31,11 @@ public class PluginConfiguration : BasePluginConfiguration
/// </summary>
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 =====
/// <summary>

View File

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

View File

@ -235,16 +235,18 @@ public class AnalyzeEpisodesTask : IScheduledTask
// Episode analysis queue.
var episodeAnalysisQueue = new List<QueuedEpisode>(episodes);
/* Don't analyze specials or 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,
* 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)
// Skip seasons with an insufficient number of episodes.
if (episodes.Count <= 1)
{
return episodes.Count;
}
// Only analyze specials (season 0) if the user has opted in.
var first = episodes[0];
if (first.SeasonNumber == 0 && !Plugin.Instance!.Configuration.AnalyzeSeasonZero)
{
return 0;
}
_logger.LogInformation(
"Analyzing {Count} episodes from {Name} season {Season}",