BoxSetXmlSaver.cs 1.9 KB

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