change chromaprint offset, reorder analyzers, improve prompt timing (#153)

This commit is contained in:
rlauuzo 2024-05-10 14:05:59 +02:00 committed by GitHub
parent 291fdebbb2
commit 03af05c3c6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 17 additions and 17 deletions

View File

@ -168,7 +168,7 @@ public class BlackFrameAnalyzer : IMediaFileAnalyzer
if (frames.Length == 0) if (frames.Length == 0)
{ {
// Since no black frames were found, slide the range closer to the end // Since no black frames were found, slide the range closer to the end
start = midpoint; start = midpoint - TimeSpan.FromSeconds(2);
if (midpoint - TimeSpan.FromSeconds(lowerLimit) < _maximumError) if (midpoint - TimeSpan.FromSeconds(lowerLimit) < _maximumError)
{ {

View File

@ -17,7 +17,7 @@ public class ChromaprintAnalyzer : IMediaFileAnalyzer
/// Seconds of audio in one fingerprint point. /// Seconds of audio in one fingerprint point.
/// This value is defined by the Chromaprint library and should not be changed. /// This value is defined by the Chromaprint library and should not be changed.
/// </summary> /// </summary>
private const double SamplesToSeconds = 0.128; private const double SamplesToSeconds = 0.1238;
private int minimumIntroDuration; private int minimumIntroDuration;

View File

@ -531,14 +531,14 @@
<tr> <tr>
<td>Up arrow</td> <td>Up arrow</td>
<td> <td>
Shift the left episode up by 0.128 seconds. Shift the left episode up by 0.1238 seconds.
Holding control will shift the episode by 10 seconds. Holding control will shift the episode by 10 seconds.
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Down arrow</td> <td>Down arrow</td>
<td> <td>
Shift the left episode down by 0.128 seconds. Shift the left episode down by 0.1238 seconds.
Holding control will shift the episode by 10 seconds. Holding control will shift the episode by 10 seconds.
</td> </td>
</tr> </tr>
@ -919,13 +919,13 @@
case "ArrowDown": case "ArrowDown":
if (timestampError.value != "") { if (timestampError.value != "") {
// if the control key is pressed, shift LHS by 10s. Otherwise, shift by 1. // if the control key is pressed, shift LHS by 10s. Otherwise, shift by 1.
offsetDelta = e.ctrlKey ? 10 / 0.128 : 1; offsetDelta = e.ctrlKey ? 10 / 0.1238 : 1;
} }
break; break;
case "ArrowUp": case "ArrowUp":
if (timestampError.value != "") { if (timestampError.value != "") {
offsetDelta = e.ctrlKey ? -10 / 0.128 : -1; offsetDelta = e.ctrlKey ? -10 / 0.1238 : -1;
} }
break; break;
@ -1108,12 +1108,12 @@
let lTime, rTime, diffPos; let lTime, rTime, diffPos;
if (shift < 0) { if (shift < 0) {
lTime = y * 0.128; lTime = y * 0.1238;
rTime = (y + shift) * 0.128; rTime = (y + shift) * 0.1238;
diffPos = y + shift; diffPos = y + shift;
} else { } else {
lTime = (y - shift) * 0.128; lTime = (y - shift) * 0.1238;
rTime = y * 0.128; rTime = y * 0.1238;
diffPos = y - shift; diffPos = y - shift;
} }

View File

@ -91,14 +91,14 @@ public class SkipIntroController : ControllerBase
if (config.PersistSkipButton) if (config.PersistSkipButton)
{ {
segment.ShowSkipPromptAt = segment.IntroStart; segment.ShowSkipPromptAt = segment.IntroStart;
segment.HideSkipPromptAt = segment.IntroEnd; segment.HideSkipPromptAt = segment.IntroEnd - 1;
} }
else else
{ {
segment.ShowSkipPromptAt = Math.Max(0, segment.IntroStart - config.ShowPromptAdjustment); segment.ShowSkipPromptAt = Math.Max(0, segment.IntroStart - config.ShowPromptAdjustment);
segment.HideSkipPromptAt = Math.Min( segment.HideSkipPromptAt = Math.Min(
segment.IntroStart + config.HidePromptAdjustment, segment.IntroStart + config.HidePromptAdjustment,
segment.IntroEnd); segment.IntroEnd - 1);
} }
return segment; return segment;

View File

@ -204,16 +204,16 @@ public class BaseItemAnalyzerTask
var analyzers = new Collection<IMediaFileAnalyzer>(); var analyzers = new Collection<IMediaFileAnalyzer>();
analyzers.Add(new ChapterAnalyzer(_loggerFactory.CreateLogger<ChapterAnalyzer>())); analyzers.Add(new ChapterAnalyzer(_loggerFactory.CreateLogger<ChapterAnalyzer>()));
if (Plugin.Instance!.Configuration.UseChromaprint)
{
analyzers.Add(new ChromaprintAnalyzer(_loggerFactory.CreateLogger<ChromaprintAnalyzer>()));
}
if (mode == AnalysisMode.Credits) if (mode == AnalysisMode.Credits)
{ {
analyzers.Add(new BlackFrameAnalyzer(_loggerFactory.CreateLogger<BlackFrameAnalyzer>())); analyzers.Add(new BlackFrameAnalyzer(_loggerFactory.CreateLogger<BlackFrameAnalyzer>()));
} }
if (Plugin.Instance!.Configuration.UseChromaprint)
{
analyzers.Add(new ChromaprintAnalyzer(_loggerFactory.CreateLogger<ChromaprintAnalyzer>()));
}
// Use each analyzer to find skippable ranges in all media files, removing successfully // Use each analyzer to find skippable ranges in all media files, removing successfully
// analyzed items from the queue. // analyzed items from the queue.
foreach (var analyzer in analyzers) foreach (var analyzer in analyzers)