Update black frame and chapter analyzer
This commit is contained in:
parent
3e2dc377b7
commit
cb234bedd3
@ -76,8 +76,10 @@ public class BlackFrameAnalyzer : IMediaFileAnalyzer
|
||||
/// <returns>Credits timestamp.</returns>
|
||||
public Intro? AnalyzeMediaFile(QueuedEpisode episode, AnalysisMode mode, int minimum)
|
||||
{
|
||||
// Start by analyzing the last four minutes of the file.
|
||||
var start = TimeSpan.FromMinutes(4);
|
||||
var config = Plugin.Instance?.Configuration ?? new Configuration.PluginConfiguration();
|
||||
|
||||
// Start by analyzing the last N minutes of the file.
|
||||
var start = TimeSpan.FromSeconds(config.MaximumEpisodeCreditsDuration);
|
||||
var end = TimeSpan.Zero;
|
||||
var firstFrameTime = 0.0;
|
||||
|
||||
@ -100,7 +102,11 @@ public class BlackFrameAnalyzer : IMediaFileAnalyzer
|
||||
tr.End);
|
||||
|
||||
var frames = FFmpegWrapper.DetectBlackFrames(episode, tr, minimum);
|
||||
_logger.LogTrace("{Episode}, black frames: {Count}", episode.Name, frames.Length);
|
||||
_logger.LogTrace(
|
||||
"{Episode} at {Start} has {Count} black frames",
|
||||
episode.Name,
|
||||
tr.Start,
|
||||
frames.Length);
|
||||
|
||||
if (frames.Length == 0)
|
||||
{
|
||||
|
@ -4,6 +4,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using Microsoft.Extensions.Logging;
|
||||
@ -31,7 +32,6 @@ public class ChapterAnalyzer : IMediaFileAnalyzer
|
||||
AnalysisMode mode,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
var unsuccessful = new List<QueuedEpisode>();
|
||||
var skippableRanges = new Dictionary<Guid, Intro>();
|
||||
|
||||
var expression = mode == AnalysisMode.Introduction ?
|
||||
@ -53,7 +53,6 @@ public class ChapterAnalyzer : IMediaFileAnalyzer
|
||||
|
||||
if (skipRange is null)
|
||||
{
|
||||
unsuccessful.Add(episode);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -62,7 +61,10 @@ public class ChapterAnalyzer : IMediaFileAnalyzer
|
||||
|
||||
Plugin.Instance!.UpdateTimestamps(skippableRanges, mode);
|
||||
|
||||
return unsuccessful.AsReadOnly();
|
||||
return analysisQueue
|
||||
.Where(x => !skippableRanges.ContainsKey(x.EpisodeId))
|
||||
.ToList()
|
||||
.AsReadOnly();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -33,12 +33,12 @@ public class QueuedEpisode
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the timestamp (in seconds) to stop searching for an introduction.
|
||||
/// Gets or sets the timestamp (in seconds) to stop searching for an introduction at.
|
||||
/// </summary>
|
||||
public int IntroFingerprintEnd { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the timestamp (in seconds) to start looking for end credits.
|
||||
/// Gets or sets the timestamp (in seconds) to start looking for end credits at.
|
||||
/// </summary>
|
||||
public int CreditsFingerprintStart { get; set; }
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user