jellyfin/MediaBrowser.LocalMetadata/Parsers/MovieXmlParser.cs

68 lines
1.9 KiB
C#
Raw Normal View History

using System.Collections.Generic;
using System.Threading;
using System.Xml;
using MediaBrowser.Controller.Entities;
2013-10-17 15:34:47 +00:00
using MediaBrowser.Controller.Entities.Movies;
2013-08-12 19:18:31 +00:00
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Entities;
2013-08-12 19:18:31 +00:00
using MediaBrowser.Model.Logging;
namespace MediaBrowser.LocalMetadata.Parsers
2013-08-12 19:18:31 +00:00
{
/// <summary>
/// Class EpisodeXmlParser
/// </summary>
public class MovieXmlParser : BaseItemXmlParser<Video>
{
private List<ChapterInfo> _chaptersFound;
public MovieXmlParser(ILogger logger)
2013-08-12 19:18:31 +00:00
: base(logger)
{
}
public void Fetch(Video item,
List<ChapterInfo> chapters,
string metadataFile,
CancellationToken cancellationToken)
2013-08-12 19:18:31 +00:00
{
_chaptersFound = chapters;
2013-08-12 19:18:31 +00:00
Fetch(item, metadataFile, cancellationToken);
}
/// <summary>
/// Fetches the data from XML node.
/// </summary>
/// <param name="reader">The reader.</param>
/// <param name="item">The item.</param>
protected override void FetchDataFromXmlNode(XmlReader reader, Video item)
{
switch (reader.Name)
{
2013-10-17 15:34:47 +00:00
case "TmdbCollectionName":
{
var val = reader.ReadElementContentAsString();
var movie = item as Movie;
if (!string.IsNullOrWhiteSpace(val) && movie != null)
{
movie.TmdbCollectionName = val;
}
2013-10-17 15:34:47 +00:00
break;
}
2013-08-12 19:18:31 +00:00
case "Chapters":
_chaptersFound.AddRange(FetchChaptersFromXmlNode(item, reader.ReadSubtree()));
2013-08-12 19:18:31 +00:00
break;
default:
base.FetchDataFromXmlNode(reader, item);
break;
}
}
}
}