Add nfo parsing for watched, playcount and lastplayed

This commit is contained in:
David 2021-02-09 12:42:55 +01:00
parent 34e10622c6
commit 3a4c33ca5f
20 changed files with 274 additions and 82 deletions

View File

@ -12,6 +12,7 @@ using System.Xml;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Entities;
using MediaBrowser.XbmcMetadata.Configuration;
@ -24,20 +25,31 @@ namespace MediaBrowser.XbmcMetadata.Parsers
where T : BaseItem
{
private readonly IConfigurationManager _config;
private readonly IUserManager _userManager;
private readonly IUserDataManager _userDataManager;
private Dictionary<string, string> _validProviderIds;
/// <summary>
/// Initializes a new instance of the <see cref="BaseNfoParser{T}" /> class.
/// </summary>
/// <param name="logger">The logger.</param>
/// <param name="config">the configuration manager.</param>
/// <param name="providerManager">The provider manager.</param>
public BaseNfoParser(ILogger logger, IConfigurationManager config, IProviderManager providerManager)
/// <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 BaseNfoParser(
ILogger logger,
IConfigurationManager config,
IProviderManager providerManager,
IUserManager userManager,
IUserDataManager userDataManager)
{
Logger = logger;
_config = config;
ProviderManager = providerManager;
_validProviderIds = new Dictionary<string, string>();
_userManager = userManager;
_userDataManager = userDataManager;
}
protected CultureInfo UsCulture { get; } = new CultureInfo("en-US");
@ -261,6 +273,14 @@ namespace MediaBrowser.XbmcMetadata.Parsers
{
var item = itemResult.Item;
var nfoConfiguration = _config.GetNfoConfiguration();
UserItemData? userData = null;
if (!string.IsNullOrWhiteSpace(nfoConfiguration.UserId))
{
var user = _userManager.GetUserById(Guid.Parse(nfoConfiguration.UserId));
userData = _userDataManager.GetUserData(user, item);
}
switch (reader.Name)
{
// DateCreated
@ -355,6 +375,48 @@ namespace MediaBrowser.XbmcMetadata.Parsers
break;
}
case "watched":
{
if (userData != null)
{
userData.Played = reader.ReadElementContentAsBoolean();
}
break;
}
case "playcount":
{
if (userData != null)
{
userData.PlayCount = reader.ReadElementContentAsInt();
}
break;
}
case "lasplayed":
{
if (userData != null)
{
var val = reader.ReadElementContentAsString();
if (!string.IsNullOrWhiteSpace(val))
{
if (DateTime.TryParse(val, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal, out var added))
{
userData.LastPlayedDate = added.ToUniversalTime();
}
else
{
Logger.LogWarning("Invalid lastplayed value found: {Value}", val);
}
}
}
break;
}
case "countrycode":
{
var val = reader.ReadElementContentAsString();
@ -622,7 +684,7 @@ namespace MediaBrowser.XbmcMetadata.Parsers
case "premiered":
case "releasedate":
{
var formatString = _config.GetNfoConfiguration().ReleaseDateFormat;
var formatString = nfoConfiguration.ReleaseDateFormat;
var val = reader.ReadElementContentAsString();
@ -640,7 +702,7 @@ namespace MediaBrowser.XbmcMetadata.Parsers
case "enddate":
{
var formatString = _config.GetNfoConfiguration().ReleaseDateFormat;
var formatString = nfoConfiguration.ReleaseDateFormat;
var val = reader.ReadElementContentAsString();

View File

@ -6,6 +6,7 @@ using System.Threading;
using System.Xml;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Providers;
using Microsoft.Extensions.Logging;
@ -19,11 +20,18 @@ namespace MediaBrowser.XbmcMetadata.Parsers
/// <summary>
/// Initializes a new instance of the <see cref="EpisodeNfoParser"/> class.
/// </summary>
/// <param name="logger">The logger.</param>
/// <param name="config">the configuration manager.</param>
/// <param name="providerManager">The provider manager.</param>
public EpisodeNfoParser(ILogger logger, IConfigurationManager config, IProviderManager providerManager)
: base(logger, config, providerManager)
/// <param name="logger">Instance of the <see cref="ILogger{BaseNfoParser}"/> 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 EpisodeNfoParser(
ILogger logger,
IConfigurationManager config,
IProviderManager providerManager,
IUserManager userManager,
IUserDataManager userDataManager)
: base(logger, config, providerManager, userManager, userDataManager)
{
}

View File

@ -5,6 +5,7 @@ using System.Xml;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Movies;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Entities;
using Microsoft.Extensions.Logging;
@ -19,11 +20,18 @@ namespace MediaBrowser.XbmcMetadata.Parsers
/// <summary>
/// Initializes a new instance of the <see cref="MovieNfoParser"/> class.
/// </summary>
/// <param name="logger">The logger.</param>
/// <param name="config">the configuration manager.</param>
/// <param name="providerManager">The provider manager.</param>
public MovieNfoParser(ILogger logger, IConfigurationManager config, IProviderManager providerManager)
: base(logger, config, providerManager)
/// <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 MovieNfoParser(
ILogger logger,
IConfigurationManager config,
IProviderManager providerManager,
IUserManager userManager,
IUserDataManager userDataManager)
: base(logger, config, providerManager, userManager, userDataManager)
{
}

View File

@ -2,6 +2,7 @@ using System.Globalization;
using System.Xml;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Providers;
using Microsoft.Extensions.Logging;
@ -15,11 +16,18 @@ namespace MediaBrowser.XbmcMetadata.Parsers
/// <summary>
/// Initializes a new instance of the <see cref="SeasonNfoParser"/> class.
/// </summary>
/// <param name="logger">The logger.</param>
/// <param name="config">the configuration manager.</param>
/// <param name="providerManager">The provider manager.</param>
public SeasonNfoParser(ILogger logger, IConfigurationManager config, IProviderManager providerManager)
: base(logger, config, providerManager)
/// <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)
{
}

View File

@ -17,11 +17,18 @@ namespace MediaBrowser.XbmcMetadata.Parsers
/// <summary>
/// Initializes a new instance of the <see cref="SeriesNfoParser"/> class.
/// </summary>
/// <param name="logger">The logger.</param>
/// <param name="config">the configuration manager.</param>
/// <param name="providerManager">The provider manager.</param>
public SeriesNfoParser(ILogger logger, IConfigurationManager config, IProviderManager providerManager)
: base(logger, config, providerManager)
/// <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 SeriesNfoParser(
ILogger logger,
IConfigurationManager config,
IProviderManager providerManager,
IUserManager userManager,
IUserDataManager userDataManager)
: base(logger, config, providerManager, userManager, userDataManager)
{
}

View File

@ -2,6 +2,7 @@ using System.IO;
using System.Threading;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.IO;
using MediaBrowser.XbmcMetadata.Parsers;
@ -17,30 +18,38 @@ namespace MediaBrowser.XbmcMetadata.Providers
private readonly ILogger<AlbumNfoProvider> _logger;
private readonly IConfigurationManager _config;
private readonly IProviderManager _providerManager;
private readonly IUserManager _userManager;
private readonly IUserDataManager _userDataManager;
/// <summary>
/// Initializes a new instance of the <see cref="AlbumNfoProvider"/> class.
/// </summary>
/// <param name="logger">The logger.</param>
/// <param name="fileSystem">The file system.</param>
/// <param name="config">the configuration manager.</param>
/// <param name="providerManager">The provider manager.</param>
/// <param name="logger">Instance of the <see cref="ILogger{AlbumNfoProvider}"/> interface.</param>
/// <param name="fileSystem">Instance of the <see cref="IFileSystem"/> 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 AlbumNfoProvider(
ILogger<AlbumNfoProvider> logger,
IFileSystem fileSystem,
IConfigurationManager config,
IProviderManager providerManager)
IProviderManager providerManager,
IUserManager userManager,
IUserDataManager userDataManager)
: base(fileSystem)
{
_logger = logger;
_config = config;
_providerManager = providerManager;
_userManager = userManager;
_userDataManager = userDataManager;
}
/// <inheritdoc />
protected override void Fetch(MetadataResult<MusicAlbum> result, string path, CancellationToken cancellationToken)
{
new BaseNfoParser<MusicAlbum>(_logger, _config, _providerManager).Fetch(result, path, cancellationToken);
new BaseNfoParser<MusicAlbum>(_logger, _config, _providerManager, _userManager, _userDataManager).Fetch(result, path, cancellationToken);
}
/// <inheritdoc />

