BookMetadataService.cs 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using MediaBrowser.Controller.Configuration;
  2. using MediaBrowser.Controller.Entities;
  3. using MediaBrowser.Controller.IO;
  4. using MediaBrowser.Controller.Library;
  5. using MediaBrowser.Controller.MediaSegments;
  6. using MediaBrowser.Controller.Providers;
  7. using MediaBrowser.Model.Entities;
  8. using MediaBrowser.Model.IO;
  9. using MediaBrowser.Providers.Manager;
  10. using Microsoft.Extensions.Logging;
  11. namespace MediaBrowser.Providers.Books;
  12. /// <summary>
  13. /// Service to manage book metadata.
  14. /// </summary>
  15. public class BookMetadataService : MetadataService<Book, BookInfo>
  16. {
  17. /// <summary>
  18. /// Initializes a new instance of the <see cref="BookMetadataService"/> class.
  19. /// </summary>
  20. /// <param name="serverConfigurationManager">Instance of the <see cref="IServerConfigurationManager"/>.</param>
  21. /// <param name="logger">Instance of the <see cref="ILogger"/> interface.</param>
  22. /// <param name="providerManager">Instance of the <see cref="IProviderManager"/> interface.</param>
  23. /// <param name="fileSystem">Instance of the <see cref="IFileSystem"/> interface.</param>
  24. /// <param name="libraryManager">Instance of the <see cref="ILibraryManager"/> interface.</param>
  25. /// <param name="pathManager">Instance of the <see cref="IPathManager"/> interface.</param>
  26. /// <param name="keyframeManager">Instance of the <see cref="IKeyframeManager"/> interface.</param>
  27. /// <param name="mediaSegmentManager">Instance of the <see cref="IMediaSegmentManager"/> interface.</param>
  28. public BookMetadataService(
  29. IServerConfigurationManager serverConfigurationManager,
  30. ILogger<BookMetadataService> logger,
  31. IProviderManager providerManager,
  32. IFileSystem fileSystem,
  33. ILibraryManager libraryManager,
  34. IPathManager pathManager,
  35. IKeyframeManager keyframeManager,
  36. IMediaSegmentManager mediaSegmentManager)
  37. : base(serverConfigurationManager, logger, providerManager, fileSystem, libraryManager, pathManager, keyframeManager, mediaSegmentManager)
  38. {
  39. }
  40. /// <inheritdoc />
  41. protected override void MergeData(MetadataResult<Book> source, MetadataResult<Book> target, MetadataField[] lockedFields, bool replaceData, bool mergeMetadataSettings)
  42. {
  43. base.MergeData(source, target, lockedFields, replaceData, mergeMetadataSettings);
  44. if (replaceData || string.IsNullOrEmpty(target.Item.SeriesName))
  45. {
  46. target.Item.SeriesName = source.Item.SeriesName;
  47. }
  48. }
  49. }