| | | 1 | | using System.IO; |
| | | 2 | | using System.Threading.Tasks; |
| | | 3 | | using System.Xml; |
| | | 4 | | using MediaBrowser.Controller.Configuration; |
| | | 5 | | using MediaBrowser.Controller.Entities; |
| | | 6 | | using MediaBrowser.Controller.Entities.Movies; |
| | | 7 | | using MediaBrowser.Controller.Library; |
| | | 8 | | using MediaBrowser.Model.IO; |
| | | 9 | | using Microsoft.Extensions.Logging; |
| | | 10 | | |
| | | 11 | | namespace MediaBrowser.LocalMetadata.Savers |
| | | 12 | | { |
| | | 13 | | /// <summary> |
| | | 14 | | /// Box set xml saver. |
| | | 15 | | /// </summary> |
| | | 16 | | public class BoxSetXmlSaver : BaseXmlSaver |
| | | 17 | | { |
| | | 18 | | /// <summary> |
| | | 19 | | /// Initializes a new instance of the <see cref="BoxSetXmlSaver"/> class. |
| | | 20 | | /// </summary> |
| | | 21 | | /// <param name="fileSystem">Instance of the <see cref="IFileSystem"/> interface.</param> |
| | | 22 | | /// <param name="configurationManager">Instance of the <see cref="IServerConfigurationManager"/> interface.</par |
| | | 23 | | /// <param name="libraryManager">Instance of the <see cref="ILibraryManager"/> interface.</param> |
| | | 24 | | /// <param name="logger">Instance of the <see cref="ILogger{BoxSetXmlSaver}"/> interface.</param> |
| | | 25 | | public BoxSetXmlSaver(IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILibraryManager |
| | 21 | 26 | | : base(fileSystem, configurationManager, libraryManager, logger) |
| | | 27 | | { |
| | 21 | 28 | | } |
| | | 29 | | |
| | | 30 | | /// <inheritdoc /> |
| | | 31 | | public override bool IsEnabledFor(BaseItem item, ItemUpdateType updateType) |
| | | 32 | | { |
| | 165 | 33 | | if (!item.SupportsLocalMetadata) |
| | | 34 | | { |
| | 0 | 35 | | return false; |
| | | 36 | | } |
| | | 37 | | |
| | 165 | 38 | | return item is BoxSet && updateType >= ItemUpdateType.MetadataDownload; |
| | | 39 | | } |
| | | 40 | | |
| | | 41 | | /// <inheritdoc /> |
| | | 42 | | protected override Task WriteCustomElementsAsync(BaseItem item, XmlWriter writer) |
| | 0 | 43 | | => Task.CompletedTask; |
| | | 44 | | |
| | | 45 | | /// <inheritdoc /> |
| | | 46 | | protected override string GetLocalSavePath(BaseItem item) |
| | | 47 | | { |
| | 0 | 48 | | return Path.Combine(item.Path, "collection.xml"); |
| | | 49 | | } |
| | | 50 | | } |
| | | 51 | | } |