find the first credits chapter marker (#138)
This commit is contained in:
parent
d41ec2ae4d
commit
e58e74b5d4
@ -116,7 +116,7 @@ public class ChapterAnalyzer : IMediaFileAnalyzer
|
|||||||
for (int i = chapters.Count - 2; i >= 0; i--)
|
for (int i = chapters.Count - 2; i >= 0; i--)
|
||||||
{
|
{
|
||||||
var current = chapters[i];
|
var current = chapters[i];
|
||||||
var next = chapters[i + 1];
|
var previous = chapters[i - 1];
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(current.Name))
|
if (string.IsNullOrWhiteSpace(current.Name))
|
||||||
{
|
{
|
||||||
@ -125,7 +125,7 @@ public class ChapterAnalyzer : IMediaFileAnalyzer
|
|||||||
|
|
||||||
var currentRange = new TimeRange(
|
var currentRange = new TimeRange(
|
||||||
TimeSpan.FromTicks(current.StartPositionTicks).TotalSeconds,
|
TimeSpan.FromTicks(current.StartPositionTicks).TotalSeconds,
|
||||||
TimeSpan.FromTicks(next.StartPositionTicks).TotalSeconds);
|
TimeSpan.FromTicks(chapters[i + 1].StartPositionTicks).TotalSeconds);
|
||||||
|
|
||||||
var baseMessage = string.Format(
|
var baseMessage = string.Format(
|
||||||
CultureInfo.InvariantCulture,
|
CultureInfo.InvariantCulture,
|
||||||
@ -155,6 +155,21 @@ public class ChapterAnalyzer : IMediaFileAnalyzer
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(previous.Name))
|
||||||
|
{
|
||||||
|
// Check for possibility of overlapping keywords
|
||||||
|
var overlap = Regex.IsMatch(
|
||||||
|
previous.Name,
|
||||||
|
expression,
|
||||||
|
RegexOptions.None,
|
||||||
|
TimeSpan.FromSeconds(1));
|
||||||
|
|
||||||
|
if (overlap)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
matchingChapter = new(episode.EpisodeId, currentRange);
|
matchingChapter = new(episode.EpisodeId, currentRange);
|
||||||
_logger.LogTrace("{Base}: okay", baseMessage);
|
_logger.LogTrace("{Base}: okay", baseMessage);
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user