Merge pull request #2843 from MediaBrowser/dev

Dev
This commit is contained in:
Luke 2017-08-26 03:05:17 -04:00 committed by GitHub
commit 83ee8cf3c1
18 changed files with 260 additions and 186 deletions

View File

@ -16,20 +16,121 @@ namespace Emby.Dlna.Profiles
Manufacturer = "Panasonic", Manufacturer = "Panasonic",
Headers = new[] Headers = new[]
{ {
new HttpHeaderInfo new HttpHeaderInfo
{ {
Name = "User-Agent", Name = "User-Agent",
Value = "Panasonic MIL DLNA", Value = "Panasonic MIL DLNA",
Match = HeaderMatchType.Substring Match = HeaderMatchType.Substring
} }
} }
}; };
AddXmlRootAttribute("xmlns:pv", "http://www.pv.com/pvns/"); AddXmlRootAttribute("xmlns:pv", "http://www.pv.com/pvns/");
TimelineOffsetSeconds = 10; 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[] ContainerProfiles = new[]
{ {
new ContainerProfile new ContainerProfile
@ -55,35 +156,35 @@ namespace Emby.Dlna.Profiles
}; };
CodecProfiles = new[] CodecProfiles = new[]
{ {
new CodecProfile new CodecProfile
{ {
Type = CodecType.Video, Type = CodecType.Video,
Conditions = new[] Conditions = new[]
{ {
new ProfileCondition new ProfileCondition
{ {
Condition = ProfileConditionType.LessThanEqual, Condition = ProfileConditionType.LessThanEqual,
Property = ProfileConditionValue.Width, Property = ProfileConditionValue.Width,
Value = "1920" Value = "1920"
}, },
new ProfileCondition new ProfileCondition
{ {
Condition = ProfileConditionType.LessThanEqual, Condition = ProfileConditionType.LessThanEqual,
Property = ProfileConditionValue.Height, Property = ProfileConditionValue.Height,
Value = "1080" Value = "1080"
}, },
new ProfileCondition new ProfileCondition
{ {
Condition = ProfileConditionType.LessThanEqual, Condition = ProfileConditionType.LessThanEqual,
Property = ProfileConditionValue.VideoBitDepth, Property = ProfileConditionValue.VideoBitDepth,
Value = "8", Value = "8",
IsRequired = false IsRequired = false
} }
} }
} }
}; };
SubtitleProfiles = new[] SubtitleProfiles = new[]
{ {

View File

@ -18,6 +18,7 @@ using System.Threading.Tasks;
using MediaBrowser.Model.IO; using MediaBrowser.Model.IO;
using Emby.Drawing.Common; using Emby.Drawing.Common;
using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.MediaEncoding;
using MediaBrowser.Model.Net; using MediaBrowser.Model.Net;
using MediaBrowser.Model.Threading; using MediaBrowser.Model.Threading;
using MediaBrowser.Model.Extensions; using MediaBrowser.Model.Extensions;
@ -56,22 +57,24 @@ namespace Emby.Drawing
private readonly IServerApplicationPaths _appPaths; private readonly IServerApplicationPaths _appPaths;
private IImageEncoder _imageEncoder; private IImageEncoder _imageEncoder;
private readonly Func<ILibraryManager> _libraryManager; private readonly Func<ILibraryManager> _libraryManager;
private readonly Func<IMediaEncoder> _mediaEncoder;
public ImageProcessor(ILogger logger, public ImageProcessor(ILogger logger,
IServerApplicationPaths appPaths, IServerApplicationPaths appPaths,
IFileSystem fileSystem, IFileSystem fileSystem,
IJsonSerializer jsonSerializer, IJsonSerializer jsonSerializer,
IImageEncoder imageEncoder, IImageEncoder imageEncoder,
Func<ILibraryManager> libraryManager, ITimerFactory timerFactory) Func<ILibraryManager> libraryManager, ITimerFactory timerFactory, Func<IMediaEncoder> mediaEncoder)
{ {
_logger = logger; _logger = logger;
_fileSystem = fileSystem; _fileSystem = fileSystem;
_jsonSerializer = jsonSerializer; _jsonSerializer = jsonSerializer;
_imageEncoder = imageEncoder; _imageEncoder = imageEncoder;
_libraryManager = libraryManager; _libraryManager = libraryManager;
_mediaEncoder = mediaEncoder;
_appPaths = appPaths; _appPaths = appPaths;
ImageEnhancers = new IImageEnhancer[] {}; ImageEnhancers = new IImageEnhancer[] { };
_saveImageSizeTimer = timerFactory.Create(SaveImageSizeCallback, null, Timeout.Infinite, Timeout.Infinite); _saveImageSizeTimer = timerFactory.Create(SaveImageSizeCallback, null, Timeout.Infinite, Timeout.Infinite);
ImageHelper.ImageProcessor = this; ImageHelper.ImageProcessor = this;
@ -120,7 +123,36 @@ namespace Emby.Drawing
{ {
get 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<string, string, DateTime>(originalImagePath, MimeTypes.GetMimeType(originalImagePath), dateModified); return new Tuple<string, string, DateTime>(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 (options.Enhancers.Count > 0)
{ {
if (item == null) if (item == null)
@ -663,6 +699,42 @@ namespace Emby.Drawing
return string.Join("|", cacheKeys.ToArray(cacheKeys.Count)).GetMD5().ToString("N"); return string.Join("|", cacheKeys.ToArray(cacheKeys.Count)).GetMD5().ToString("N");
} }
private async Task<Tuple<string, DateTime>> 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<string, DateTime>(originalImagePath, dateModified);
}
/// <summary> /// <summary>
/// Gets the enhanced image. /// Gets the enhanced image.
/// </summary> /// </summary>

View File

@ -227,6 +227,8 @@ namespace Emby.Server.Implementations
protected IEnvironmentInfo EnvironmentInfo { get; set; } protected IEnvironmentInfo EnvironmentInfo { get; set; }
private IBlurayExaminer BlurayExaminer { get; set; }
public PackageVersionClass SystemUpdateLevel public PackageVersionClass SystemUpdateLevel
{ {
get get
@ -884,7 +886,8 @@ namespace Emby.Server.Implementations
ITextEncoding textEncoding = new TextEncoding.TextEncoding(FileSystemManager, LogManager.GetLogger("TextEncoding"), JsonSerializer); ITextEncoding textEncoding = new TextEncoding.TextEncoding(FileSystemManager, LogManager.GetLogger("TextEncoding"), JsonSerializer);
RegisterSingleInstance(textEncoding); RegisterSingleInstance(textEncoding);
Utilities.EncodingHelper = textEncoding; Utilities.EncodingHelper = textEncoding;
RegisterSingleInstance<IBlurayExaminer>(() => new BdInfoExaminer(FileSystemManager, textEncoding)); BlurayExaminer = new BdInfoExaminer(FileSystemManager, textEncoding);
RegisterSingleInstance(BlurayExaminer);
RegisterSingleInstance<IXmlReaderSettingsFactory>(new XmlReaderSettingsFactory()); RegisterSingleInstance<IXmlReaderSettingsFactory>(new XmlReaderSettingsFactory());
@ -1202,7 +1205,7 @@ namespace Emby.Server.Implementations
private IImageProcessor GetImageProcessor() 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() protected virtual FFMpegInstallInfo GetFfmpegInstallInfo()
@ -1335,7 +1338,8 @@ namespace Emby.Server.Implementations
ProcessFactory, ProcessFactory,
(Environment.ProcessorCount > 2 ? 14000 : 40000), (Environment.ProcessorCount > 2 ? 14000 : 40000),
EnvironmentInfo.OperatingSystem == MediaBrowser.Model.System.OperatingSystem.Windows, EnvironmentInfo.OperatingSystem == MediaBrowser.Model.System.OperatingSystem.Windows,
EnvironmentInfo); EnvironmentInfo,
BlurayExaminer);
MediaEncoder = mediaEncoder; MediaEncoder = mediaEncoder;
RegisterSingleInstance(MediaEncoder); RegisterSingleInstance(MediaEncoder);

View File

@ -114,7 +114,7 @@ namespace Emby.Server.Implementations.Data
{ {
get get
{ {
return false; return true;
} }
} }

View File

@ -95,7 +95,7 @@ namespace Emby.Server.Implementations.Data
{ {
get get
{ {
return false; return true;
} }
} }

View File

@ -661,8 +661,9 @@
<Reference Include="Emby.XmlTv, Version=1.0.6387.29335, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Emby.XmlTv, Version=1.0.6387.29335, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Emby.XmlTv.1.0.10\lib\portable-net45+netstandard2.0+win8\Emby.XmlTv.dll</HintPath> <HintPath>..\packages\Emby.XmlTv.1.0.10\lib\portable-net45+netstandard2.0+win8\Emby.XmlTv.dll</HintPath>
</Reference> </Reference>
<Reference Include="MediaBrowser.Naming, Version=1.0.6437.24226, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="MediaBrowser.Naming, Version=1.0.6447.2217, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MediaBrowser.Naming.1.0.6\lib\portable-net45+netstandard2.0+win8\MediaBrowser.Naming.dll</HintPath> <HintPath>..\packages\MediaBrowser.Naming.1.0.7\lib\portable-net45+netstandard2.0+win8\MediaBrowser.Naming.dll</HintPath>
<Private>True</Private>
</Reference> </Reference>
<Reference Include="ServiceStack.Text, Version=4.5.8.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="ServiceStack.Text, Version=4.5.8.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\ServiceStack.Text.4.5.8\lib\net45\ServiceStack.Text.dll</HintPath> <HintPath>..\packages\ServiceStack.Text.4.5.8\lib\net45\ServiceStack.Text.dll</HintPath>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="Emby.XmlTv" version="1.0.10" targetFramework="net46" /> <package id="Emby.XmlTv" version="1.0.10" targetFramework="net46" />
<package id="MediaBrowser.Naming" version="1.0.6" targetFramework="net46" /> <package id="MediaBrowser.Naming" version="1.0.7" targetFramework="net46" />
<package id="ServiceStack.Text" version="4.5.8" targetFramework="net46" /> <package id="ServiceStack.Text" version="4.5.8" targetFramework="net46" />
<package id="SharpCompress" version="0.14.0" targetFramework="net46" /> <package id="SharpCompress" version="0.14.0" targetFramework="net46" />
<package id="SimpleInjector" version="4.0.8" targetFramework="net46" /> <package id="SimpleInjector" version="4.0.8" targetFramework="net46" />

View File

@ -110,7 +110,7 @@ namespace MediaBrowser.Controller.Entities.Audio
list[index] = artist; list[index] = artist;
index++; index++;
} }
foreach (var artist in AlbumArtists) foreach (var artist in Artists)
{ {
list[index] = artist; list[index] = artist;
index++; index++;

View File

@ -96,7 +96,7 @@ namespace MediaBrowser.Controller.Entities.Audio
list[index] = artist; list[index] = artist;
index++; index++;
} }
foreach (var artist in AlbumArtists) foreach (var artist in Artists)
{ {
list[index] = artist; list[index] = artist;
index++; index++;

View File

@ -25,6 +25,7 @@ using System.Threading.Tasks;
using MediaBrowser.Controller.Dto; using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Extensions; using MediaBrowser.Controller.Extensions;
using MediaBrowser.Controller.IO; using MediaBrowser.Controller.IO;
using MediaBrowser.Controller.MediaEncoding;
using MediaBrowser.Controller.Sorting; using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.Extensions; using MediaBrowser.Model.Extensions;
using MediaBrowser.Model.Globalization; using MediaBrowser.Model.Globalization;
@ -536,6 +537,7 @@ namespace MediaBrowser.Controller.Entities
public static ICollectionManager CollectionManager { get; set; } public static ICollectionManager CollectionManager { get; set; }
public static IImageProcessor ImageProcessor { get; set; } public static IImageProcessor ImageProcessor { get; set; }
public static IMediaSourceManager MediaSourceManager { get; set; } public static IMediaSourceManager MediaSourceManager { get; set; }
public static IMediaEncoder MediaEncoder { get; set; }
/// <summary> /// <summary>
/// Returns a <see cref="System.String" /> that represents this instance. /// Returns a <see cref="System.String" /> that represents this instance.

View File

@ -149,18 +149,20 @@ namespace MediaBrowser.Controller.Entities
/// <value>The video3 D format.</value> /// <value>The video3 D format.</value>
public Video3DFormat? Video3DFormat { get; set; } public Video3DFormat? Video3DFormat { get; set; }
/// <summary>
/// Gets the playable stream files.
/// </summary>
/// <returns>List{System.String}.</returns>
public string[] GetPlayableStreamFiles()
{
return GetPlayableStreamFiles(Path);
}
public string[] GetPlayableStreamFileNames() 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);
} }
/// <summary> /// <summary>
@ -413,36 +415,6 @@ namespace MediaBrowser.Controller.Entities
return base.IsValidFromResolver(newItem); return base.IsValidFromResolver(newItem);
} }
/// <summary>
/// Gets the playable stream files.
/// </summary>
/// <param name="rootPath">The root path.</param>
/// <returns>List{System.String}.</returns>
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) public static string[] QueryPlayableStreamFiles(string rootPath, VideoType videoType)
{ {
if (videoType == VideoType.Dvd) if (videoType == VideoType.Dvd)

View File

@ -1,9 +1,11 @@
using MediaBrowser.Model.Entities; using MediaBrowser.Model.Entities;
using MediaBrowser.Model.MediaInfo; using MediaBrowser.Model.MediaInfo;
using System; using System;
using System.Collections.Generic;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using MediaBrowser.Model.Dlna; using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.IO;
namespace MediaBrowser.Controller.MediaEncoding namespace MediaBrowser.Controller.MediaEncoding
{ {
@ -102,6 +104,8 @@ namespace MediaBrowser.Controller.MediaEncoding
IProgress<double> progress, IProgress<double> progress,
CancellationToken cancellationToken); CancellationToken cancellationToken);
Task ConvertImage(string inputPath, string outputPath);
/// <summary> /// <summary>
/// Escapes the subtitle filter path. /// Escapes the subtitle filter path.
/// </summary> /// </summary>
@ -116,5 +120,8 @@ namespace MediaBrowser.Controller.MediaEncoding
void SetLogFilename(string name); void SetLogFilename(string name);
void ClearLogFilename(); void ClearLogFilename();
string[] GetPlayableStreamFileNames(string path, VideoType videoType);
IEnumerable<string> GetPrimaryPlaylistVobFiles(string path, IIsoMount isoMount, uint? titleNumber);
} }
} }