View File

@ -2,6 +2,7 @@ using System.IO;
using System.Threading;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.IO;
using MediaBrowser.XbmcMetadata.Parsers;
@ -17,30 +18,38 @@ namespace MediaBrowser.XbmcMetadata.Providers
private readonly ILogger<ArtistNfoProvider> _logger;
private readonly IConfigurationManager _config;
private readonly IProviderManager _providerManager;
private readonly IUserManager _userManager;
private readonly IUserDataManager _userDataManager;
/// <summary>
/// Initializes a new instance of the <see cref="ArtistNfoProvider"/> class.
/// </summary>
/// <param name="logger">The logger.</param>
/// <param name="fileSystem">The file system.</param>
/// <param name="config">the configuration manager.</param>
/// <param name="providerManager">The provider manager.</param>
/// <param name="logger">Instance of the <see cref="ILogger{ArtistNfoProvider}"/> interface.</param>
/// <param name="fileSystem">Instance of the <see cref="IFileSystem"/> 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 ArtistNfoProvider(
IFileSystem fileSystem,
ILogger<ArtistNfoProvider> logger,
IConfigurationManager config,
IProviderManager providerManager)
IProviderManager providerManager,
IUserManager userManager,
IUserDataManager userDataManager)
: base(fileSystem)
{
_logger = logger;
_config = config;
_providerManager = providerManager;
_userManager = userManager;
_userDataManager = userDataManager;
}
/// <inheritdoc />
protected override void Fetch(MetadataResult<MusicArtist> result, string path, CancellationToken cancellationToken)
{
new BaseNfoParser<MusicArtist>(_logger, _config, _providerManager).Fetch(result, path, cancellationToken);
new BaseNfoParser<MusicArtist>(_logger, _config, _providerManager, _userManager, _userDataManager).Fetch(result, path, cancellationToken);
}
/// <inheritdoc />

