| | 1 | | using System.Threading; |
| | 2 | | using MediaBrowser.Controller.Playlists; |
| | 3 | | using MediaBrowser.Controller.Providers; |
| | 4 | | using MediaBrowser.LocalMetadata.Parsers; |
| | 5 | | using MediaBrowser.LocalMetadata.Savers; |
| | 6 | | using MediaBrowser.Model.IO; |
| | 7 | | using Microsoft.Extensions.Logging; |
| | 8 | |
|
| | 9 | | namespace MediaBrowser.LocalMetadata.Providers |
| | 10 | | { |
| | 11 | | /// <summary> |
| | 12 | | /// Playlist xml provider. |
| | 13 | | /// </summary> |
| | 14 | | public class PlaylistXmlProvider : BaseXmlProvider<Playlist> |
| | 15 | | { |
| | 16 | | private readonly ILogger<PlaylistXmlParser> _logger; |
| | 17 | | private readonly IProviderManager _providerManager; |
| | 18 | |
|
| | 19 | | /// <summary> |
| | 20 | | /// Initializes a new instance of the <see cref="PlaylistXmlProvider"/> class. |
| | 21 | | /// </summary> |
| | 22 | | /// <param name="fileSystem">Instance of the <see cref="IFileSystem"/> interface.</param> |
| | 23 | | /// <param name="logger">Instance of the <see cref="ILogger{PlaylistXmlParser}"/> interface.</param> |
| | 24 | | /// <param name="providerManager">Instance of the <see cref="IProviderManager"/> interface.</param> |
| | 25 | | public PlaylistXmlProvider( |
| | 26 | | IFileSystem fileSystem, |
| | 27 | | ILogger<PlaylistXmlParser> logger, |
| | 28 | | IProviderManager providerManager) |
| 21 | 29 | | : base(fileSystem) |
| | 30 | | { |
| 21 | 31 | | _logger = logger; |
| 21 | 32 | | _providerManager = providerManager; |
| 21 | 33 | | } |
| | 34 | |
|
| | 35 | | /// <inheritdoc /> |
| | 36 | | protected override void Fetch(MetadataResult<Playlist> result, string path, CancellationToken cancellationToken) |
| | 37 | | { |
| 0 | 38 | | new PlaylistXmlParser(_logger, _providerManager).Fetch(result, path, cancellationToken); |
| 0 | 39 | | } |
| | 40 | |
|
| | 41 | | /// <inheritdoc /> |
| | 42 | | protected override FileSystemMetadata? GetXmlFile(ItemInfo info, IDirectoryService directoryService) |
| | 43 | | { |
| 0 | 44 | | return directoryService.GetFile(PlaylistXmlSaver.GetSavePath(info.Path)); |
| | 45 | | } |
| | 46 | | } |
| | 47 | | } |