View File

@ -1,11 +1,9 @@
using System.Collections.Generic; 
namespace MediaBrowser.Model.Sync namespace MediaBrowser.Model.Sync
{ {
public class SyncDataRequest public class SyncDataRequest
{ {
public string[] LocalItemIds { get; set; } public string[] LocalItemIds { get; set; }
public string[] OfflineUserIds { get; set; }
public string[] SyncJobItemIds { get; set; } public string[] SyncJobItemIds { get; set; }
public string TargetId { get; set; } public string TargetId { get; set; }
@ -13,7 +11,6 @@ namespace MediaBrowser.Model.Sync
public SyncDataRequest() public SyncDataRequest()
{ {
LocalItemIds = new string[] { }; LocalItemIds = new string[] { };
OfflineUserIds = new string[] { };
} }
} }
} }

View File

@ -25,9 +25,6 @@ using System.IO;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using MediaBrowser.Controller.IO;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Globalization; using MediaBrowser.Model.Globalization;
namespace MediaBrowser.Providers.MediaInfo namespace MediaBrowser.Providers.MediaInfo
@ -49,8 +46,6 @@ namespace MediaBrowser.Providers.MediaInfo
private readonly IChapterManager _chapterManager; private readonly IChapterManager _chapterManager;
private readonly ILibraryManager _libraryManager; 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) 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; _logger = logger;
@ -566,7 +561,7 @@ namespace MediaBrowser.Providers.MediaInfo
item.RunTimeTicks = GetRuntime(primaryTitle); item.RunTimeTicks = GetRuntime(primaryTitle);
} }
return GetPrimaryPlaylistVobFiles(item, mount, titleNumber) return _mediaEncoder.GetPrimaryPlaylistVobFiles(item.Path, mount, titleNumber)
.Select(Path.GetFileName) .Select(Path.GetFileName)
.ToArray(); .ToArray();
} }
@ -616,82 +611,5 @@ namespace MediaBrowser.Providers.MediaInfo
return null; return null;
} }
private IEnumerable<string> 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<string>();
}
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);
}
} }
} }

