Only reading the result of GetMediaInfo if it completed successfully

This commit is contained in:
Ulrich Wagner 2020-02-19 08:39:01 +01:00
parent a62196afc7
commit 5fed4d10ab

View File

@ -2389,7 +2389,6 @@ namespace Emby.Server.Implementations.Library
public bool FillMissingEpisodeNumbersFromPath(Episode episode, bool forceRefresh) public bool FillMissingEpisodeNumbersFromPath(Episode episode, bool forceRefresh)
{ {
var libraryOptions = GetLibraryOptions(episode);
var series = episode.Series; var series = episode.Series;
bool? isAbsoluteNaming = series == null ? false : string.Equals(series.DisplayOrder, "absolute", StringComparison.OrdinalIgnoreCase); bool? isAbsoluteNaming = series == null ? false : string.Equals(series.DisplayOrder, "absolute", StringComparison.OrdinalIgnoreCase);
if (!isAbsoluteNaming.Value) if (!isAbsoluteNaming.Value)
@ -2411,6 +2410,9 @@ namespace Emby.Server.Implementations.Library
episodeInfo = new Naming.TV.EpisodeInfo(); episodeInfo = new Naming.TV.EpisodeInfo();
} }
try
{
var libraryOptions = GetLibraryOptions(episode);
if (libraryOptions.EnableEmbeddedEpisodeInfos && episodeInfo.Container.ToLowerInvariant() == "mp4") { if (libraryOptions.EnableEmbeddedEpisodeInfos && episodeInfo.Container.ToLowerInvariant() == "mp4") {
// Read from metadata // Read from metadata
IMediaEncoder mediaEncoder = _appHost.Resolve<IMediaEncoder>(); IMediaEncoder mediaEncoder = _appHost.Resolve<IMediaEncoder>();
@ -2422,6 +2424,7 @@ namespace Emby.Server.Implementations.Library
}, CancellationToken.None); }, CancellationToken.None);
task.Wait(); task.Wait();
if (task.IsCompletedSuccessfully) {
if (task.Result.ParentIndexNumber > 0) { if (task.Result.ParentIndexNumber > 0) {
episodeInfo.SeasonNumber = task.Result.ParentIndexNumber; episodeInfo.SeasonNumber = task.Result.ParentIndexNumber;
} }
@ -2432,6 +2435,12 @@ namespace Emby.Server.Implementations.Library
episodeInfo.SeriesName = task.Result.ShowName; episodeInfo.SeriesName = task.Result.ShowName;
} }
} }
}
}
catch (Exception ex)
{
_logger.LogError(ex, "Error reading the episode informations with ffprobe. Episode: {episodeInfo}", episodeInfo.Path);
}
var changed = false; var changed = false;