| | 1 | | #pragma warning disable CS1591 |
| | 2 | |
|
| | 3 | | using System.Linq; |
| | 4 | | using System.Threading; |
| | 5 | | using MediaBrowser.Common.Configuration; |
| | 6 | | using MediaBrowser.Controller.Entities; |
| | 7 | | using MediaBrowser.Controller.Library; |
| | 8 | | using MediaBrowser.Controller.Providers; |
| | 9 | | using MediaBrowser.Model.IO; |
| | 10 | | using MediaBrowser.XbmcMetadata.Parsers; |
| | 11 | | using MediaBrowser.XbmcMetadata.Savers; |
| | 12 | | using Microsoft.Extensions.Logging; |
| | 13 | |
|
| | 14 | | namespace MediaBrowser.XbmcMetadata.Providers |
| | 15 | | { |
| | 16 | | public abstract class BaseVideoNfoProvider<T> : BaseNfoProvider<T> |
| | 17 | | where T : Video, new() |
| | 18 | | { |
| | 19 | | private readonly ILogger<BaseVideoNfoProvider<T>> _logger; |
| | 20 | | private readonly IConfigurationManager _config; |
| | 21 | | private readonly IProviderManager _providerManager; |
| | 22 | | private readonly IUserManager _userManager; |
| | 23 | | private readonly IUserDataManager _userDataManager; |
| | 24 | | private readonly IDirectoryService _directoryService; |
| | 25 | |
|
| | 26 | | protected BaseVideoNfoProvider( |
| | 27 | | ILogger<BaseVideoNfoProvider<T>> logger, |
| | 28 | | IFileSystem fileSystem, |
| | 29 | | IConfigurationManager config, |
| | 30 | | IProviderManager providerManager, |
| | 31 | | IUserManager userManager, |
| | 32 | | IUserDataManager userDataManager, |
| | 33 | | IDirectoryService directoryService) |
| 63 | 34 | | : base(fileSystem) |
| | 35 | | { |
| 63 | 36 | | _logger = logger; |
| 63 | 37 | | _config = config; |
| 63 | 38 | | _providerManager = providerManager; |
| 63 | 39 | | _userManager = userManager; |
| 63 | 40 | | _userDataManager = userDataManager; |
| 63 | 41 | | _directoryService = directoryService; |
| 63 | 42 | | } |
| | 43 | |
|
| | 44 | | /// <inheritdoc /> |
| | 45 | | protected override void Fetch(MetadataResult<T> result, string path, CancellationToken cancellationToken) |
| | 46 | | { |
| 0 | 47 | | var tmpItem = new MetadataResult<Video> |
| 0 | 48 | | { |
| 0 | 49 | | Item = result.Item |
| 0 | 50 | | }; |
| 0 | 51 | | new MovieNfoParser(_logger, _config, _providerManager, _userManager, _userDataManager, _directoryService).Fe |
| | 52 | |
|
| 0 | 53 | | result.Item = (T)tmpItem.Item; |
| 0 | 54 | | result.People = tmpItem.People; |
| 0 | 55 | | result.Images = tmpItem.Images; |
| 0 | 56 | | result.RemoteImages = tmpItem.RemoteImages; |
| 0 | 57 | | } |
| | 58 | |
|
| | 59 | | /// <inheritdoc /> |
| | 60 | | protected override FileSystemMetadata? GetXmlFile(ItemInfo info, IDirectoryService directoryService) |
| | 61 | | { |
| 0 | 62 | | return MovieNfoSaver.GetMovieSavePaths(info) |
| 0 | 63 | | .Select(directoryService.GetFile) |
| 0 | 64 | | .FirstOrDefault(i => i is not null); |
| | 65 | | } |
| | 66 | | } |
| | 67 | | } |