diff options
| author | Ulrich Wagner <ulrich.wagner@viaregio-services.de> | 2020-02-19 08:39:01 +0100 |
|---|---|---|
| committer | Ulrich Wagner <ulrich.wagner@viaregio-services.de> | 2020-02-19 08:39:01 +0100 |
| commit | 5fed4d10abde3c2c7d0567c81dfd535e5d15a0f3 (patch) | |
| tree | 470c0dfbb1e16f2e941386df94f9dba6d2669584 /Emby.Server.Implementations/Library/LibraryManager.cs | |
| parent | a62196afc7447217c752d23ff4733c7a8897f889 (diff) | |
Only reading the result of GetMediaInfo if it completed successfully
Diffstat (limited to 'Emby.Server.Implementations/Library/LibraryManager.cs')
| -rw-r--r-- | Emby.Server.Implementations/Library/LibraryManager.cs | 49 |
1 files changed, 29 insertions, 20 deletions
diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.cs index c390d2b82..b32e98863 100644 --- a/Emby.Server.Implementations/Library/LibraryManager.cs +++ b/Emby.Server.Implementations/Library/LibraryManager.cs @@ -2389,7 +2389,6 @@ namespace Emby.Server.Implementations.Library public bool FillMissingEpisodeNumbersFromPath(Episode episode, bool forceRefresh) { - var libraryOptions = GetLibraryOptions(episode); var series = episode.Series; bool? isAbsoluteNaming = series == null ? false : string.Equals(series.DisplayOrder, "absolute", StringComparison.OrdinalIgnoreCase); if (!isAbsoluteNaming.Value) @@ -2411,27 +2410,37 @@ namespace Emby.Server.Implementations.Library episodeInfo = new Naming.TV.EpisodeInfo(); } - if (libraryOptions.EnableEmbeddedEpisodeInfos && episodeInfo.Container.ToLowerInvariant() == "mp4") { - // Read from metadata - IMediaEncoder mediaEncoder = _appHost.Resolve<IMediaEncoder>(); - var task = mediaEncoder.GetMediaInfo(new MediaInfoRequest - { - MediaSource = episode.GetMediaSources(false).First(), - MediaType = DlnaProfileType.Video, - ExtractChapters = false - - }, CancellationToken.None); - task.Wait(); - if (task.Result.ParentIndexNumber > 0) { - episodeInfo.SeasonNumber = task.Result.ParentIndexNumber; - } - if (task.Result.IndexNumber > 0) { - episodeInfo.EpisodeNumber = task.Result.IndexNumber; - } - if (!string.IsNullOrEmpty(task.Result.ShowName)) { - episodeInfo.SeriesName = task.Result.ShowName; + try + { + var libraryOptions = GetLibraryOptions(episode); + if (libraryOptions.EnableEmbeddedEpisodeInfos && episodeInfo.Container.ToLowerInvariant() == "mp4") { + // Read from metadata + IMediaEncoder mediaEncoder = _appHost.Resolve<IMediaEncoder>(); + var task = mediaEncoder.GetMediaInfo(new MediaInfoRequest + { + MediaSource = episode.GetMediaSources(false).First(), + MediaType = DlnaProfileType.Video, + ExtractChapters = false + + }, CancellationToken.None); + task.Wait(); + if (task.IsCompletedSuccessfully) { + if (task.Result.ParentIndexNumber > 0) { + episodeInfo.SeasonNumber = task.Result.ParentIndexNumber; + } + if (task.Result.IndexNumber > 0) { + episodeInfo.EpisodeNumber = task.Result.IndexNumber; + } + if (!string.IsNullOrEmpty(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; |
