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;
|
2014-05-14 20:55:16 +00:00
|
|
|
|
using MediaBrowser.Model.Entities;
|
2013-08-12 19:18:31 +00:00
|
|
|
|
using MediaBrowser.Model.Logging;
|
2014-05-14 20:55:16 +00:00
|
|
|
|
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>
|
|
|
|
|
{
|
2014-05-14 20:55:16 +00:00
|
|
|
|
private List<ChapterInfo> _chaptersFound;
|
|
|
|
|
|
2014-02-04 20:19:29 +00:00
|
|
|
|
public MovieXmlParser(ILogger logger)
|
2013-08-12 19:18:31 +00:00
|
|
|
|
: base(logger)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-14 20:55:16 +00:00
|
|
|
|
public void Fetch(Video item,
|
|
|
|
|
List<ChapterInfo> chapters,
|
|
|
|
|
string metadataFile,
|
|
|
|
|
CancellationToken cancellationToken)
|
2013-08-12 19:18:31 +00:00
|
|
|
|
{
|
2014-05-14 20:55:16 +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;
|
|
|
|
|
}
|
2014-05-14 20:55:16 +00:00
|
|
|
|
|
2013-10-17 15:34:47 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-12 19:18:31 +00:00
|
|
|
|
case "Chapters":
|
|
|
|
|
|
2014-05-14 20:55:16 +00:00
|
|
|
|
_chaptersFound.AddRange(FetchChaptersFromXmlNode(item, reader.ReadSubtree()));
|
2013-08-12 19:18:31 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
base.FetchDataFromXmlNode(reader, item);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|