From edfae37331ff07934b1608effe0f8019c8a2d79b Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 26 Aug 2017 02:18:52 -0400 Subject: [PATCH 1/4] fixes #2335 - Raw image not showing in webbrowser --- Emby.Drawing/ImageProcessor.cs | 78 ++++++++++++++++++- .../ApplicationHost.cs | 2 +- .../MediaEncoding/IMediaEncoder.cs | 2 + 3 files changed, 78 insertions(+), 4 deletions(-) diff --git a/Emby.Drawing/ImageProcessor.cs b/Emby.Drawing/ImageProcessor.cs index 63fa5f1f5e..8f3042e2ad 100644 --- a/Emby.Drawing/ImageProcessor.cs +++ b/Emby.Drawing/ImageProcessor.cs @@ -18,6 +18,7 @@ using System.Threading.Tasks; using MediaBrowser.Model.IO; using Emby.Drawing.Common; using MediaBrowser.Controller.Library; +using MediaBrowser.Controller.MediaEncoding; using MediaBrowser.Model.Net; using MediaBrowser.Model.Threading; using MediaBrowser.Model.Extensions; @@ -56,22 +57,24 @@ namespace Emby.Drawing private readonly IServerApplicationPaths _appPaths; private IImageEncoder _imageEncoder; private readonly Func _libraryManager; + private readonly Func _mediaEncoder; public ImageProcessor(ILogger logger, IServerApplicationPaths appPaths, IFileSystem fileSystem, IJsonSerializer jsonSerializer, IImageEncoder imageEncoder, - Func libraryManager, ITimerFactory timerFactory) + Func libraryManager, ITimerFactory timerFactory, Func mediaEncoder) { _logger = logger; _fileSystem = fileSystem; _jsonSerializer = jsonSerializer; _imageEncoder = imageEncoder; _libraryManager = libraryManager; + _mediaEncoder = mediaEncoder; _appPaths = appPaths; - ImageEnhancers = new IImageEnhancer[] {}; + ImageEnhancers = new IImageEnhancer[] { }; _saveImageSizeTimer = timerFactory.Create(SaveImageSizeCallback, null, Timeout.Infinite, Timeout.Infinite); ImageHelper.ImageProcessor = this; @@ -120,7 +123,36 @@ namespace Emby.Drawing { get { - return _imageEncoder.SupportedInputFormats; + return new string[] + { + "tiff", + "jpeg", + "jpg", + "png", + "aiff", + "cr2", + "crw", + "dng", + + // Remove until supported + //"nef", + "orf", + "pef", + "arw", + "webp", + "gif", + "bmp", + "erf", + "raf", + "rw2", + "nrw", + "dng", + "ico", + "astc", + "ktx", + "pkm", + "wbmp" + }; } } @@ -203,6 +235,10 @@ namespace Emby.Drawing return new Tuple(originalImagePath, MimeTypes.GetMimeType(originalImagePath), dateModified); } + var supportedImageInfo = await GetSupportedImage(originalImagePath, dateModified).ConfigureAwait(false); + originalImagePath = supportedImageInfo.Item1; + dateModified = supportedImageInfo.Item2; + if (options.Enhancers.Count > 0) { if (item == null) @@ -663,6 +699,42 @@ namespace Emby.Drawing return string.Join("|", cacheKeys.ToArray(cacheKeys.Count)).GetMD5().ToString("N"); } + private async Task> GetSupportedImage(string originalImagePath, DateTime dateModified) + { + var inputFormat = (Path.GetExtension(originalImagePath) ?? string.Empty) + .TrimStart('.') + .Replace("jpeg", "jpg", StringComparison.OrdinalIgnoreCase); + + if (!_imageEncoder.SupportedInputFormats.Contains(inputFormat, StringComparer.OrdinalIgnoreCase)) + { + try + { + var filename = (originalImagePath + dateModified.Ticks.ToString(UsCulture)).GetMD5().ToString("N"); + + var outputPath = Path.Combine(_appPaths.ImageCachePath, "converted-images", filename + ".webp"); + + var file = _fileSystem.GetFileInfo(outputPath); + if (!file.Exists) + { + await _mediaEncoder().ConvertImage(originalImagePath, outputPath).ConfigureAwait(false); + dateModified = _fileSystem.GetLastWriteTimeUtc(outputPath); + } + else + { + dateModified = file.LastWriteTimeUtc; + } + + originalImagePath = outputPath; + } + catch (Exception ex) + { + _logger.ErrorException("Image conversion failed for {0}", ex, originalImagePath); + } + } + + return new Tuple(originalImagePath, dateModified); + } + /// /// Gets the enhanced image. /// diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs index 6441fe4f2d..aaca22fe9b 100644 --- a/Emby.Server.Implementations/ApplicationHost.cs +++ b/Emby.Server.Implementations/ApplicationHost.cs @@ -1202,7 +1202,7 @@ namespace Emby.Server.Implementations private IImageProcessor GetImageProcessor() { - return new ImageProcessor(LogManager.GetLogger("ImageProcessor"), ServerConfigurationManager.ApplicationPaths, FileSystemManager, JsonSerializer, ImageEncoder, () => LibraryManager, TimerFactory); + return new ImageProcessor(LogManager.GetLogger("ImageProcessor"), ServerConfigurationManager.ApplicationPaths, FileSystemManager, JsonSerializer, ImageEncoder, () => LibraryManager, TimerFactory, () => MediaEncoder); } protected virtual FFMpegInstallInfo GetFfmpegInstallInfo() diff --git a/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs b/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs index 05bb35771e..803b189d4c 100644 --- a/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs +++ b/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs @@ -102,6 +102,8 @@ namespace MediaBrowser.Controller.MediaEncoding IProgress progress, CancellationToken cancellationToken); + Task ConvertImage(string inputPath, string outputPath); + /// /// Escapes the subtitle filter path. /// From 6bc2a79792ec4ca91cc1104c3d9a8d1b6b4bdd53 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 26 Aug 2017 03:03:19 -0400 Subject: [PATCH 2/4] fix folder rip probe --- Emby.Dlna/Profiles/PanasonicVieraProfile.cs | 175 ++++++++++++++---- .../ApplicationHost.cs | 8 +- .../Data/SqliteItemRepository.cs | 2 +- .../Data/SqliteUserDataRepository.cs | 2 +- .../Emby.Server.Implementations.csproj | 5 +- Emby.Server.Implementations/packages.config | 2 +- .../Entities/Audio/Audio.cs | 2 +- .../Entities/Audio/MusicAlbum.cs | 2 +- MediaBrowser.Controller/Entities/BaseItem.cs | 2 + MediaBrowser.Controller/Entities/Video.cs | 52 ++---- .../MediaEncoding/IMediaEncoder.cs | 5 + MediaBrowser.Model/Sync/SyncDataRequest.cs | 5 +- .../MediaInfo/FFProbeVideoInfo.cs | 86 +-------- Nuget/MediaBrowser.Common.nuspec | 2 +- Nuget/MediaBrowser.Server.Core.nuspec | 4 +- 15 files changed, 177 insertions(+), 177 deletions(-) diff --git a/Emby.Dlna/Profiles/PanasonicVieraProfile.cs b/Emby.Dlna/Profiles/PanasonicVieraProfile.cs index 095788485b..eb9cf95287 100644 --- a/Emby.Dlna/Profiles/PanasonicVieraProfile.cs +++ b/Emby.Dlna/Profiles/PanasonicVieraProfile.cs @@ -16,20 +16,121 @@ namespace Emby.Dlna.Profiles Manufacturer = "Panasonic", Headers = new[] - { - new HttpHeaderInfo - { - Name = "User-Agent", - Value = "Panasonic MIL DLNA", - Match = HeaderMatchType.Substring - } - } + { + new HttpHeaderInfo + { + Name = "User-Agent", + Value = "Panasonic MIL DLNA", + Match = HeaderMatchType.Substring + } + } }; AddXmlRootAttribute("xmlns:pv", "http://www.pv.com/pvns/"); TimelineOffsetSeconds = 10; + TranscodingProfiles = new[] + { + new TranscodingProfile + { + Container = "mp3", + AudioCodec = "mp3", + Type = DlnaProfileType.Audio + }, + new TranscodingProfile + { + Container = "ts", + AudioCodec = "ac3", + VideoCodec = "h264", + Type = DlnaProfileType.Video + }, + new TranscodingProfile + { + Container = "jpeg", + Type = DlnaProfileType.Photo + } + }; + + DirectPlayProfiles = new[] + { + new DirectPlayProfile + { + Container = "mpeg,mpg", + VideoCodec = "mpeg2video,mpeg4", + AudioCodec = "ac3,mp3,pcm_dvd", + Type = DlnaProfileType.Video + }, + + new DirectPlayProfile + { + Container = "mkv", + VideoCodec = "h264,mpeg2video", + AudioCodec = "aac,ac3,dca,mp3,mp2,pcm,dts", + Type = DlnaProfileType.Video + }, + + new DirectPlayProfile + { + Container = "ts", + VideoCodec = "h264,mpeg2video", + AudioCodec = "aac,mp3,mp2", + Type = DlnaProfileType.Video + }, + + new DirectPlayProfile + { + Container = "mp4,m4v", + VideoCodec = "h264", + AudioCodec = "aac,ac3,mp3,pcm", + Type = DlnaProfileType.Video + }, + + new DirectPlayProfile + { + Container = "mov", + VideoCodec = "h264", + AudioCodec = "aac,pcm", + Type = DlnaProfileType.Video + }, + + new DirectPlayProfile + { + Container = "avi", + VideoCodec = "mpeg4", + AudioCodec = "pcm", + Type = DlnaProfileType.Video + }, + + new DirectPlayProfile + { + Container = "flv", + VideoCodec = "h264", + AudioCodec = "aac", + Type = DlnaProfileType.Video + }, + + new DirectPlayProfile + { + Container = "mp3", + AudioCodec = "mp3", + Type = DlnaProfileType.Audio + }, + + new DirectPlayProfile + { + Container = "mp4", + AudioCodec = "aac", + Type = DlnaProfileType.Audio + }, + + new DirectPlayProfile + { + Container = "jpeg", + Type = DlnaProfileType.Photo + } + }; + ContainerProfiles = new[] { new ContainerProfile @@ -55,35 +156,35 @@ namespace Emby.Dlna.Profiles }; CodecProfiles = new[] - { - new CodecProfile - { - Type = CodecType.Video, + { + new CodecProfile + { + Type = CodecType.Video, - Conditions = new[] - { - new ProfileCondition - { - Condition = ProfileConditionType.LessThanEqual, - Property = ProfileConditionValue.Width, - Value = "1920" - }, - new ProfileCondition - { - Condition = ProfileConditionType.LessThanEqual, - Property = ProfileConditionValue.Height, - Value = "1080" - }, - new ProfileCondition - { - Condition = ProfileConditionType.LessThanEqual, - Property = ProfileConditionValue.VideoBitDepth, - Value = "8", - IsRequired = false - } - } - } - }; + Conditions = new[] + { + new ProfileCondition + { + Condition = ProfileConditionType.LessThanEqual, + Property = ProfileConditionValue.Width, + Value = "1920" + }, + new ProfileCondition + { + Condition = ProfileConditionType.LessThanEqual, + Property = ProfileConditionValue.Height, + Value = "1080" + }, + new ProfileCondition + { + Condition = ProfileConditionType.LessThanEqual, + Property = ProfileConditionValue.VideoBitDepth, + Value = "8", + IsRequired = false + } + } + } + }; SubtitleProfiles = new[] { @@ -117,4 +218,4 @@ namespace Emby.Dlna.Profiles }; } } -} +} \ No newline at end of file diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs index aaca22fe9b..88dd47538a 100644 --- a/Emby.Server.Implementations/ApplicationHost.cs +++ b/Emby.Server.Implementations/ApplicationHost.cs @@ -227,6 +227,8 @@ namespace Emby.Server.Implementations protected IEnvironmentInfo EnvironmentInfo { get; set; } + private IBlurayExaminer BlurayExaminer { get; set; } + public PackageVersionClass SystemUpdateLevel { get @@ -884,7 +886,8 @@ namespace Emby.Server.Implementations ITextEncoding textEncoding = new TextEncoding.TextEncoding(FileSystemManager, LogManager.GetLogger("TextEncoding"), JsonSerializer); RegisterSingleInstance(textEncoding); Utilities.EncodingHelper = textEncoding; - RegisterSingleInstance(() => new BdInfoExaminer(FileSystemManager, textEncoding)); + BlurayExaminer = new BdInfoExaminer(FileSystemManager, textEncoding); + RegisterSingleInstance(BlurayExaminer); RegisterSingleInstance(new XmlReaderSettingsFactory()); @@ -1335,7 +1338,8 @@ namespace Emby.Server.Implementations ProcessFactory, (Environment.ProcessorCount > 2 ? 14000 : 40000), EnvironmentInfo.OperatingSystem == MediaBrowser.Model.System.OperatingSystem.Windows, - EnvironmentInfo); + EnvironmentInfo, + BlurayExaminer); MediaEncoder = mediaEncoder; RegisterSingleInstance(MediaEncoder); diff --git a/Emby.Server.Implementations/Data/SqliteItemRepository.cs b/Emby.Server.Implementations/Data/SqliteItemRepository.cs index 423ad2782b..ff1d217e55 100644 --- a/Emby.Server.Implementations/Data/SqliteItemRepository.cs +++ b/Emby.Server.Implementations/Data/SqliteItemRepository.cs @@ -114,7 +114,7 @@ namespace Emby.Server.Implementations.Data { get { - return false; + return true; } } diff --git a/Emby.Server.Implementations/Data/SqliteUserDataRepository.cs b/Emby.Server.Implementations/Data/SqliteUserDataRepository.cs index b76555bde5..bf6388f5d8 100644 --- a/Emby.Server.Implementations/Data/SqliteUserDataRepository.cs +++ b/Emby.Server.Implementations/Data/SqliteUserDataRepository.cs @@ -95,7 +95,7 @@ namespace Emby.Server.Implementations.Data { get { - return false; + return true; } } diff --git a/Emby.Server.Implementations/Emby.Server.Implementations.csproj b/Emby.Server.Implementations/Emby.Server.Implementations.csproj index 1dbb10b488..84ec214c9b 100644 --- a/Emby.Server.Implementations/Emby.Server.Implementations.csproj +++ b/Emby.Server.Implementations/Emby.Server.Implementations.csproj @@ -661,8 +661,9 @@ ..\packages\Emby.XmlTv.1.0.10\lib\portable-net45+netstandard2.0+win8\Emby.XmlTv.dll - - ..\packages\MediaBrowser.Naming.1.0.6\lib\portable-net45+netstandard2.0+win8\MediaBrowser.Naming.dll + + ..\packages\MediaBrowser.Naming.1.0.7\lib\portable-net45+netstandard2.0+win8\MediaBrowser.Naming.dll + True ..\packages\ServiceStack.Text.4.5.8\lib\net45\ServiceStack.Text.dll diff --git a/Emby.Server.Implementations/packages.config b/Emby.Server.Implementations/packages.config index 8d4d249950..5b869221ae 100644 --- a/Emby.Server.Implementations/packages.config +++ b/Emby.Server.Implementations/packages.config @@ -1,7 +1,7 @@  - + diff --git a/MediaBrowser.Controller/Entities/Audio/Audio.cs b/MediaBrowser.Controller/Entities/Audio/Audio.cs index e029a447eb..3ebf4da009 100644 --- a/MediaBrowser.Controller/Entities/Audio/Audio.cs +++ b/MediaBrowser.Controller/Entities/Audio/Audio.cs @@ -110,7 +110,7 @@ namespace MediaBrowser.Controller.Entities.Audio list[index] = artist; index++; } - foreach (var artist in AlbumArtists) + foreach (var artist in Artists) { list[index] = artist; index++; diff --git a/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs b/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs index 82f880b3f5..7af8161cab 100644 --- a/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs +++ b/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs @@ -96,7 +96,7 @@ namespace MediaBrowser.Controller.Entities.Audio list[index] = artist; index++; } - foreach (var artist in AlbumArtists) + foreach (var artist in Artists) { list[index] = artist; index++; diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index 24fa80ef6e..51dc59c19e 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -25,6 +25,7 @@ using System.Threading.Tasks; using MediaBrowser.Controller.Dto; using MediaBrowser.Controller.Extensions; using MediaBrowser.Controller.IO; +using MediaBrowser.Controller.MediaEncoding; using MediaBrowser.Controller.Sorting; using MediaBrowser.Model.Extensions; using MediaBrowser.Model.Globalization; @@ -536,6 +537,7 @@ namespace MediaBrowser.Controller.Entities public static ICollectionManager CollectionManager { get; set; } public static IImageProcessor ImageProcessor { get; set; } public static IMediaSourceManager MediaSourceManager { get; set; } + public static IMediaEncoder MediaEncoder { get; set; } /// /// Returns a that represents this instance. diff --git a/MediaBrowser.Controller/Entities/Video.cs b/MediaBrowser.Controller/Entities/Video.cs index 3918ac8fc1..887da46ccf 100644 --- a/MediaBrowser.Controller/Entities/Video.cs +++ b/MediaBrowser.Controller/Entities/Video.cs @@ -149,18 +149,20 @@ namespace MediaBrowser.Controller.Entities /// The video3 D format. public Video3DFormat? Video3DFormat { get; set; } - /// - /// Gets the playable stream files. - /// - /// List{System.String}. - public string[] GetPlayableStreamFiles() - { - return GetPlayableStreamFiles(Path); - } - public string[] GetPlayableStreamFileNames() { - return GetPlayableStreamFiles().Select(System.IO.Path.GetFileName).ToArray(); + var videoType = VideoType; + + if (videoType == VideoType.Iso && IsoType == Model.Entities.IsoType.BluRay) + { + videoType = VideoType.BluRay; + } + else if (videoType == VideoType.Iso && IsoType == Model.Entities.IsoType.Dvd) + { + videoType = VideoType.Dvd; + } + + return MediaEncoder.GetPlayableStreamFileNames(Path, videoType); } /// @@ -413,36 +415,6 @@ namespace MediaBrowser.Controller.Entities return base.IsValidFromResolver(newItem); } - /// - /// Gets the playable stream files. - /// - /// The root path. - /// List{System.String}. - public string[] GetPlayableStreamFiles(string rootPath) - { - if (VideoType == VideoType.VideoFile) - { - return new string[] { }; - } - - var allFiles = FileSystem.GetFilePaths(rootPath, true).ToList(); - - var videoType = VideoType; - - if (videoType == VideoType.Iso && IsoType == Model.Entities.IsoType.BluRay) - { - videoType = VideoType.BluRay; - } - else if (videoType == VideoType.Iso && IsoType == Model.Entities.IsoType.Dvd) - { - videoType = VideoType.Dvd; - } - - return QueryPlayableStreamFiles(rootPath, videoType).Select(name => allFiles.FirstOrDefault(f => string.Equals(System.IO.Path.GetFileName(f), name, StringComparison.OrdinalIgnoreCase))) - .Where(f => !string.IsNullOrEmpty(f)) - .ToArray(); - } - public static string[] QueryPlayableStreamFiles(string rootPath, VideoType videoType) { if (videoType == VideoType.Dvd) diff --git a/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs b/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs index 803b189d4c..31cd96c9a6 100644 --- a/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs +++ b/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs @@ -1,9 +1,11 @@ using MediaBrowser.Model.Entities; using MediaBrowser.Model.MediaInfo; using System; +using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using MediaBrowser.Model.Dlna; +using MediaBrowser.Model.IO; namespace MediaBrowser.Controller.MediaEncoding { @@ -118,5 +120,8 @@ namespace MediaBrowser.Controller.MediaEncoding void SetLogFilename(string name); void ClearLogFilename(); + + string[] GetPlayableStreamFileNames(string path, VideoType videoType); + IEnumerable GetPrimaryPlaylistVobFiles(string path, IIsoMount isoMount, uint? titleNumber); } } diff --git a/MediaBrowser.Model/Sync/SyncDataRequest.cs b/MediaBrowser.Model/Sync/SyncDataRequest.cs index c0941caee5..79d1842e19 100644 --- a/MediaBrowser.Model/Sync/SyncDataRequest.cs +++ b/MediaBrowser.Model/Sync/SyncDataRequest.cs @@ -1,11 +1,9 @@ -using System.Collections.Generic; - + namespace MediaBrowser.Model.Sync { public class SyncDataRequest { public string[] LocalItemIds { get; set; } - public string[] OfflineUserIds { get; set; } public string[] SyncJobItemIds { get; set; } public string TargetId { get; set; } @@ -13,7 +11,6 @@ namespace MediaBrowser.Model.Sync public SyncDataRequest() { LocalItemIds = new string[] { }; - OfflineUserIds = new string[] { }; } } } diff --git a/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs b/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs index ea8d7bdb0b..76cd02cef7 100644 --- a/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs +++ b/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs @@ -25,9 +25,6 @@ using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; - -using MediaBrowser.Controller.IO; -using MediaBrowser.Model.IO; using MediaBrowser.Model.Globalization; namespace MediaBrowser.Providers.MediaInfo @@ -49,8 +46,6 @@ namespace MediaBrowser.Providers.MediaInfo private readonly IChapterManager _chapterManager; private readonly ILibraryManager _libraryManager; - private readonly CultureInfo _usCulture = new CultureInfo("en-US"); - public FFProbeVideoInfo(ILogger logger, IIsoManager isoManager, IMediaEncoder mediaEncoder, IItemRepository itemRepo, IBlurayExaminer blurayExaminer, ILocalizationManager localization, IApplicationPaths appPaths, IJsonSerializer json, IEncodingManager encodingManager, IFileSystem fileSystem, IServerConfigurationManager config, ISubtitleManager subtitleManager, IChapterManager chapterManager, ILibraryManager libraryManager) { _logger = logger; @@ -565,8 +560,8 @@ namespace MediaBrowser.Providers.MediaInfo titleNumber = primaryTitle.VideoTitleSetNumber; item.RunTimeTicks = GetRuntime(primaryTitle); } - - return GetPrimaryPlaylistVobFiles(item, mount, titleNumber) + + return _mediaEncoder.GetPrimaryPlaylistVobFiles(item.Path, mount, titleNumber) .Select(Path.GetFileName) .ToArray(); } @@ -616,82 +611,5 @@ namespace MediaBrowser.Providers.MediaInfo return null; } - - private IEnumerable GetPrimaryPlaylistVobFiles(Video video, IIsoMount isoMount, uint? titleNumber) - { - // min size 300 mb - const long minPlayableSize = 314572800; - - var root = isoMount != null ? isoMount.MountedPath : video.Path; - - // Try to eliminate menus and intros by skipping all files at the front of the list that are less than the minimum size - // Once we reach a file that is at least the minimum, return all subsequent ones - var allVobs = _fileSystem.GetFiles(root, new[] { ".vob" }, false, true) - .OrderBy(i => i.FullName) - .ToList(); - - // If we didn't find any satisfying the min length, just take them all - if (allVobs.Count == 0) - { - _logger.Error("No vobs found in dvd structure."); - return new List(); - } - - if (titleNumber.HasValue) - { - var prefix = string.Format("VTS_0{0}_", titleNumber.Value.ToString(_usCulture)); - var vobs = allVobs.Where(i => i.Name.StartsWith(prefix, StringComparison.OrdinalIgnoreCase)).ToList(); - - if (vobs.Count > 0) - { - var minSizeVobs = vobs - .SkipWhile(f => f.Length < minPlayableSize) - .ToList(); - - return minSizeVobs.Count == 0 ? vobs.Select(i => i.FullName) : minSizeVobs.Select(i => i.FullName); - } - - _logger.Info("Could not determine vob file list for {0} using DvdLib. Will scan using file sizes.", video.Path); - } - - var files = allVobs - .SkipWhile(f => f.Length < minPlayableSize) - .ToList(); - - // If we didn't find any satisfying the min length, just take them all - if (files.Count == 0) - { - _logger.Warn("Vob size filter resulted in zero matches. Taking all vobs."); - files = allVobs; - } - - // Assuming they're named "vts_05_01", take all files whose second part matches that of the first file - if (files.Count > 0) - { - var parts = _fileSystem.GetFileNameWithoutExtension(files[0]).Split('_'); - - if (parts.Length == 3) - { - var title = parts[1]; - - files = files.TakeWhile(f => - { - var fileParts = _fileSystem.GetFileNameWithoutExtension(f).Split('_'); - - return fileParts.Length == 3 && string.Equals(title, fileParts[1], StringComparison.OrdinalIgnoreCase); - - }).ToList(); - - // If this resulted in not getting any vobs, just take them all - if (files.Count == 0) - { - _logger.Warn("Vob filename filter resulted in zero matches. Taking all vobs."); - files = allVobs; - } - } - } - - return files.Select(i => i.FullName); - } } } \ No newline at end of file diff --git a/Nuget/MediaBrowser.Common.nuspec b/Nuget/MediaBrowser.Common.nuspec index 4044eaea1e..3aa3d54036 100644 --- a/Nuget/MediaBrowser.Common.nuspec +++ b/Nuget/MediaBrowser.Common.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common - 3.0.741 + 3.0.744 Emby.Common Emby Team ebr,Luke,scottisafool diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspec index 6f43586cdb..ea30175e63 100644 --- a/Nuget/MediaBrowser.Server.Core.nuspec +++ b/Nuget/MediaBrowser.Server.Core.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Server.Core - 3.0.741 + 3.0.744 Emby.Server.Core Emby Team ebr,Luke,scottisafool @@ -12,7 +12,7 @@ Contains core components required to build plugins for Emby Server. Copyright © Emby 2013 - + From a272625566892e7a733b3e35b6f9705198051157 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 26 Aug 2017 03:03:33 -0400 Subject: [PATCH 3/4] update tvdb cache length --- MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs b/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs index d447aff99c..af18f5f0be 100644 --- a/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs +++ b/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs @@ -438,25 +438,25 @@ namespace MediaBrowser.Providers.TV var seriesXmlFilename = preferredMetadataLanguage + ".xml"; - const int cacheDays = 1; + const int cacheHours = 12; var seriesFile = files.FirstOrDefault(i => string.Equals(seriesXmlFilename, i.Name, StringComparison.OrdinalIgnoreCase)); // No need to check age if automatic updates are enabled - if (seriesFile == null || !seriesFile.Exists || (DateTime.UtcNow - _fileSystem.GetLastWriteTimeUtc(seriesFile)).TotalDays > cacheDays) + if (seriesFile == null || !seriesFile.Exists || (DateTime.UtcNow - _fileSystem.GetLastWriteTimeUtc(seriesFile)).TotalHours > cacheHours) { return false; } var actorsXml = files.FirstOrDefault(i => string.Equals("actors.xml", i.Name, StringComparison.OrdinalIgnoreCase)); // No need to check age if automatic updates are enabled - if (actorsXml == null || !actorsXml.Exists || (DateTime.UtcNow - _fileSystem.GetLastWriteTimeUtc(actorsXml)).TotalDays > cacheDays) + if (actorsXml == null || !actorsXml.Exists || (DateTime.UtcNow - _fileSystem.GetLastWriteTimeUtc(actorsXml)).TotalHours > cacheHours) { return false; } var bannersXml = files.FirstOrDefault(i => string.Equals("banners.xml", i.Name, StringComparison.OrdinalIgnoreCase)); // No need to check age if automatic updates are enabled - if (bannersXml == null || !bannersXml.Exists || (DateTime.UtcNow - _fileSystem.GetLastWriteTimeUtc(bannersXml)).TotalDays > cacheDays) + if (bannersXml == null || !bannersXml.Exists || (DateTime.UtcNow - _fileSystem.GetLastWriteTimeUtc(bannersXml)).TotalHours > cacheHours) { return false; } From 6147491a8a8f8b1e5c546d17d3f4875ac8d5b42e Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 26 Aug 2017 03:04:04 -0400 Subject: [PATCH 4/4] 3.2.28.6 --- SharedVersion.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SharedVersion.cs b/SharedVersion.cs index 339aca7854..7df5c83f0b 100644 --- a/SharedVersion.cs +++ b/SharedVersion.cs @@ -1,3 +1,3 @@ using System.Reflection; -[assembly: AssemblyVersion("3.2.28.5")] +[assembly: AssemblyVersion("3.2.28.6")]