View File

@ -4,6 +4,7 @@ using System.Linq;
using System.Threading;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.IO;
using MediaBrowser.XbmcMetadata.Parsers;
@ -18,17 +19,23 @@ namespace MediaBrowser.XbmcMetadata.Providers
private readonly ILogger<BaseVideoNfoProvider<T>> _logger;
private readonly IConfigurationManager _config;
private readonly IProviderManager _providerManager;
private readonly IUserManager _userManager;
private readonly IUserDataManager _userDataManager;
public BaseVideoNfoProvider(
ILogger<BaseVideoNfoProvider<T>> logger,
IFileSystem fileSystem,
IConfigurationManager config,
IProviderManager providerManager)
IProviderManager providerManager,
IUserManager userManager,
IUserDataManager userDataManager)
: base(fileSystem)
{
_logger = logger;
_config = config;
_providerManager = providerManager;
_userManager = userManager;
_userDataManager = userDataManager;
}
/// <inheritdoc />
@ -38,7 +45,7 @@ namespace MediaBrowser.XbmcMetadata.Providers
{
Item = result.Item
};
new MovieNfoParser(_logger, _config, _providerManager).Fetch(tmpItem, path, cancellationToken);
new MovieNfoParser(_logger, _config, _providerManager, _userManager, _userDataManager).Fetch(tmpItem, path, cancellationToken);
result.Item = (T)tmpItem.Item;
result.People = tmpItem.People;

View File

@ -2,6 +2,7 @@ using System.IO;
using System.Threading;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.IO;
using MediaBrowser.XbmcMetadata.Parsers;
@ -17,30 +18,38 @@ namespace MediaBrowser.XbmcMetadata.Providers
private readonly ILogger<EpisodeNfoProvider> _logger;
private readonly IConfigurationManager _config;
private readonly IProviderManager _providerManager;
private readonly IUserManager _userManager;
private readonly IUserDataManager _userDataManager;
/// <summary>
/// Initializes a new instance of the <see cref="EpisodeNfoProvider"/> class.
/// </summary>
/// <param name="logger">The logger.</param>
/// <param name="fileSystem">The file system.</param>
/// <param name="config">the configuration manager.</param>
/// <param name="providerManager">The provider manager.</param>
/// <param name="logger">Instance of the <see cref="ILogger{EpisodeNfoProvider}"/> interface.</param>
/// <param name="fileSystem">Instance of the <see cref="IFileSystem"/> 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 EpisodeNfoProvider(
ILogger<EpisodeNfoProvider> logger,
IFileSystem fileSystem,
IConfigurationManager config,
IProviderManager providerManager)
IProviderManager providerManager,
IUserManager userManager,
IUserDataManager userDataManager)
: base(fileSystem)
{
_logger = logger;
_config = config;
_providerManager = providerManager;
_userManager = userManager;
_userDataManager = userDataManager;
}
/// <inheritdoc />
protected override void Fetch(MetadataResult<Episode> result, string path, CancellationToken cancellationToken)
{
new EpisodeNfoParser(_logger, _config, _providerManager).Fetch(result, path, cancellationToken);
new EpisodeNfoParser(_logger, _config, _providerManager, _userManager, _userDataManager).Fetch(result, path, cancellationToken);
}
/// <inheritdoc />

