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