2019-01-13 13:03:10 -07:00
|
|
|
using System.Globalization;
|
2019-01-13 12:26:56 -07:00
|
|
|
using System.Xml;
|
|
|
|
using MediaBrowser.Common.Configuration;
|
2014-06-29 20:04:50 -07:00
|
|
|
using MediaBrowser.Controller.Entities.TV;
|
2021-02-09 04:42:55 -07:00
|
|
|
using MediaBrowser.Controller.Library;
|
2015-06-28 18:10:45 -07:00
|
|
|
using MediaBrowser.Controller.Providers;
|
2019-01-13 12:26:56 -07:00
|
|
|
using Microsoft.Extensions.Logging;
|
2014-04-02 14:55:19 -07:00
|
|
|
|
2014-06-29 20:04:50 -07:00
|
|
|
namespace MediaBrowser.XbmcMetadata.Parsers
|
2014-04-02 14:55:19 -07:00
|
|
|
{
|
2020-02-23 04:11:43 -07:00
|
|
|
/// <summary>
|
|
|
|
/// Nfo parser for seasons.
|
|
|
|
/// </summary>
|
2014-06-29 20:04:50 -07:00
|
|
|
public class SeasonNfoParser : BaseNfoParser<Season>
|
2014-04-02 14:55:19 -07:00
|
|
|
{
|
2020-02-23 04:11:43 -07:00
|
|
|
/// <summary>
|
|
|
|
/// Initializes a new instance of the <see cref="SeasonNfoParser"/> class.
|
|
|
|
/// </summary>
|
2021-02-09 04:42:55 -07:00
|
|
|
/// <param name="logger">Instance of the <see cref="ILogger"/> interface.</param>
|
|
|
|
/// <param name="config">Instance of the <see cref="IConfigurationManager"/> interface.</param>
|
|
|
|
/// <param name="providerManager">Instance of the <see cref="IProviderManager"/> interface.</param>
|
|
|
|
/// <param name="userManager">Instance of the <see cref="IUserManager"/> interface.</param>
|
|
|
|
/// <param name="userDataManager">Instance of the <see cref="IUserDataManager"/> interface.</param>
|
|
|
|
public SeasonNfoParser(
|
|
|
|
ILogger logger,
|
|
|
|
IConfigurationManager config,
|
|
|
|
IProviderManager providerManager,
|
|
|
|
IUserManager userManager,
|
|
|
|
IUserDataManager userDataManager)
|
|
|
|
: base(logger, config, providerManager, userManager, userDataManager)
|
2019-08-18 10:54:07 -07:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
2015-08-02 10:31:08 -07:00
|
|
|
protected override void FetchDataFromXmlNode(XmlReader reader, MetadataResult<Season> itemResult)
|
2014-04-02 14:55:19 -07:00
|
|
|
{
|
2015-06-28 18:10:45 -07:00
|
|
|
var item = itemResult.Item;
|
|
|
|
|
2014-04-02 14:55:19 -07:00
|
|
|
switch (reader.Name)
|
|
|
|
{
|
2014-06-29 20:04:50 -07:00
|
|
|
case "seasonnumber":
|
2014-04-02 14:55:19 -07:00
|
|
|
{
|
|
|
|
var number = reader.ReadElementContentAsString();
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(number))
|
|
|
|
{
|
2019-01-13 13:46:33 -07:00
|
|
|
if (int.TryParse(number, NumberStyles.Integer, CultureInfo.InvariantCulture, out var num))
|
2014-04-02 14:55:19 -07:00
|
|
|
{
|
|
|
|
item.IndexNumber = num;
|
|
|
|
}
|
|
|
|
}
|
2020-02-23 04:11:43 -07:00
|
|
|
|
2014-04-02 14:55:19 -07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
default:
|
2015-06-28 18:10:45 -07:00
|
|
|
base.FetchDataFromXmlNode(reader, itemResult);
|
2014-04-02 14:55:19 -07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|