validate chapters coming from xml

This commit is contained in:
Luke Pulverenti 2013-08-13 10:43:51 -04:00
parent 242f0f21dc
commit 3481d0d8e7

View File

@ -871,13 +871,16 @@ namespace MediaBrowser.Controller.Providers
} }
} }
protected async Task FetchChaptersFromXmlNode(Guid itemId, XmlReader reader, IItemRepository repository, CancellationToken cancellationToken) protected async Task FetchChaptersFromXmlNode(BaseItem item, XmlReader reader, IItemRepository repository, CancellationToken cancellationToken)
{ {
var runtime = item.RunTimeTicks ?? 0;
using (reader) using (reader)
{ {
var chapters = GetChaptersFromXmlNode(reader); var chapters = GetChaptersFromXmlNode(reader)
.Where(i => i.StartPositionTicks >= 0 && i.StartPositionTicks < runtime);
await repository.SaveChapters(itemId, chapters, cancellationToken).ConfigureAwait(false); await repository.SaveChapters(item.Id, chapters, cancellationToken).ConfigureAwait(false);
} }
} }