Only reading the result of GetMediaInfo if it completed successfully
This commit is contained in:
parent
a62196afc7
commit
5fed4d10ab
|
@ -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,27 +2410,37 @@ namespace Emby.Server.Implementations.Library
|
||||||
episodeInfo = new Naming.TV.EpisodeInfo();
|
episodeInfo = new Naming.TV.EpisodeInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (libraryOptions.EnableEmbeddedEpisodeInfos && episodeInfo.Container.ToLowerInvariant() == "mp4") {
|
try
|
||||||
// Read from metadata
|
{
|
||||||
IMediaEncoder mediaEncoder = _appHost.Resolve<IMediaEncoder>();
|
var libraryOptions = GetLibraryOptions(episode);
|
||||||
var task = mediaEncoder.GetMediaInfo(new MediaInfoRequest
|
if (libraryOptions.EnableEmbeddedEpisodeInfos && episodeInfo.Container.ToLowerInvariant() == "mp4") {
|
||||||
{
|
// Read from metadata
|
||||||
MediaSource = episode.GetMediaSources(false).First(),
|
IMediaEncoder mediaEncoder = _appHost.Resolve<IMediaEncoder>();
|
||||||
MediaType = DlnaProfileType.Video,
|
var task = mediaEncoder.GetMediaInfo(new MediaInfoRequest
|
||||||
ExtractChapters = false
|
{
|
||||||
|
MediaSource = episode.GetMediaSources(false).First(),
|
||||||
|
MediaType = DlnaProfileType.Video,
|
||||||
|
ExtractChapters = false
|
||||||
|
|
||||||
}, CancellationToken.None);
|
}, CancellationToken.None);
|
||||||
task.Wait();
|
task.Wait();
|
||||||
if (task.Result.ParentIndexNumber > 0) {
|
if (task.IsCompletedSuccessfully) {
|
||||||
episodeInfo.SeasonNumber = task.Result.ParentIndexNumber;
|
if (task.Result.ParentIndexNumber > 0) {
|
||||||
}
|
episodeInfo.SeasonNumber = task.Result.ParentIndexNumber;
|
||||||
if (task.Result.IndexNumber > 0) {
|
}
|
||||||
episodeInfo.EpisodeNumber = task.Result.IndexNumber;
|
if (task.Result.IndexNumber > 0) {
|
||||||
}
|
episodeInfo.EpisodeNumber = task.Result.IndexNumber;
|
||||||
if (!string.IsNullOrEmpty(task.Result.ShowName)) {
|
}
|
||||||
episodeInfo.SeriesName = task.Result.ShowName;
|
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;
|
var changed = false;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user