jellyfin-server/MediaBrowser.LocalMetadata/Parsers/MovieXmlParser.cs

66 lines
1.9 KiB
C#
Raw Normal View History

2015-06-29 01:10:45 +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.Logging;
2015-06-29 01:10:45 +00:00
using System.Xml;
2013-08-12 19:18:31 +00:00
namespace MediaBrowser.LocalMetadata.Parsers
2013-08-12 19:18:31 +00:00
{
/// <summary>
/// Class EpisodeXmlParser
/// </summary>
2015-06-29 01:10:45 +00:00
public class BaseVideoXmlParser<T> : BaseItemXmlParser<T>
where T : Video
2013-08-12 19:18:31 +00:00
{
public BaseVideoXmlParser(ILogger logger, IProviderManager providerManager)
: base(logger, providerManager)
2013-08-12 19:18:31 +00:00
{
}
/// <summary>
/// Fetches the data from XML node.
/// </summary>
/// <param name="reader">The reader.</param>
2015-06-29 01:10:45 +00:00
/// <param name="result">The result.</param>
protected override void FetchDataFromXmlNode(XmlReader reader, MetadataResult<T> result)
2013-08-12 19:18:31 +00:00
{
2015-06-29 01:10:45 +00:00
var item = result.Item;
2013-08-12 19:18:31 +00:00
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)
{
2016-03-14 01:34:24 +00:00
movie.CollectionName = val;
2013-10-17 15:34:47 +00:00
}
2013-10-17 15:34:47 +00:00
break;
}
2013-08-12 19:18:31 +00:00
default:
2015-06-29 01:10:45 +00:00
base.FetchDataFromXmlNode(reader, result);
2013-08-12 19:18:31 +00:00
break;
}
}
}
2015-06-29 01:10:45 +00:00
public class MovieXmlParser : BaseVideoXmlParser<Movie>
{
public MovieXmlParser(ILogger logger, IProviderManager providerManager) : base(logger, providerManager)
2015-06-29 01:10:45 +00:00
{
}
}
public class VideoXmlParser : BaseVideoXmlParser<Video>
{
public VideoXmlParser(ILogger logger, IProviderManager providerManager)
: base(logger, providerManager)
2015-06-29 01:10:45 +00:00
{
}
}
2013-08-12 19:18:31 +00:00
}