2015-06-28 18:10:45 -07:00
|
|
|
|
using MediaBrowser.Controller.Entities;
|
2013-10-17 08:34:47 -07:00
|
|
|
|
using MediaBrowser.Controller.Entities.Movies;
|
2013-08-12 12:18:31 -07:00
|
|
|
|
using MediaBrowser.Controller.Providers;
|
|
|
|
|
using MediaBrowser.Model.Logging;
|
2015-06-28 18:10:45 -07:00
|
|
|
|
using System.Xml;
|
2013-08-12 12:18:31 -07:00
|
|
|
|
|
2014-06-29 20:04:50 -07:00
|
|
|
|
namespace MediaBrowser.LocalMetadata.Parsers
|
2013-08-12 12:18:31 -07:00
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Class EpisodeXmlParser
|
|
|
|
|
/// </summary>
|
2015-06-28 18:10:45 -07:00
|
|
|
|
public class BaseVideoXmlParser<T> : BaseItemXmlParser<T>
|
|
|
|
|
where T : Video
|
2013-08-12 12:18:31 -07:00
|
|
|
|
{
|
2015-06-28 18:10:45 -07:00
|
|
|
|
public BaseVideoXmlParser(ILogger logger)
|
2013-08-12 12:18:31 -07:00
|
|
|
|
: base(logger)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Fetches the data from XML node.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="reader">The reader.</param>
|
2015-06-28 18:10:45 -07:00
|
|
|
|
/// <param name="result">The result.</param>
|
|
|
|
|
protected override void FetchDataFromXmlNode(XmlReader reader, MetadataResult<T> result)
|
2013-08-12 12:18:31 -07:00
|
|
|
|
{
|
2015-06-28 18:10:45 -07:00
|
|
|
|
var item = result.Item;
|
|
|
|
|
|
2013-08-12 12:18:31 -07:00
|
|
|
|
switch (reader.Name)
|
|
|
|
|
{
|
2013-10-17 08:34:47 -07:00
|
|
|
|
case "TmdbCollectionName":
|
|
|
|
|
{
|
|
|
|
|
var val = reader.ReadElementContentAsString();
|
|
|
|
|
var movie = item as Movie;
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(val) && movie != null)
|
|
|
|
|
{
|
2016-03-13 18:34:24 -07:00
|
|
|
|
movie.CollectionName = val;
|
2013-10-17 08:34:47 -07:00
|
|
|
|
}
|
2014-05-14 13:55:16 -07:00
|
|
|
|
|
2013-10-17 08:34:47 -07:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-12 12:18:31 -07:00
|
|
|
|
default:
|
2015-06-28 18:10:45 -07:00
|
|
|
|
base.FetchDataFromXmlNode(reader, result);
|
2013-08-12 12:18:31 -07:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-06-28 18:10:45 -07:00
|
|
|
|
|
|
|
|
|
public class MovieXmlParser : BaseVideoXmlParser<Movie>
|
|
|
|
|
{
|
|
|
|
|
public MovieXmlParser(ILogger logger) : base(logger)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class VideoXmlParser : BaseVideoXmlParser<Video>
|
|
|
|
|
{
|
|
|
|
|
public VideoXmlParser(ILogger logger)
|
|
|
|
|
: base(logger)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
}
|
2013-08-12 12:18:31 -07:00
|
|
|
|
}
|