PlaylistMetadataService.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. using MediaBrowser.Common.IO;
  2. using MediaBrowser.Controller.Configuration;
  3. using MediaBrowser.Controller.Library;
  4. using MediaBrowser.Controller.Playlists;
  5. using MediaBrowser.Controller.Providers;
  6. using MediaBrowser.Model.Entities;
  7. using MediaBrowser.Model.Logging;
  8. using MediaBrowser.Providers.Manager;
  9. using System.Collections.Generic;
  10. using CommonIO;
  11. namespace MediaBrowser.Providers.Playlists
  12. {
  13. class PlaylistMetadataService : MetadataService<Playlist, ItemLookupInfo>
  14. {
  15. public PlaylistMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IProviderRepository providerRepo, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager) : base(serverConfigurationManager, logger, providerManager, providerRepo, fileSystem, userDataManager, libraryManager)
  16. {
  17. }
  18. protected override void MergeData(MetadataResult<Playlist> source, MetadataResult<Playlist> target, List<MetadataFields> lockedFields, bool replaceData, bool mergeMetadataSettings)
  19. {
  20. ProviderUtils.MergeBaseItemData(source, target, lockedFields, replaceData, mergeMetadataSettings);
  21. var sourceItem = source.Item;
  22. var targetItem = target.Item;
  23. if (replaceData || string.IsNullOrEmpty(targetItem.PlaylistMediaType))
  24. {
  25. targetItem.PlaylistMediaType = sourceItem.PlaylistMediaType;
  26. }
  27. if (mergeMetadataSettings)
  28. {
  29. targetItem.LinkedChildren = sourceItem.LinkedChildren;
  30. targetItem.Shares = sourceItem.Shares;
  31. }
  32. }
  33. }
  34. }