| | 1 | | #pragma warning disable CS1591 |
| | 2 | |
|
| | 3 | | using System.Linq; |
| | 4 | | using MediaBrowser.Controller.Configuration; |
| | 5 | | using MediaBrowser.Controller.Entities; |
| | 6 | | using MediaBrowser.Controller.Library; |
| | 7 | | using MediaBrowser.Controller.Providers; |
| | 8 | | using MediaBrowser.Model.Entities; |
| | 9 | | using MediaBrowser.Model.IO; |
| | 10 | | using MediaBrowser.Providers.Manager; |
| | 11 | | using Microsoft.Extensions.Logging; |
| | 12 | |
|
| | 13 | | namespace MediaBrowser.Providers.Music |
| | 14 | | { |
| | 15 | | public class MusicVideoMetadataService : MetadataService<MusicVideo, MusicVideoInfo> |
| | 16 | | { |
| | 17 | | public MusicVideoMetadataService( |
| | 18 | | IServerConfigurationManager serverConfigurationManager, |
| | 19 | | ILogger<MusicVideoMetadataService> logger, |
| | 20 | | IProviderManager providerManager, |
| | 21 | | IFileSystem fileSystem, |
| | 22 | | ILibraryManager libraryManager) |
| 21 | 23 | | : base(serverConfigurationManager, logger, providerManager, fileSystem, libraryManager) |
| | 24 | | { |
| 21 | 25 | | } |
| | 26 | |
|
| | 27 | | /// <inheritdoc /> |
| | 28 | | protected override void MergeData( |
| | 29 | | MetadataResult<MusicVideo> source, |
| | 30 | | MetadataResult<MusicVideo> target, |
| | 31 | | MetadataField[] lockedFields, |
| | 32 | | bool replaceData, |
| | 33 | | bool mergeMetadataSettings) |
| | 34 | | { |
| 0 | 35 | | base.MergeData(source, target, lockedFields, replaceData, mergeMetadataSettings); |
| | 36 | |
|
| 0 | 37 | | var sourceItem = source.Item; |
| 0 | 38 | | var targetItem = target.Item; |
| | 39 | |
|
| 0 | 40 | | if (replaceData || string.IsNullOrEmpty(targetItem.Album)) |
| | 41 | | { |
| 0 | 42 | | targetItem.Album = sourceItem.Album; |
| | 43 | | } |
| | 44 | |
|
| 0 | 45 | | if (replaceData || targetItem.Artists.Count == 0) |
| | 46 | | { |
| 0 | 47 | | targetItem.Artists = sourceItem.Artists; |
| | 48 | | } |
| | 49 | | else |
| | 50 | | { |
| 0 | 51 | | targetItem.Artists = targetItem.Artists.Concat(sourceItem.Artists).Distinct().ToArray(); |
| | 52 | | } |
| 0 | 53 | | } |
| | 54 | | } |
| | 55 | | } |