jellyfin/MediaBrowser.LocalMetadata/Parsers/MovieXmlParser.cs

66 lines
2.2 KiB
C#
Raw Normal View History

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;
2016-10-30 00:02:23 -07:00
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Xml;
2013-08-12 12:18:31 -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
{
/// <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
}
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;
}
}
2016-10-30 00:02:23 -07:00
public BaseVideoXmlParser(ILogger logger, IProviderManager providerManager, IXmlReaderSettingsFactory xmlReaderSettingsFactory, IFileSystem fileSystem) : base(logger, providerManager, xmlReaderSettingsFactory, fileSystem)
{
}
2013-08-12 12:18:31 -07:00
}
2015-06-28 18:10:45 -07:00
public class MovieXmlParser : BaseVideoXmlParser<Movie>
{
2016-10-30 00:02:23 -07:00
public MovieXmlParser(ILogger logger, IProviderManager providerManager, IXmlReaderSettingsFactory xmlReaderSettingsFactory, IFileSystem fileSystem) : base(logger, providerManager, xmlReaderSettingsFactory, fileSystem)
2015-06-28 18:10:45 -07:00
{
}
}
public class VideoXmlParser : BaseVideoXmlParser<Video>
{
2016-10-30 00:02:23 -07:00
public VideoXmlParser(ILogger logger, IProviderManager providerManager, IXmlReaderSettingsFactory xmlReaderSettingsFactory, IFileSystem fileSystem) : base(logger, providerManager, xmlReaderSettingsFactory, fileSystem)
2015-06-28 18:10:45 -07:00
{
}
}
2013-08-12 12:18:31 -07:00
}