View File

@ -1,5 +1,6 @@
using MediaBrowser.Common.Configuration;
using MediaBrowser.Controller.Entities.Movies;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.IO;
using Microsoft.Extensions.Logging;
@ -14,16 +15,20 @@ namespace MediaBrowser.XbmcMetadata.Providers
/// <summary>
/// Initializes a new instance of the <see cref="MovieNfoProvider"/> class.
/// </summary>
/// <param name="logger">The logger.</param>
/// <param name="fileSystem">The file system.</param>
/// <param name="config">the configuration manager.</param>
/// <param name="providerManager">The provider manager.</param>
/// <param name="logger">Instance of the <see cref="ILogger{MovieNfoProvider}"/> interface.</param>
/// <param name="fileSystem">Instance of the <see cref="IFileSystem"/> 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 MovieNfoProvider(
ILogger<MovieNfoProvider> logger,
IFileSystem fileSystem,
IConfigurationManager config,
IProviderManager providerManager)
: base(logger, fileSystem, config, providerManager)
IProviderManager providerManager,
IUserManager userManager,
IUserDataManager userDataManager)
: base(logger, fileSystem, config, providerManager, userManager, userDataManager)
{
}
}

View File

@ -1,5 +1,6 @@
using MediaBrowser.Common.Configuration;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.IO;
using Microsoft.Extensions.Logging;
@ -14,12 +15,20 @@ namespace MediaBrowser.XbmcMetadata.Providers
/// <summary>
/// Initializes a new instance of the <see cref="MusicVideoNfoProvider"/> class.
/// </summary>
/// <param name="logger">The logger.</param>
/// <param name="fileSystem">The file system.</param>
/// <param name="config">the configuration manager.</param>
/// <param name="providerManager">The provider manager.</param>
public MusicVideoNfoProvider(ILogger<MusicVideoNfoProvider> logger, IFileSystem fileSystem, IConfigurationManager config, IProviderManager providerManager)
: base(logger, fileSystem, config, providerManager)
/// <param name="logger">Instance of the <see cref="ILogger{SeasonNfoProvider}"/> interface.</param>
/// <param name="fileSystem">Instance of the <see cref="IFileSystem"/> 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 MusicVideoNfoProvider(
ILogger<MusicVideoNfoProvider> logger,
IFileSystem fileSystem,
IConfigurationManager config,
IProviderManager providerManager,
IUserManager userManager,
IUserDataManager userDataManager)
: base(logger, fileSystem, config, providerManager, userManager, userDataManager)
{
}
}

View File

@ -2,6 +2,7 @@ using System.IO;
using System.Threading;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.IO;
using MediaBrowser.XbmcMetadata.Parsers;
@ -17,30 +18,38 @@ namespace MediaBrowser.XbmcMetadata.Providers
private readonly ILogger<SeasonNfoProvider> _logger;
private readonly IConfigurationManager _config;
private readonly IProviderManager _providerManager;
private readonly IUserManager _userManager;
private readonly IUserDataManager _userDataManager;
/// <summary>
/// Initializes a new instance of the <see cref="SeasonNfoProvider"/> class.
/// </summary>
/// <param name="logger">The logger.</param>
/// <param name="fileSystem">The file system.</param>
/// <param name="config">the configuration manager.</param>
/// <param name="providerManager">The provider manager.</param>
/// <param name="logger">Instance of the <see cref="ILogger{SeasonNfoProvider}"/> interface.</param>
/// <param name="fileSystem">Instance of the <see cref="IFileSystem"/> 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 SeasonNfoProvider(
ILogger<SeasonNfoProvider> logger,
IFileSystem fileSystem,
IConfigurationManager config,
IProviderManager providerManager)
IProviderManager providerManager,
IUserManager userManager,
IUserDataManager userDataManager)
: base(fileSystem)
{
_logger = logger;
_config = config;
_providerManager = providerManager;
_userManager = userManager;
_userDataManager = userDataManager;
}
/// <inheritdoc />
protected override void Fetch(MetadataResult<Season> result, string path, CancellationToken cancellationToken)
{
new SeasonNfoParser(_logger, _config, _providerManager).Fetch(result, path, cancellationToken);
new SeasonNfoParser(_logger, _config, _providerManager, _userManager, _userDataManager).Fetch(result, path, cancellationToken);
}
/// <inheritdoc />

