diff options
| author | Shadowghost <Ghost_of_Stone@web.de> | 2026-05-03 13:31:23 +0200 |
|---|---|---|
| committer | Shadowghost <Ghost_of_Stone@web.de> | 2026-05-03 13:31:23 +0200 |
| commit | d68d0fa96267ad96eaa5a0ba37e072f59a71442a (patch) | |
| tree | c3a33238cc56857d8e3daa56db01f290118c9215 /Emby.Server.Implementations/Chapters/ChapterManager.cs | |
| parent | 00b08c0b32b3c8fa36330d72e4a25c7b157de4e3 (diff) | |
| parent | d9ced0d6399c82ddad9e983605bb0d828a608e63 (diff) | |
Merge remote-tracking branch 'upstream/master' into perf-rebased
Diffstat (limited to 'Emby.Server.Implementations/Chapters/ChapterManager.cs')
| -rw-r--r-- | Emby.Server.Implementations/Chapters/ChapterManager.cs | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/Emby.Server.Implementations/Chapters/ChapterManager.cs b/Emby.Server.Implementations/Chapters/ChapterManager.cs index d09ed30ae3..79ab29b87c 100644 --- a/Emby.Server.Implementations/Chapters/ChapterManager.cs +++ b/Emby.Server.Implementations/Chapters/ChapterManager.cs @@ -7,6 +7,7 @@ using System.Threading.Tasks; using Jellyfin.Extensions; using MediaBrowser.Controller.Chapters; using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Controller.IO; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.MediaEncoding; @@ -232,12 +233,22 @@ public class ChapterManager : IChapterManager } /// <inheritdoc /> - public void SaveChapters(Video video, IReadOnlyList<ChapterInfo> chapters) + public bool Supports(BaseItem item) + => item is Video or Audio; + + /// <inheritdoc /> + public void SaveChapters(BaseItem item, IReadOnlyList<ChapterInfo> 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); - } + if (!Supports(item)) + { + _logger.LogWarning("Attempted to save chapters for unsupported item type {Type}: {Name} ({Id})", item.GetType().Name, item.Name, item.Id); + return; + } + + // Remove any chapters that are outside of the runtime of the item + var validChapters = chapters.Where(c => c.StartPositionTicks < item.RunTimeTicks).ToList(); + _chapterRepository.SaveChapters(item.Id, validChapters); +} /// <inheritdoc /> public ChapterInfo? GetChapter(Guid baseItemId, int index) |
