jellyfin/MediaBrowser.Providers/Movies/MovieXmlParser.cs

68 lines
1.9 KiB
C#
Raw Normal View History

2013-08-12 19:18:31 +00:00
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;
using System.Collections.Generic;
2013-08-12 19:18:31 +00:00
using System.Threading;
using System.Xml;
namespace MediaBrowser.Providers.Movies
{
/// <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;
}
}
}
}