View File

@ -2,6 +2,7 @@ using System.IO;
using System.Threading;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.IO;
using MediaBrowser.XbmcMetadata.Parsers;
@ -17,30 +18,38 @@ namespace MediaBrowser.XbmcMetadata.Providers
private readonly ILogger<SeriesNfoProvider> _logger;
private readonly IConfigurationManager _config;
private readonly IProviderManager _providerManager;
private readonly IUserManager _userManager;
private readonly IUserDataManager _userDataManager;
/// <summary>
/// Initializes a new instance of the <see cref="SeriesNfoProvider"/> class.
/// </summary>
/// <param name="logger">The logger.</param>
/// <param name="fileSystem">The file system.</param>
/// <param name="config">the configuration manager.</param>
/// <param name="providerManager">The provider manager.</param>
/// <param name="logger">Instance of the <see cref="ILogger{SeriesNfoProvider}"/> interface.</param>
/// <param name="fileSystem">Instance of the <see cref="IFileSystem"/> 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 SeriesNfoProvider(
ILogger<SeriesNfoProvider> logger,
IFileSystem fileSystem,
IConfigurationManager config,
IProviderManager providerManager)
IProviderManager providerManager,
IUserManager userManager,
IUserDataManager userDataManager)
: base(fileSystem)
{
_logger = logger;
_config = config;
_providerManager = providerManager;
_userManager = userManager;
_userDataManager = userDataManager;
}
/// <inheritdoc />
protected override void Fetch(MetadataResult<Series> result, string path, CancellationToken cancellationToken)
{
new SeriesNfoParser(_logger, _config, _providerManager).Fetch(result, path, cancellationToken);
new SeriesNfoParser(_logger, _config, _providerManager, _userManager, _userDataManager).Fetch(result, path, cancellationToken);
}
/// <inheritdoc />

View File

@ -1,5 +1,6 @@
using MediaBrowser.Common.Configuration;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.IO;
using Microsoft.Extensions.Logging;
@ -14,12 +15,20 @@ namespace MediaBrowser.XbmcMetadata.Providers
/// <summary>
/// Initializes a new instance of the <see cref="VideoNfoProvider"/> class.
/// </summary>
/// <param name="logger">The logger.</param>
/// <param name="fileSystem">The file system.</param>
/// <param name="config">the configuration manager.</param>
/// <param name="providerManager">The provider manager.</param>
public VideoNfoProvider(ILogger<VideoNfoProvider> logger, IFileSystem fileSystem, IConfigurationManager config, IProviderManager providerManager)
: base(logger, fileSystem, config, providerManager)
/// <param name="logger">Instance of the <see cref="ILogger{VideoNfoProvider}"/> interface.</param>
/// <param name="fileSystem">Instance of the <see cref="IFileSystem"/> 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 VideoNfoProvider(
ILogger<VideoNfoProvider> logger,
IFileSystem fileSystem,
IConfigurationManager config,
IProviderManager providerManager,
IUserManager userManager,
IUserDataManager userDataManager)
: base(logger, fileSystem, config, providerManager, userManager, userDataManager)
{
}
}

View File

