2020-06-19 11:24:13 -07:00
|
|
|
#pragma warning disable CS1591
|
|
|
|
|
2019-01-13 13:03:10 -07:00
|
|
|
using MediaBrowser.Controller.Configuration;
|
2016-12-11 22:49:19 -07:00
|
|
|
using MediaBrowser.Controller.Entities;
|
|
|
|
using MediaBrowser.Controller.Library;
|
|
|
|
using MediaBrowser.Controller.Providers;
|
|
|
|
using MediaBrowser.Model.Entities;
|
|
|
|
using MediaBrowser.Model.IO;
|
2019-01-13 12:26:31 -07:00
|
|
|
using MediaBrowser.Providers.Manager;
|
|
|
|
using Microsoft.Extensions.Logging;
|
2016-12-11 22:49:19 -07:00
|
|
|
|
|
|
|
namespace MediaBrowser.Providers.Books
|
|
|
|
{
|
|
|
|
public class AudioBookMetadataService : MetadataService<AudioBook, SongInfo>
|
|
|
|
{
|
2019-08-29 13:28:33 -07:00
|
|
|
public AudioBookMetadataService(
|
|
|
|
IServerConfigurationManager serverConfigurationManager,
|
2020-03-03 15:07:10 -07:00
|
|
|
ILogger<AudioBookMetadataService> logger,
|
2019-08-29 13:28:33 -07:00
|
|
|
IProviderManager providerManager,
|
|
|
|
IFileSystem fileSystem,
|
|
|
|
ILibraryManager libraryManager)
|
2019-09-10 13:37:53 -07:00
|
|
|
: base(serverConfigurationManager, logger, providerManager, fileSystem, libraryManager)
|
2019-08-29 13:28:33 -07:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
protected override void MergeData(
|
|
|
|
MetadataResult<AudioBook> source,
|
|
|
|
MetadataResult<AudioBook> target,
|
2020-06-09 15:12:53 -07:00
|
|
|
MetadataField[] lockedFields,
|
2019-08-29 13:28:33 -07:00
|
|
|
bool replaceData,
|
|
|
|
bool mergeMetadataSettings)
|
2016-12-11 22:49:19 -07:00
|
|
|
{
|
2021-12-24 07:30:52 -07:00
|
|
|
base.MergeData(source, target, lockedFields, replaceData, mergeMetadataSettings);
|
2016-12-11 22:49:19 -07:00
|
|
|
|
|
|
|
var sourceItem = source.Item;
|
|
|
|
var targetItem = target.Item;
|
|
|
|
|
2019-08-29 13:28:33 -07:00
|
|
|
if (replaceData || targetItem.Artists.Count == 0)
|
2016-12-11 22:49:19 -07:00
|
|
|
{
|
2017-08-24 12:52:19 -07:00
|
|
|
targetItem.Artists = sourceItem.Artists;
|
2016-12-11 22:49:19 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
if (replaceData || string.IsNullOrEmpty(targetItem.Album))
|
|
|
|
{
|
|
|
|
targetItem.Album = sourceItem.Album;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|