|  |  | 1 |  | using System.Linq; | 
|  |  | 2 |  | using MediaBrowser.Controller.Configuration; | 
|  |  | 3 |  | using MediaBrowser.Controller.Entities; | 
|  |  | 4 |  | using MediaBrowser.Controller.IO; | 
|  |  | 5 |  | using MediaBrowser.Controller.Library; | 
|  |  | 6 |  | using MediaBrowser.Controller.Persistence; | 
|  |  | 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.Movies; | 
|  |  | 14 |  |  | 
|  |  | 15 |  | /// <summary> | 
|  |  | 16 |  | /// Service to manage trailer metadata. | 
|  |  | 17 |  | /// </summary> | 
|  |  | 18 |  | public class TrailerMetadataService : MetadataService<Trailer, TrailerInfo> | 
|  |  | 19 |  | { | 
|  |  | 20 |  |     /// <summary> | 
|  |  | 21 |  |     /// Initializes a new instance of the <see cref="TrailerMetadataService"/> class. | 
|  |  | 22 |  |     /// </summary> | 
|  |  | 23 |  |     /// <param name="serverConfigurationManager">Instance of the <see cref="IServerConfigurationManager"/>.</param> | 
|  |  | 24 |  |     /// <param name="logger">Instance of the <see cref="ILogger"/> interface.</param> | 
|  |  | 25 |  |     /// <param name="providerManager">Instance of the <see cref="IProviderManager"/> interface.</param> | 
|  |  | 26 |  |     /// <param name="fileSystem">Instance of the <see cref="IFileSystem"/> interface.</param> | 
|  |  | 27 |  |     /// <param name="libraryManager">Instance of the <see cref="ILibraryManager"/> interface.</param> | 
|  |  | 28 |  |     /// <param name="externalDataManager">Instance of the <see cref="IExternalDataManager"/> interface.</param> | 
|  |  | 29 |  |     /// <param name="itemRepository">Instance of the <see cref="IItemRepository"/> interface.</param> | 
|  |  | 30 |  |     public TrailerMetadataService( | 
|  |  | 31 |  |         IServerConfigurationManager serverConfigurationManager, | 
|  |  | 32 |  |         ILogger<TrailerMetadataService> logger, | 
|  |  | 33 |  |         IProviderManager providerManager, | 
|  |  | 34 |  |         IFileSystem fileSystem, | 
|  |  | 35 |  |         ILibraryManager libraryManager, | 
|  |  | 36 |  |         IExternalDataManager externalDataManager, | 
|  |  | 37 |  |         IItemRepository itemRepository) | 
|  | 21 | 38 |  |         : base(serverConfigurationManager, logger, providerManager, fileSystem, libraryManager, externalDataManager, ite | 
|  |  | 39 |  |     { | 
|  | 21 | 40 |  |     } | 
|  |  | 41 |  |  | 
|  |  | 42 |  |     /// <inheritdoc /> | 
|  |  | 43 |  |     protected override void MergeData(MetadataResult<Trailer> source, MetadataResult<Trailer> target, MetadataField[] lo | 
|  |  | 44 |  |     { | 
|  | 0 | 45 |  |         base.MergeData(source, target, lockedFields, replaceData, mergeMetadataSettings); | 
|  |  | 46 |  |  | 
|  | 0 | 47 |  |         if (replaceData || target.Item.TrailerTypes.Length == 0) | 
|  |  | 48 |  |         { | 
|  | 0 | 49 |  |             target.Item.TrailerTypes = source.Item.TrailerTypes; | 
|  |  | 50 |  |         } | 
|  |  | 51 |  |         else | 
|  |  | 52 |  |         { | 
|  | 0 | 53 |  |             target.Item.TrailerTypes = target.Item.TrailerTypes.Concat(source.Item.TrailerTypes).Distinct().ToArray(); | 
|  |  | 54 |  |         } | 
|  | 0 | 55 |  |     } | 
|  |  | 56 |  | } |