2019-01-13 21:03:10 +01:00
|
|
|
using System.Globalization;
|
2019-01-13 20:26:56 +01:00
|
|
|
using System.Xml;
|
|
|
|
using MediaBrowser.Common.Configuration;
|
2014-06-30 05:04:50 +02:00
|
|
|
using MediaBrowser.Controller.Entities.TV;
|
2015-06-29 03:10:45 +02:00
|
|
|
using MediaBrowser.Controller.Providers;
|
2016-10-26 04:53:47 +02:00
|
|
|
using MediaBrowser.Model.IO;
|
|
|
|
using MediaBrowser.Model.Xml;
|
2019-01-13 20:26:56 +01:00
|
|
|
using Microsoft.Extensions.Logging;
|
2014-04-02 23:55:19 +02:00
|
|
|
|
2014-06-30 05:04:50 +02:00
|
|
|
namespace MediaBrowser.XbmcMetadata.Parsers
|
2014-04-02 23:55:19 +02:00
|
|
|
{
|
2014-06-30 05:04:50 +02:00
|
|
|
public class SeasonNfoParser : BaseNfoParser<Season>
|
2014-04-02 23:55:19 +02:00
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Fetches the data from XML node.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="reader">The reader.</param>
|
2015-06-29 03:10:45 +02:00
|
|
|
/// <param name="itemResult">The item result.</param>
|
2015-08-02 19:31:08 +02:00
|
|
|
protected override void FetchDataFromXmlNode(XmlReader reader, MetadataResult<Season> itemResult)
|
2014-04-02 23:55:19 +02:00
|
|
|
{
|
2015-06-29 03:10:45 +02:00
|
|
|
var item = itemResult.Item;
|
|
|
|
|
2014-04-02 23:55:19 +02:00
|
|
|
switch (reader.Name)
|
|
|
|
{
|
2014-06-30 05:04:50 +02:00
|
|
|
case "seasonnumber":
|
2014-04-02 23:55:19 +02:00
|
|
|
{
|
|
|
|
var number = reader.ReadElementContentAsString();
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(number))
|
|
|
|
{
|
2019-01-13 21:46:33 +01:00
|
|
|
if (int.TryParse(number, NumberStyles.Integer, CultureInfo.InvariantCulture, out var num))
|
2014-04-02 23:55:19 +02:00
|
|
|
{
|
|
|
|
item.IndexNumber = num;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
default:
|
2015-06-29 03:10:45 +02:00
|
|
|
base.FetchDataFromXmlNode(reader, itemResult);
|
2014-04-02 23:55:19 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2016-10-26 04:53:47 +02:00
|
|
|
|
|
|
|
public SeasonNfoParser(ILogger logger, IConfigurationManager config, IProviderManager providerManager, IFileSystem fileSystem, IXmlReaderSettingsFactory xmlReaderSettingsFactory) : base(logger, config, providerManager, fileSystem, xmlReaderSettingsFactory)
|
|
|
|
{
|
|
|
|
}
|
2014-04-02 23:55:19 +02:00
|
|
|
}
|
|
|
|
}
|