BoxSetXmlSaver.cs 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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="userManager">Instance of the <see cref="IUserManager"/> interface.</param>
  23. /// <param name="userDataManager">Instance of the <see cref="IUserDataManager"/> interface.</param>
  24. /// <param name="logger">Instance of the <see cref="ILogger{BoxSetXmlSaver}"/> interface.</param>
  25. public BoxSetXmlSaver(IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILibraryManager libraryManager, IUserManager userManager, IUserDataManager userDataManager, ILogger<BoxSetXmlSaver> logger)
  26. : base(fileSystem, configurationManager, libraryManager, userManager, userDataManager, logger)
  27. {
  28. }
  29. /// <inheritdoc />
  30. public override bool IsEnabledFor(BaseItem item, ItemUpdateType updateType)
  31. {
  32. if (!item.SupportsLocalMetadata)
  33. {
  34. return false;
  35. }
  36. return item is BoxSet && updateType >= ItemUpdateType.MetadataDownload;
  37. }
  38. /// <inheritdoc />
  39. protected override void WriteCustomElements(BaseItem item, XmlWriter writer)
  40. {
  41. }
  42. /// <inheritdoc />
  43. protected override string GetLocalSavePath(BaseItem item)
  44. {
  45. return Path.Combine(item.Path, "collection.xml");
  46. }
  47. }
  48. }