mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-21 00:05:26 +03:00
Only save chapters that are within the runtime of the video file (#15176)
This commit is contained in:
@@ -223,7 +223,7 @@ public class ChapterManager : IChapterManager
|
|||||||
|
|
||||||
if (saveChapters && changesMade)
|
if (saveChapters && changesMade)
|
||||||
{
|
{
|
||||||
_chapterRepository.SaveChapters(video.Id, chapters);
|
SaveChapters(video, chapters);
|
||||||
}
|
}
|
||||||
|
|
||||||
DeleteDeadImages(currentImages, chapters);
|
DeleteDeadImages(currentImages, chapters);
|
||||||
@@ -234,7 +234,9 @@ public class ChapterManager : IChapterManager
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public void SaveChapters(Video video, IReadOnlyList<ChapterInfo> chapters)
|
public void SaveChapters(Video video, IReadOnlyList<ChapterInfo> chapters)
|
||||||
{
|
{
|
||||||
_chapterRepository.SaveChapters(video.Id, chapters);
|
// Remove any chapters that are outside of the runtime of the video
|
||||||
|
var validChapters = chapters.Where(c => c.StartPositionTicks < video.RunTimeTicks).ToList();
|
||||||
|
_chapterRepository.SaveChapters(video.Id, validChapters);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
|||||||
Reference in New Issue
Block a user