aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Library/LibraryManager.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Emby.Server.Implementations/Library/LibraryManager.cs')
-rw-r--r--Emby.Server.Implementations/Library/LibraryManager.cs29
1 files changed, 14 insertions, 15 deletions
diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.cs
index 1f526ff1c..cd098739f 100644
--- a/Emby.Server.Implementations/Library/LibraryManager.cs
+++ b/Emby.Server.Implementations/Library/LibraryManager.cs
@@ -143,6 +143,7 @@ namespace Emby.Server.Implementations.Library
public bool IsScanRunning { get; private set; }
private IServerApplicationHost _appHost;
+ private IMediaEncoder _mediaEncoder;
/// <summary>
/// The _library items cache
@@ -176,7 +177,8 @@ namespace Emby.Server.Implementations.Library
Func<ILibraryMonitor> libraryMonitorFactory,
IFileSystem fileSystem,
Func<IProviderManager> providerManagerFactory,
- Func<IUserViewManager> userviewManager)
+ Func<IUserViewManager> userviewManager,
+ IMediaEncoder mediaEncoder)
{
_appHost = appHost;
_logger = loggerFactory.CreateLogger(nameof(LibraryManager));
@@ -188,6 +190,7 @@ namespace Emby.Server.Implementations.Library
_fileSystem = fileSystem;
_providerManagerFactory = providerManagerFactory;
_userviewManager = userviewManager;
+ _mediaEncoder = mediaEncoder;
_libraryItemsCache = new ConcurrentDictionary<Guid, BaseItem>();
@@ -2416,26 +2419,22 @@ namespace Emby.Server.Implementations.Library
if (libraryOptions.EnableEmbeddedEpisodeInfos && string.Equals(episodeInfo.Container, "mp4", StringComparison.OrdinalIgnoreCase))
{
// Read from metadata
- IMediaEncoder mediaEncoder = _appHost.Resolve<IMediaEncoder>();
- var task = mediaEncoder.GetMediaInfo(new MediaInfoRequest
+ var mediaInfo = _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;
- }
+ }, CancellationToken.None).GetAwaiter().GetResult();
+ if (mediaInfo.ParentIndexNumber > 0) {
+ episodeInfo.SeasonNumber = mediaInfo.ParentIndexNumber;
+ }
- if (task.Result.IndexNumber > 0) {
- episodeInfo.EpisodeNumber = task.Result.IndexNumber;
- }
+ if (mediaInfo.IndexNumber > 0) {
+ episodeInfo.EpisodeNumber = mediaInfo.IndexNumber;
+ }
- if (!string.IsNullOrEmpty(task.Result.ShowName)) {
- episodeInfo.SeriesName = task.Result.ShowName;
- }
+ if (!string.IsNullOrEmpty(mediaInfo.ShowName)) {
+ episodeInfo.SeriesName = mediaInfo.ShowName;
}
}
}