View File

@ -438,25 +438,25 @@ namespace MediaBrowser.Providers.TV
var seriesXmlFilename = preferredMetadataLanguage + ".xml"; var seriesXmlFilename = preferredMetadataLanguage + ".xml";
const int cacheDays = 1; const int cacheHours = 12;
var seriesFile = files.FirstOrDefault(i => string.Equals(seriesXmlFilename, i.Name, StringComparison.OrdinalIgnoreCase)); var seriesFile = files.FirstOrDefault(i => string.Equals(seriesXmlFilename, i.Name, StringComparison.OrdinalIgnoreCase));
// No need to check age if automatic updates are enabled // 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; return false;
} }
var actorsXml = files.FirstOrDefault(i => string.Equals("actors.xml", i.Name, StringComparison.OrdinalIgnoreCase)); var actorsXml = files.FirstOrDefault(i => string.Equals("actors.xml", i.Name, StringComparison.OrdinalIgnoreCase));
// No need to check age if automatic updates are enabled // 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; return false;
} }
var bannersXml = files.FirstOrDefault(i => string.Equals("banners.xml", i.Name, StringComparison.OrdinalIgnoreCase)); var bannersXml = files.FirstOrDefault(i => string.Equals("banners.xml", i.Name, StringComparison.OrdinalIgnoreCase));
// No need to check age if automatic updates are enabled // 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; return false;
} }

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"> <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata> <metadata>
<id>MediaBrowser.Common</id> <id>MediaBrowser.Common</id>
<version>3.0.741</version> <version>3.0.744</version>
<title>Emby.Common</title> <title>Emby.Common</title>
<authors>Emby Team</authors> <authors>Emby Team</authors>
<owners>ebr,Luke,scottisafool</owners> <owners>ebr,Luke,scottisafool</owners>

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata> <metadata>
<id>MediaBrowser.Server.Core</id> <id>MediaBrowser.Server.Core</id>
<version>3.0.741</version> <version>3.0.744</version>
<title>Emby.Server.Core</title> <title>Emby.Server.Core</title>
<authors>Emby Team</authors> <authors>Emby Team</authors>
<owners>ebr,Luke,scottisafool</owners> <owners>ebr,Luke,scottisafool</owners>
@ -12,7 +12,7 @@
<description>Contains core components required to build plugins for Emby Server.</description> <description>Contains core components required to build plugins for Emby Server.</description>
<copyright>Copyright © Emby 2013</copyright> <copyright>Copyright © Emby 2013</copyright>
<dependencies> <dependencies>
<dependency id="MediaBrowser.Common" version="3.0.741" /> <dependency id="MediaBrowser.Common" version="3.0.744" />
</dependencies> </dependencies>
</metadata> </metadata>
<files> <files>

View File

@ -1,3 +1,3 @@
using System.Reflection; using System.Reflection;
[assembly: AssemblyVersion("3.2.28.5")] [assembly: AssemblyVersion("3.2.28.6")]