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

This commit is contained in:
Luke Pulverenti 2017-12-03 17:12:46 -05:00
parent c4ceeae889
commit 70b0dd968f
6 changed files with 108 additions and 73 deletions

View File

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

View File

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

View File

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

View File

@ -153,7 +153,6 @@ namespace MediaBrowser.Providers.MediaInfo
if (item.IsShortcut) if (item.IsShortcut)
{ {
FetchShortcutInfo(item); 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); var prober = new FFProbeVideoInfo(_logger, _isoManager, _mediaEncoder, _itemRepo, _blurayExaminer, _localization, _appPaths, _json, _encodingManager, _fileSystem, _config, _subtitleManager, _chapterManager, _libraryManager);

View File

@ -75,49 +75,54 @@ namespace MediaBrowser.Providers.MediaInfo
try 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)) if (item.VideoType == VideoType.Iso)
{
streamFileNames = FetchFromDvdLib(item, isoMount);
if (streamFileNames.Length == 0)
{ {
_logger.Error("No playable vobs found in dvd structure, skipping ffprobe."); item.IsoType = DetermineIsoType(isoMount);
return ItemUpdateType.MetadataImport;
} }
}
else if (item.VideoType == VideoType.BluRay || (item.IsoType.HasValue && item.IsoType == IsoType.BluRay)) if (item.VideoType == VideoType.Dvd || (item.IsoType.HasValue && item.IsoType == IsoType.Dvd))
{
var inputPath = isoMount != null ? isoMount.MountedPath : item.Path;
blurayDiscInfo = GetBDInfo(inputPath);
streamFileNames = blurayDiscInfo.Files;
if (streamFileNames.Length == 0)
{ {
_logger.Error("No playable vobs found in bluray structure, skipping ffprobe."); streamFileNames = FetchFromDvdLib(item, isoMount);
return ItemUpdateType.MetadataImport;
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;
blurayDiscInfo = GetBDInfo(inputPath);
streamFileNames = blurayDiscInfo.Files;
if (streamFileNames.Length == 0)
{
_logger.Error("No playable vobs found in bluray structure, skipping ffprobe.");
return ItemUpdateType.MetadataImport;
}
}
if (streamFileNames == null)
{
streamFileNames = new string[] { };
}
mediaInfoResult = await GetMediaInfo(item, isoMount, streamFileNames, cancellationToken).ConfigureAwait(false);
cancellationToken.ThrowIfCancellationRequested();
} }
if (streamFileNames == null) await Fetch(item, cancellationToken, mediaInfoResult, isoMount, blurayDiscInfo, options).ConfigureAwait(false);
{
streamFileNames = new string[] { };
}
var result = await GetMediaInfo(item, isoMount, streamFileNames, cancellationToken).ConfigureAwait(false);
cancellationToken.ThrowIfCancellationRequested();
await Fetch(item, cancellationToken, result, isoMount, blurayDiscInfo, options).ConfigureAwait(false);
} }
finally finally
@ -162,43 +167,60 @@ namespace MediaBrowser.Providers.MediaInfo
BlurayDiscInfo blurayInfo, BlurayDiscInfo blurayInfo,
MetadataRefreshOptions options) MetadataRefreshOptions options)
{ {
var mediaStreams = mediaInfo.MediaStreams; List<MediaStream> mediaStreams;
List<ChapterInfo> chapters;
video.TotalBitrate = mediaInfo.Bitrate; if (mediaInfo != null)
//video.FormatName = (mediaInfo.Container ?? string.Empty)
// .Replace("matroska", "mkv", StringComparison.OrdinalIgnoreCase);
// 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 (needToSetRuntime)
{ {
video.RunTimeTicks = mediaInfo.RunTimeTicks; mediaStreams = mediaInfo.MediaStreams;
}
if (video.VideoType == VideoType.VideoFile) video.TotalBitrate = mediaInfo.Bitrate;
{ //video.FormatName = (mediaInfo.Container ?? string.Empty)
var extension = (Path.GetExtension(video.Path) ?? string.Empty).TrimStart('.'); // .Replace("matroska", "mkv", StringComparison.OrdinalIgnoreCase);
video.Container = extension; // 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 (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;
chapters = mediaInfo.Chapters == null ? new List<ChapterInfo>() : mediaInfo.Chapters.ToList();
if (blurayInfo != null)
{
FetchBdInfo(video, chapters, mediaStreams, blurayInfo);
}
} }
else else
{ {
video.Container = null; mediaStreams = new List<MediaStream>();
} chapters = new List<ChapterInfo>();
video.Container = mediaInfo.Container;
var chapters = mediaInfo.Chapters == null ? new List<ChapterInfo>() : mediaInfo.Chapters.ToList();
if (blurayInfo != null)
{
FetchBdInfo(video, chapters, mediaStreams, blurayInfo);
} }
await AddExternalSubtitles(video, mediaStreams, options, cancellationToken).ConfigureAwait(false); await AddExternalSubtitles(video, mediaStreams, options, cancellationToken).ConfigureAwait(false);
var libraryOptions = _libraryManager.GetLibraryOptions(video); var libraryOptions = _libraryManager.GetLibraryOptions(video);
FetchEmbeddedInfo(video, mediaInfo, options, libraryOptions); if (mediaInfo != null)
FetchPeople(video, mediaInfo, options); {
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); 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.DefaultVideoStreamIndex = videoStream == null ? (int?)null : videoStream.Index;
video.HasSubtitles = mediaStreams.Any(i => i.Type == MediaStreamType.Subtitle); 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); _itemRepo.SaveMediaStreams(video.Id, mediaStreams, cancellationToken);

View File

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