The Free Software Media System - Server Backend & API
Improve support for embedded metadata; support external subtitles with strm files
Luke Pulverenti70b0dd968fc3
diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/BaseTunerHost.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/BaseTunerHost.csindex e0fd32aeef..45e96c36d8 100644--- a/Emby.Server.Implementations/LiveTv/TunerHosts/BaseTunerHost.cs+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/BaseTunerHost.cs@@ -39,6 +39,14 @@ namespace Emby.Server.Implementations.LiveTv.TunerHostsFileSystem = fileSystem;}+ public virtual bool IsSupported+ {+ get+ {+ return true;+ }+ }+protected abstract Task<List<ChannelInfo>> GetChannelsInternal(TunerHostInfo tuner, CancellationToken cancellationToken);public abstract string Type { get; }diff --git a/Emby.Server.Implementations/MediaEncoder/EncodingManager.cs b/Emby.Server.Implementations/MediaEncoder/EncodingManager.csindex 6e0e55bef4..d790f4ab8b 100644--- a/Emby.Server.Implementations/MediaEncoder/EncodingManager.cs+++ b/Emby.Server.Implementations/MediaEncoder/EncodingManager.cs@@ -76,6 +76,21 @@ namespace Emby.Server.Implementations.MediaEncoderreturn 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 imagediff --git a/MediaBrowser.Controller/LiveTv/ITunerHost.cs b/MediaBrowser.Controller/LiveTv/ITunerHost.csindex 242011db06..80c40f8bde 100644--- a/MediaBrowser.Controller/LiveTv/ITunerHost.cs+++ b/MediaBrowser.Controller/LiveTv/ITunerHost.cs@@ -46,6 +46,10 @@ namespace MediaBrowser.Controller.LiveTvTask<List<MediaSourceInfo>> GetChannelStreamMediaSources(string channelId, CancellationToken cancellationToken);Task<List<TunerHostInfo>> DiscoverDevices(int discoveryDurationMs, CancellationToken cancellationToken);+ bool IsSupported+ {+ get;+ }}public interface IConfigurableTunerHost{diff --git a/MediaBrowser.Providers/MediaInfo/FFProbeProvider.cs b/MediaBrowser.Providers/MediaInfo/FFProbeProvider.csindex e79aec33c1..6a2677b433 100644--- a/MediaBrowser.Providers/MediaInfo/FFProbeProvider.cs+++ b/MediaBrowser.Providers/MediaInfo/FFProbeProvider.cs@@ -153,7 +153,6 @@ namespace MediaBrowser.Providers.MediaInfoif (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);diff --git a/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs b/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.csindex 1582385571..443eb6eda4 100644--- a/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs+++ b/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs@@ -75,49 +75,54 @@ namespace MediaBrowser.Providers.MediaInfotry{- 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.MediaInfoBlurayDiscInfo 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.MediaInfovideo.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);diff --git a/MediaBrowser.Providers/Movies/GenericMovieDbInfo.cs b/MediaBrowser.Providers/Movies/GenericMovieDbInfo.csindex 65742f6e6e..a000ed36e4 100644--- a/MediaBrowser.Providers/Movies/GenericMovieDbInfo.cs+++ b/MediaBrowser.Providers/Movies/GenericMovieDbInfo.cs@@ -262,7 +262,7 @@ namespace MediaBrowser.Providers.Moviesvar keepTypes = new[]{PersonType.Director,- PersonType.Writer,+ //PersonType.Writer,//PersonType.Producer};