Просмотр исходного кода

Improve support for embedded metadata; support external subtitles with strm files

Luke Pulverenti 7 лет назад
Родитель
Сommit
70b0dd968f

+ 8 - 0
Emby.Server.Implementations/LiveTv/TunerHosts/BaseTunerHost.cs

@@ -39,6 +39,14 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
             FileSystem = fileSystem;
         }
 
+        public virtual bool IsSupported
+        {
+            get
+            {
+                return true;
+            }
+        }
+
         protected abstract Task<List<ChannelInfo>> GetChannelsInternal(TunerHostInfo tuner, CancellationToken cancellationToken);
         public abstract string Type { get; }
 

+ 15 - 10
Emby.Server.Implementations/MediaEncoder/EncodingManager.cs

@@ -76,6 +76,21 @@ namespace Emby.Server.Implementations.MediaEncoder
                 return false;
             }
 
+            if (video.VideoType == VideoType.Iso)
+            {
+                return false;
+            }
+
+            if (video.VideoType == VideoType.BluRay || video.VideoType == VideoType.Dvd)
+            {
+                return false;
+            }
+
+            if (video.IsShortcut)
+            {
+                return false;
+            }
+
             if (!video.IsCompleteMedia)
             {
                 return false;
@@ -118,16 +133,6 @@ namespace Emby.Server.Implementations.MediaEncoder
                 {
                     if (extractImages)
                     {
-                        if (video.VideoType == VideoType.Iso)
-                        {
-                            continue;
-                        }
-
-                        if (video.VideoType == VideoType.BluRay || video.VideoType == VideoType.Dvd)
-                        {
-                            continue;
-                        }
-
                         try
                         {
                             // Add some time for the first chapter to make sure we don't end up with a black image

+ 4 - 0
MediaBrowser.Controller/LiveTv/ITunerHost.cs

@@ -46,6 +46,10 @@ namespace MediaBrowser.Controller.LiveTv
         Task<List<MediaSourceInfo>> GetChannelStreamMediaSources(string channelId, CancellationToken cancellationToken);
 
         Task<List<TunerHostInfo>> DiscoverDevices(int discoveryDurationMs, CancellationToken cancellationToken);
+        bool IsSupported
+        {
+            get;
+        }
     }
     public interface IConfigurableTunerHost
     {

+ 0 - 1
MediaBrowser.Providers/MediaInfo/FFProbeProvider.cs

@@ -153,7 +153,6 @@ namespace MediaBrowser.Providers.MediaInfo
             if (item.IsShortcut)
             {
                 FetchShortcutInfo(item);
-                return Task.FromResult(ItemUpdateType.MetadataImport);
             }
 
             var prober = new FFProbeVideoInfo(_logger, _isoManager, _mediaEncoder, _itemRepo, _blurayExaminer, _localization, _appPaths, _json, _encodingManager, _fileSystem, _config, _subtitleManager, _chapterManager, _libraryManager);

+ 74 - 55
MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs

@@ -75,49 +75,54 @@ namespace MediaBrowser.Providers.MediaInfo
 
             try
             {
-                string[] streamFileNames = null;
+                Model.MediaInfo.MediaInfo mediaInfoResult = null;
 
-                if (item.VideoType == VideoType.Iso)
+                if (!item.IsShortcut)
                 {
-                    item.IsoType = DetermineIsoType(isoMount);
-                }
+                    string[] streamFileNames = null;
 
-                if (item.VideoType == VideoType.Dvd || (item.IsoType.HasValue && item.IsoType == IsoType.Dvd))
-                {
-                    streamFileNames = FetchFromDvdLib(item, isoMount);
+                    if (item.VideoType == VideoType.Iso)
+                    {
+                        item.IsoType = DetermineIsoType(isoMount);
+                    }
 
-                    if (streamFileNames.Length == 0)
+                    if (item.VideoType == VideoType.Dvd || (item.IsoType.HasValue && item.IsoType == IsoType.Dvd))
                     {
-                        _logger.Error("No playable vobs found in dvd structure, skipping ffprobe.");
-                        return ItemUpdateType.MetadataImport;
+                        streamFileNames = FetchFromDvdLib(item, isoMount);
+
+                        if (streamFileNames.Length == 0)
+                        {
+                            _logger.Error("No playable vobs found in dvd structure, skipping ffprobe.");
+                            return ItemUpdateType.MetadataImport;
+                        }
                     }
-                }
 
-                else if (item.VideoType == VideoType.BluRay || (item.IsoType.HasValue && item.IsoType == IsoType.BluRay))
-                {
-                    var inputPath = isoMount != null ? isoMount.MountedPath : item.Path;
+                    else if (item.VideoType == VideoType.BluRay || (item.IsoType.HasValue && item.IsoType == IsoType.BluRay))
+                    {
+                        var inputPath = isoMount != null ? isoMount.MountedPath : item.Path;
 
-                    blurayDiscInfo = GetBDInfo(inputPath);
+                        blurayDiscInfo = GetBDInfo(inputPath);
 
-                    streamFileNames = blurayDiscInfo.Files;
+                        streamFileNames = blurayDiscInfo.Files;
 
-                    if (streamFileNames.Length == 0)
-                    {
-                        _logger.Error("No playable vobs found in bluray structure, skipping ffprobe.");
-                        return ItemUpdateType.MetadataImport;
+                        if (streamFileNames.Length == 0)
+                        {
+                            _logger.Error("No playable vobs found in bluray structure, skipping ffprobe.");
+                            return ItemUpdateType.MetadataImport;
+                        }
                     }
-                }
 
-                if (streamFileNames == null)
-                {
-                    streamFileNames = new string[] { };
-                }
+                    if (streamFileNames == null)
+                    {
+                        streamFileNames = new string[] { };
+                    }
 
-                var result = await GetMediaInfo(item, isoMount, streamFileNames, cancellationToken).ConfigureAwait(false);
+                    mediaInfoResult = await GetMediaInfo(item, isoMount, streamFileNames, cancellationToken).ConfigureAwait(false);
 
-                cancellationToken.ThrowIfCancellationRequested();
+                    cancellationToken.ThrowIfCancellationRequested();
+                }
 
-                await Fetch(item, cancellationToken, result, isoMount, blurayDiscInfo, options).ConfigureAwait(false);
+                await Fetch(item, cancellationToken, mediaInfoResult, isoMount, blurayDiscInfo, options).ConfigureAwait(false);
 
             }
             finally
@@ -162,43 +167,60 @@ namespace MediaBrowser.Providers.MediaInfo
             BlurayDiscInfo blurayInfo,
             MetadataRefreshOptions options)
         {
-            var mediaStreams = mediaInfo.MediaStreams;
+            List<MediaStream> mediaStreams;
+            List<ChapterInfo> chapters;
 
-            video.TotalBitrate = mediaInfo.Bitrate;
-            //video.FormatName = (mediaInfo.Container ?? string.Empty)
-            //    .Replace("matroska", "mkv", StringComparison.OrdinalIgnoreCase);
+            if (mediaInfo != null)
+            {
+                mediaStreams = mediaInfo.MediaStreams;
 
-            // For dvd's this may not always be accurate, so don't set the runtime if the item already has one
-            var needToSetRuntime = video.VideoType != VideoType.Dvd || video.RunTimeTicks == null || video.RunTimeTicks.Value == 0;
+                video.TotalBitrate = mediaInfo.Bitrate;
+                //video.FormatName = (mediaInfo.Container ?? string.Empty)
+                //    .Replace("matroska", "mkv", StringComparison.OrdinalIgnoreCase);
 
-            if (needToSetRuntime)
-            {
-                video.RunTimeTicks = mediaInfo.RunTimeTicks;
-            }
+                // For dvd's this may not always be accurate, so don't set the runtime if the item already has one
+                var needToSetRuntime = video.VideoType != VideoType.Dvd || video.RunTimeTicks == null || video.RunTimeTicks.Value == 0;
 
-            if (video.VideoType == VideoType.VideoFile)
-            {
-                var extension = (Path.GetExtension(video.Path) ?? string.Empty).TrimStart('.');
+                if (needToSetRuntime)
+                {
+                    video.RunTimeTicks = mediaInfo.RunTimeTicks;
+                }
+
+                if (video.VideoType == VideoType.VideoFile)
+                {
+                    var extension = (Path.GetExtension(video.Path) ?? string.Empty).TrimStart('.');
+
+                    video.Container = extension;
+                }
+                else
+                {
+                    video.Container = null;
+                }
+                video.Container = mediaInfo.Container;
 
-                video.Container = extension;
+                chapters = mediaInfo.Chapters == null ? new List<ChapterInfo>() : mediaInfo.Chapters.ToList();
+                if (blurayInfo != null)
+                {
+                    FetchBdInfo(video, chapters, mediaStreams, blurayInfo);
+                }
             }
             else
             {
-                video.Container = null;
-            }
-            video.Container = mediaInfo.Container;
-
-            var chapters = mediaInfo.Chapters == null ? new List<ChapterInfo>() : mediaInfo.Chapters.ToList();
-            if (blurayInfo != null)
-            {
-                FetchBdInfo(video, chapters, mediaStreams, blurayInfo);
+                mediaStreams = new List<MediaStream>();
+                chapters = new List<ChapterInfo>();
             }
 
             await AddExternalSubtitles(video, mediaStreams, options, cancellationToken).ConfigureAwait(false);
+
             var libraryOptions = _libraryManager.GetLibraryOptions(video);
 
-            FetchEmbeddedInfo(video, mediaInfo, options, libraryOptions);
-            FetchPeople(video, mediaInfo, options);
+            if (mediaInfo != null)
+            {
+                FetchEmbeddedInfo(video, mediaInfo, options, libraryOptions);
+                FetchPeople(video, mediaInfo, options);
+                video.Timestamp = mediaInfo.Timestamp;
+                video.Video3DFormat = video.Video3DFormat ?? mediaInfo.Video3DFormat;
+            }
 
             video.IsHD = mediaStreams.Any(i => i.Type == MediaStreamType.Video && i.Width.HasValue && i.Width.Value >= 1260);
 
@@ -207,9 +229,6 @@ namespace MediaBrowser.Providers.MediaInfo
             video.DefaultVideoStreamIndex = videoStream == null ? (int?)null : videoStream.Index;
 
             video.HasSubtitles = mediaStreams.Any(i => i.Type == MediaStreamType.Subtitle);
-            video.Timestamp = mediaInfo.Timestamp;
-
-            video.Video3DFormat = video.Video3DFormat ?? mediaInfo.Video3DFormat;
 
             _itemRepo.SaveMediaStreams(video.Id, mediaStreams, cancellationToken);
 

+ 1 - 1
MediaBrowser.Providers/Movies/GenericMovieDbInfo.cs

@@ -262,7 +262,7 @@ namespace MediaBrowser.Providers.Movies
                 var keepTypes = new[]
                 {
                     PersonType.Director,
-                    PersonType.Writer,
+                    //PersonType.Writer,
                     //PersonType.Producer
                 };