@ -3,6 +3,7 @@ using System.Linq;
using System.Threading;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Entities;
@ -28,7 +29,10 @@ namespace Jellyfin.XbmcMetadata.Tests.Parsers
var config = new Mock<IConfigurationManager>();
config.Setup(x => x.GetConfiguration(It.IsAny<string>()))
.Returns(new XbmcMetadataOptions());
_parser = new EpisodeNfoParser(new NullLogger<EpisodeNfoParser>(), config.Object, providerManager.Object);
var user = new Mock<IUserManager>();
var userData = new Mock<IUserDataManager>();
_parser = new EpisodeNfoParser(new NullLogger<EpisodeNfoParser>(), config.Object, providerManager.Object, user.Object, userData.Object);
}
[Fact]

View File

@ -3,6 +3,7 @@ using System.Linq;
using System.Threading;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Entities;
@ -26,7 +27,10 @@ namespace Jellyfin.XbmcMetadata.Tests.Parsers
var config = new Mock<IConfigurationManager>();
config.Setup(x => x.GetConfiguration(It.IsAny<string>()))
.Returns(new XbmcMetadataOptions());
_parser = new MovieNfoParser(new NullLogger<MovieNfoParser>(), config.Object, providerManager.Object);
var user = new Mock<IUserManager>();
var userData = new Mock<IUserDataManager>();
_parser = new MovieNfoParser(new NullLogger<MovieNfoParser>(), config.Object, providerManager.Object, user.Object, userData.Object);
}
[Fact]

View File

@ -5,6 +5,7 @@ using System.Linq;
using System.Threading;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Entities;
@ -28,7 +29,10 @@ namespace Jellyfin.XbmcMetadata.Tests.Parsers
var config = new Mock<IConfigurationManager>();
config.Setup(x => x.GetConfiguration(It.IsAny<string>()))
.Returns(new XbmcMetadataOptions());
_parser = new BaseNfoParser<MusicAlbum>(new NullLogger<BaseNfoParser<MusicAlbum>>(), config.Object, providerManager.Object);
var user = new Mock<IUserManager>();
var userData = new Mock<IUserDataManager>();
_parser = new BaseNfoParser<MusicAlbum>(new NullLogger<BaseNfoParser<MusicAlbum>>(), config.Object, providerManager.Object, user.Object, userData.Object);
}
[Fact]

View File

@ -3,6 +3,7 @@ using System.Linq;
using System.Threading;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Entities;
@ -26,7 +27,10 @@ namespace Jellyfin.XbmcMetadata.Tests.Parsers
var config = new Mock<IConfigurationManager>();
config.Setup(x => x.GetConfiguration(It.IsAny<string>()))
.Returns(new XbmcMetadataOptions());
_parser = new BaseNfoParser<MusicArtist>(new NullLogger<BaseNfoParser<MusicArtist>>(), config.Object, providerManager.Object);
var user = new Mock<IUserManager>();
var userData = new Mock<IUserDataManager>();
_parser = new BaseNfoParser<MusicArtist>(new NullLogger<BaseNfoParser<MusicArtist>>(), config.Object, providerManager.Object, user.Object, userData.Object);
}
[Fact]

View File

@ -5,6 +5,7 @@ using System.Linq;
using System.Threading;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Entities;
@ -28,7 +29,10 @@ namespace Jellyfin.XbmcMetadata.Tests.Parsers
var config = new Mock<IConfigurationManager>();
config.Setup(x => x.GetConfiguration(It.IsAny<string>()))
.Returns(new XbmcMetadataOptions());
_parser = new SeasonNfoParser(new NullLogger<SeasonNfoParser>(), config.Object, providerManager.Object);
var user = new Mock<IUserManager>();
var userData = new Mock<IUserDataManager>();
_parser = new SeasonNfoParser(new NullLogger<SeasonNfoParser>(), config.Object, providerManager.Object, user.Object, userData.Object);
}
[Fact]

View File

@ -3,6 +3,7 @@ using System.Linq;
using System.Threading;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Entities;
@ -26,7 +27,10 @@ namespace Jellyfin.XbmcMetadata.Tests.Parsers
var config = new Mock<IConfigurationManager>();
config.Setup(x => x.GetConfiguration(It.IsAny<string>()))
.Returns(new XbmcMetadataOptions());
_parser = new SeriesNfoParser(new NullLogger<SeriesNfoParser>(), config.Object, providerManager.Object);
var user = new Mock<IUserManager>();
var userData = new Mock<IUserDataManager>();
_parser = new SeriesNfoParser(new NullLogger<SeriesNfoParser>(), config.Object, providerManager.Object, user.Object, userData.Object);
}
[Fact]