mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-08 04:18:06 +02:00
If the lookup fails (due to a bad id in an nfo file for example), then we had no indication of which directory failed, so the user can not fix the problem. Now we include the path in the error message such as: MediaBrowser.Providers.TV.SeriesMetadataService: Error in DummySeasonProvider for /media/x/y/z and MediaBrowser.Providers.Manager.ProviderManager: TvdbSeriesImageProvider failed in GetImageInfos for type Series at /media/x/y/z
105 lines
3.7 KiB
C#
105 lines
3.7 KiB
C#
#pragma warning disable CS1591
|
|
|
|
using System;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using MediaBrowser.Controller.Configuration;
|
|
using MediaBrowser.Controller.Entities.TV;
|
|
using MediaBrowser.Controller.Library;
|
|
using MediaBrowser.Controller.Providers;
|
|
using MediaBrowser.Model.Entities;
|
|
using MediaBrowser.Model.Globalization;
|
|
using MediaBrowser.Model.IO;
|
|
using MediaBrowser.Providers.Manager;
|
|
using MediaBrowser.Providers.Plugins.TheTvdb;
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
namespace MediaBrowser.Providers.TV
|
|
{
|
|
public class SeriesMetadataService : MetadataService<Series, SeriesInfo>
|
|
{
|
|
private readonly ILocalizationManager _localization;
|
|
private readonly TvdbClientManager _tvdbClientManager;
|
|
|
|
public SeriesMetadataService(
|
|
IServerConfigurationManager serverConfigurationManager,
|
|
ILogger<SeriesMetadataService> logger,
|
|
IProviderManager providerManager,
|
|
IFileSystem fileSystem,
|
|
ILibraryManager libraryManager,
|
|
ILocalizationManager localization,
|
|
TvdbClientManager tvdbClientManager)
|
|
: base(serverConfigurationManager, logger, providerManager, fileSystem, libraryManager)
|
|
{
|
|
_localization = localization;
|
|
_tvdbClientManager = tvdbClientManager;
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override async Task AfterMetadataRefresh(Series item, MetadataRefreshOptions refreshOptions, CancellationToken cancellationToken)
|
|
{
|
|
await base.AfterMetadataRefresh(item, refreshOptions, cancellationToken).ConfigureAwait(false);
|
|
|
|
var seasonProvider = new DummySeasonProvider(Logger, _localization, LibraryManager, FileSystem);
|
|
await seasonProvider.Run(item, cancellationToken).ConfigureAwait(false);
|
|
|
|
// TODO why does it not register this itself omg
|
|
var provider = new MissingEpisodeProvider(
|
|
Logger,
|
|
ServerConfigurationManager,
|
|
LibraryManager,
|
|
_localization,
|
|
FileSystem,
|
|
_tvdbClientManager);
|
|
|
|
try
|
|
{
|
|
await provider.Run(item, true, CancellationToken.None).ConfigureAwait(false);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Logger.LogError(ex, "Error in DummySeasonProvider for {ItemPath}", item.Path);
|
|
}
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override bool IsFullLocalMetadata(Series item)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(item.Overview))
|
|
{
|
|
return false;
|
|
}
|
|
|
|
if (!item.ProductionYear.HasValue)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
return base.IsFullLocalMetadata(item);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void MergeData(MetadataResult<Series> source, MetadataResult<Series> target, MetadataField[] lockedFields, bool replaceData, bool mergeMetadataSettings)
|
|
{
|
|
ProviderUtils.MergeBaseItemData(source, target, lockedFields, replaceData, mergeMetadataSettings);
|
|
|
|
var sourceItem = source.Item;
|
|
var targetItem = target.Item;
|
|
|
|
if (replaceData || string.IsNullOrEmpty(targetItem.AirTime))
|
|
{
|
|
targetItem.AirTime = sourceItem.AirTime;
|
|
}
|
|
|
|
if (replaceData || !targetItem.Status.HasValue)
|
|
{
|
|
targetItem.Status = sourceItem.Status;
|
|
}
|
|
|
|
if (replaceData || targetItem.AirDays == null || targetItem.AirDays.Length == 0)
|
|
{
|
|
targetItem.AirDays = sourceItem.AirDays;
|
|
}
|
|
}
|
|
}
|
|
}
|