The Free Software Media System - Server Backend & API
use new naming project
Luke Pulverenti124754a04f1a
diff --git a/MediaBrowser.Api/ApiEntryPoint.cs b/MediaBrowser.Api/ApiEntryPoint.csindex c01f59202a..d386373d4b 100644--- a/MediaBrowser.Api/ApiEntryPoint.cs+++ b/MediaBrowser.Api/ApiEntryPoint.cs@@ -273,7 +273,7 @@ namespace MediaBrowser.Api{if (job.Type == TranscodingJobType.Progressive){- const int timerDuration = 1500;+ const int timerDuration = 1000;if (job.KillTimer == null){diff --git a/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs b/MediaBrowser.Api/Playback/Hls/BaseHlsService.csindex 613039d23a..c963636fdf 100644--- a/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs+++ b/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs@@ -107,7 +107,7 @@ namespace MediaBrowser.Api.Playback.Hlsthrow;}- var waitCount = isLive ? 3 : 2;+ var waitCount = isLive ? 2 : 2;await WaitForMinimumSegmentCount(playlist, waitCount, cancellationTokenSource.Token).ConfigureAwait(false);}}diff --git a/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs b/MediaBrowser.Api/Playback/Hls/DynamicHlsService.csindex 97565cdc3d..0b32ae0529 100644--- a/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs+++ b/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs@@ -120,7 +120,6 @@ namespace MediaBrowser.Api.Playback.Hlsif (File.Exists(segmentPath)){- job = ApiEntryPoint.Instance.OnTranscodeBeginRequest(playlistPath, TranscodingJobType);return await GetSegmentResult(playlistPath, segmentPath, index, segmentLength, job, cancellationToken).ConfigureAwait(false);}@@ -129,7 +128,6 @@ namespace MediaBrowser.Api.Playback.Hls{if (File.Exists(segmentPath)){- job = ApiEntryPoint.Instance.OnTranscodeBeginRequest(playlistPath, TranscodingJobType);return await GetSegmentResult(playlistPath, segmentPath, index, segmentLength, job, cancellationToken).ConfigureAwait(false);}elsediff --git a/MediaBrowser.Api/Playback/Hls/MpegDashService.cs b/MediaBrowser.Api/Playback/Hls/MpegDashService.csindex 3c1f07c5f1..260a4c467e 100644--- a/MediaBrowser.Api/Playback/Hls/MpegDashService.cs+++ b/MediaBrowser.Api/Playback/Hls/MpegDashService.cs@@ -308,7 +308,6 @@ namespace MediaBrowser.Api.Playback.Hlsif (File.Exists(segmentPath)){- job = ApiEntryPoint.Instance.OnTranscodeBeginRequest(playlistPath, TranscodingJobType);return await GetSegmentResult(playlistPath, segmentPath, index, segmentLength, job, cancellationToken).ConfigureAwait(false);}@@ -317,7 +316,6 @@ namespace MediaBrowser.Api.Playback.Hls{if (File.Exists(segmentPath)){- job = ApiEntryPoint.Instance.OnTranscodeBeginRequest(playlistPath, TranscodingJobType);return await GetSegmentResult(playlistPath, segmentPath, index, segmentLength, job, cancellationToken).ConfigureAwait(false);}elsediff --git a/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs b/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.csindex 6bec387d42..746426c8e9 100644--- a/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs+++ b/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs@@ -421,6 +421,7 @@ namespace MediaBrowser.Api.Playback.Progressiveif (!File.Exists(outputPath)){job = await StartFfMpeg(state, outputPath, cancellationTokenSource).ConfigureAwait(false);+ job.ActiveRequestCount++;}else{diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.csindex d0f2e9dfae..34f52aac5d 100644--- a/MediaBrowser.Controller/Entities/Folder.cs+++ b/MediaBrowser.Controller/Entities/Folder.cs@@ -472,6 +472,7 @@ namespace MediaBrowser.Controller.Entities}else{+ newItems.Add(child);validChildren.Add(child);}}diff --git a/MediaBrowser.Controller/Entities/UserView.cs b/MediaBrowser.Controller/Entities/UserView.csindex 4b29f49d8d..7674dc1d38 100644--- a/MediaBrowser.Controller/Entities/UserView.cs+++ b/MediaBrowser.Controller/Entities/UserView.cs@@ -61,7 +61,6 @@ namespace MediaBrowser.Controller.Entities{var standaloneTypes = new List<string>{- CollectionType.AdultVideos,CollectionType.Books,CollectionType.HomeVideos,CollectionType.Photos,diff --git a/MediaBrowser.Controller/Entities/Video.cs b/MediaBrowser.Controller/Entities/Video.csindex f2484aab8a..1c59b8bfb2 100644--- a/MediaBrowser.Controller/Entities/Video.cs+++ b/MediaBrowser.Controller/Entities/Video.cs@@ -337,34 +337,7 @@ namespace MediaBrowser.Controller.Entities/// <returns>IEnumerable{Video}.</returns>private IEnumerable<Video> LoadAdditionalParts(IEnumerable<FileSystemInfo> fileSystemChildren, IDirectoryService directoryService){- IEnumerable<FileSystemInfo> files;-- var path = Path;-- if (VideoType == VideoType.BluRay || VideoType == VideoType.Dvd)- {- files = fileSystemChildren.Where(i =>- {- if ((i.Attributes & FileAttributes.Directory) == FileAttributes.Directory)- {- return !string.Equals(i.FullName, path, StringComparison.OrdinalIgnoreCase) && LibraryManager.IsMultiPartFolder(i.FullName);- }-- return false;- });- }- else- {- files = fileSystemChildren.Where(i =>- {- if ((i.Attributes & FileAttributes.Directory) == FileAttributes.Directory)- {- return false;- }-- return !string.Equals(i.FullName, path, StringComparison.OrdinalIgnoreCase) && LibraryManager.IsVideoFile(i.FullName) && LibraryManager.IsMultiPartFile(i.Name);- });- }+ var files = LibraryManager.GetAdditionalParts(Path, VideoType, fileSystemChildren);return LibraryManager.ResolvePaths<Video>(files, directoryService, null).Select(video =>{diff --git a/MediaBrowser.Controller/Library/ILibraryManager.cs b/MediaBrowser.Controller/Library/ILibraryManager.csindex 615ddd90ff..3367f98e47 100644--- a/MediaBrowser.Controller/Library/ILibraryManager.cs+++ b/MediaBrowser.Controller/Library/ILibraryManager.cs@@ -367,20 +367,6 @@ namespace MediaBrowser.Controller.Library/// <param name="path">The path.</param>/// <returns><c>true</c> if [is audio file] [the specified path]; otherwise, <c>false</c>.</returns>bool IsAudioFile(string path);-- /// <summary>- /// Determines whether [is multi part file] [the specified path].- /// </summary>- /// <param name="path">The path.</param>- /// <returns><c>true</c> if [is multi part file] [the specified path]; otherwise, <c>false</c>.</returns>- bool IsMultiPartFile(string path);-- /// <summary>- /// Determines whether [is multi part folder] [the specified path].- /// </summary>- /// <param name="path">The path.</param>- /// <returns><c>true</c> if [is multi part folder] [the specified path]; otherwise, <c>false</c>.</returns>- bool IsMultiPartFolder(string path);/// <summary>/// Gets the season number from path.@@ -417,5 +403,16 @@ namespace MediaBrowser.Controller.Library/// <param name="name">The name.</param>/// <returns>ItemInfo.</returns>ItemLookupInfo ParseName(string name);++ /// <summary>+ /// Gets the additional parts.+ /// </summary>+ /// <param name="file">The file.</param>+ /// <param name="type">The type.</param>+ /// <param name="files">The files.</param>+ /// <returns>IEnumerable<System.String>.</returns>+ IEnumerable<FileSystemInfo> GetAdditionalParts(string file,+ VideoType type,+ IEnumerable<FileSystemInfo> files);}}\ No newline at end of filediff --git a/MediaBrowser.Controller/Providers/DirectoryService.cs b/MediaBrowser.Controller/Providers/DirectoryService.csindex 4fdc08da0c..74a9c6606c 100644--- a/MediaBrowser.Controller/Providers/DirectoryService.cs+++ b/MediaBrowser.Controller/Providers/DirectoryService.cs@@ -11,6 +11,7 @@ namespace MediaBrowser.Controller.Providers{IEnumerable<FileSystemInfo> GetFileSystemEntries(string path);IEnumerable<FileSystemInfo> GetFiles(string path);+ IEnumerable<FileSystemInfo> GetDirectories(string path);IEnumerable<FileSystemInfo> GetFiles(string path, bool clearCache);FileSystemInfo GetFile(string path);Dictionary<string, FileSystemInfo> GetFileSystemDictionary(string path);@@ -109,5 +110,10 @@ namespace MediaBrowser.Controller.Providersreturn entry;}++ public IEnumerable<FileSystemInfo> GetDirectories(string path)+ {+ return GetFileSystemEntries(path, false).Where(i => (i.Attributes & FileAttributes.Directory) == FileAttributes.Directory);+ }}}diff --git a/MediaBrowser.Model/Entities/CollectionType.cs b/MediaBrowser.Model/Entities/CollectionType.csindex a4413f67aa..e51b2d311e 100644--- a/MediaBrowser.Model/Entities/CollectionType.cs+++ b/MediaBrowser.Model/Entities/CollectionType.cs@@ -16,8 +16,6 @@public const string BoxSets = "boxsets";- public const string AdultVideos = "adultvideos";-public const string Books = "books";public const string Photos = "photos";public const string Games = "games";diff --git a/MediaBrowser.Providers/BoxSets/MovieDbBoxSetProvider.cs b/MediaBrowser.Providers/BoxSets/MovieDbBoxSetProvider.csindex bca0c2746c..0611e415d8 100644--- a/MediaBrowser.Providers/BoxSets/MovieDbBoxSetProvider.cs+++ b/MediaBrowser.Providers/BoxSets/MovieDbBoxSetProvider.cs@@ -3,6 +3,7 @@ using MediaBrowser.Common.IO;using MediaBrowser.Common.Net;using MediaBrowser.Controller.Configuration;using MediaBrowser.Controller.Entities.Movies;+using MediaBrowser.Controller.Library;using MediaBrowser.Controller.Localization;using MediaBrowser.Controller.Providers;using MediaBrowser.Model.Entities;@@ -32,8 +33,9 @@ namespace MediaBrowser.Providers.BoxSetsprivate readonly IFileSystem _fileSystem;private readonly ILocalizationManager _localization;private readonly IHttpClient _httpClient;+ private readonly ILibraryManager _libraryManager;- public MovieDbBoxSetProvider(ILogger logger, IJsonSerializer json, IServerConfigurationManager config, IFileSystem fileSystem, ILocalizationManager localization, IHttpClient httpClient)+ public MovieDbBoxSetProvider(ILogger logger, IJsonSerializer json, IServerConfigurationManager config, IFileSystem fileSystem, ILocalizationManager localization, IHttpClient httpClient, ILibraryManager libraryManager){_logger = logger;_json = json;@@ -41,6 +43,7 @@ namespace MediaBrowser.Providers.BoxSets_fileSystem = fileSystem;_localization = localization;_httpClient = httpClient;+ _libraryManager = libraryManager;Current = this;}@@ -77,7 +80,7 @@ namespace MediaBrowser.Providers.BoxSetsreturn new[] { result };}- return await new MovieDbSearch(_logger, _json).GetSearchResults(searchInfo, cancellationToken).ConfigureAwait(false);+ return await new MovieDbSearch(_logger, _json, _libraryManager).GetSearchResults(searchInfo, cancellationToken).ConfigureAwait(false);}public async Task<MetadataResult<BoxSet>> GetMetadata(BoxSetInfo id, CancellationToken cancellationToken)@@ -87,7 +90,7 @@ namespace MediaBrowser.Providers.BoxSets// We don't already have an Id, need to fetch itif (string.IsNullOrEmpty(tmdbId)){- var searchResults = await new MovieDbSearch(_logger, _json).GetSearchResults(id, cancellationToken).ConfigureAwait(false);+ var searchResults = await new MovieDbSearch(_logger, _json, _libraryManager).GetSearchResults(id, cancellationToken).ConfigureAwait(false);var searchResult = searchResults.FirstOrDefault();diff --git a/MediaBrowser.Providers/MediaBrowser.Providers.csproj b/MediaBrowser.Providers/MediaBrowser.Providers.csprojindex e09d70fc5e..b164b74983 100644--- a/MediaBrowser.Providers/MediaBrowser.Providers.csproj+++ b/MediaBrowser.Providers/MediaBrowser.Providers.csproj@@ -53,9 +53,8 @@<SpecificVersion>False</SpecificVersion><HintPath>..\packages\MediaBrowser.BdInfo.1.0.0.10\lib\net35\DvdLib.dll</HintPath></Reference>- <Reference Include="MediaBrowser.Naming, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">- <SpecificVersion>False</SpecificVersion>- <HintPath>..\packages\MediaBrowser.Naming.1.0.0.2\lib\portable-net45+sl4+wp71+win8+wpa81\MediaBrowser.Naming.dll</HintPath>+ <Reference Include="MediaBrowser.Naming">+ <HintPath>..\packages\MediaBrowser.Naming.1.0.0.6\lib\portable-net45+sl4+wp71+win8+wpa81\MediaBrowser.Naming.dll</HintPath></Reference><Reference Include="MoreLinq, Version=1.1.17511.0, Culture=neutral, PublicKeyToken=384d532d7e88985d, processorArchitecture=MSIL"><SpecificVersion>False</SpecificVersion>diff --git a/MediaBrowser.Providers/Movies/GenericMovieDbInfo.cs b/MediaBrowser.Providers/Movies/GenericMovieDbInfo.csindex 44082b8581..87b2290909 100644--- a/MediaBrowser.Providers/Movies/GenericMovieDbInfo.cs+++ b/MediaBrowser.Providers/Movies/GenericMovieDbInfo.cs@@ -1,5 +1,6 @@using MediaBrowser.Controller.Entities;using MediaBrowser.Controller.Entities.Movies;+using MediaBrowser.Controller.Library;using MediaBrowser.Controller.Providers;using MediaBrowser.Model.Entities;using MediaBrowser.Model.Logging;@@ -20,13 +21,15 @@ namespace MediaBrowser.Providers.Movies{private readonly ILogger _logger;private readonly IJsonSerializer _jsonSerializer;+ private readonly ILibraryManager _libraryManager;private readonly CultureInfo _usCulture = new CultureInfo("en-US");- public GenericMovieDbInfo(ILogger logger, IJsonSerializer jsonSerializer)+ public GenericMovieDbInfo(ILogger logger, IJsonSerializer jsonSerializer, ILibraryManager libraryManager){_logger = logger;_jsonSerializer = jsonSerializer;+ _libraryManager = libraryManager;}public async Task<MetadataResult<T>> GetMetadata(ItemLookupInfo itemId, CancellationToken cancellationToken)@@ -39,7 +42,7 @@ namespace MediaBrowser.Providers.Movies// Don't search for music video id's because it is very easy to misidentify.if (string.IsNullOrEmpty(tmdbId) && string.IsNullOrEmpty(imdbId) && typeof(T) != typeof(MusicVideo)){- var searchResults = await new MovieDbSearch(_logger, _jsonSerializer).GetMovieSearchResults(itemId, cancellationToken).ConfigureAwait(false);+ var searchResults = await new MovieDbSearch(_logger, _jsonSerializer, _libraryManager).GetMovieSearchResults(itemId, cancellationToken).ConfigureAwait(false);var searchResult = searchResults.FirstOrDefault();diff --git a/MediaBrowser.Providers/Movies/MovieDbProvider.cs b/MediaBrowser.Providers/Movies/MovieDbProvider.csindex cd0f142005..05747e49f5 100644--- a/MediaBrowser.Providers/Movies/MovieDbProvider.cs+++ b/MediaBrowser.Providers/Movies/MovieDbProvider.cs@@ -4,6 +4,7 @@ using MediaBrowser.Common.Net;using MediaBrowser.Controller.Configuration;using MediaBrowser.Controller.Entities;using MediaBrowser.Controller.Entities.Movies;+using MediaBrowser.Controller.Library;using MediaBrowser.Controller.Localization;using MediaBrowser.Controller.Providers;using MediaBrowser.Model.Entities;@@ -35,10 +36,11 @@ namespace MediaBrowser.Providers.Moviesprivate readonly IServerConfigurationManager _configurationManager;private readonly ILogger _logger;private readonly ILocalizationManager _localization;+ private readonly ILibraryManager _libraryManager;private readonly CultureInfo _usCulture = new CultureInfo("en-US");- public MovieDbProvider(IJsonSerializer jsonSerializer, IHttpClient httpClient, IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILogger logger, ILocalizationManager localization)+ public MovieDbProvider(IJsonSerializer jsonSerializer, IHttpClient httpClient, IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILogger logger, ILocalizationManager localization, ILibraryManager libraryManager){_jsonSerializer = jsonSerializer;_httpClient = httpClient;@@ -46,6 +48,7 @@ namespace MediaBrowser.Providers.Movies_configurationManager = configurationManager;_logger = logger;_localization = localization;+ _libraryManager = libraryManager;Current = this;}@@ -101,7 +104,7 @@ namespace MediaBrowser.Providers.Moviesreturn new[] { remoteResult };}- return await new MovieDbSearch(_logger, _jsonSerializer).GetMovieSearchResults(searchInfo, cancellationToken).ConfigureAwait(false);+ return await new MovieDbSearch(_logger, _jsonSerializer, _libraryManager).GetMovieSearchResults(searchInfo, cancellationToken).ConfigureAwait(false);}public Task<MetadataResult<Movie>> GetMetadata(MovieInfo info, CancellationToken cancellationToken)@@ -112,7 +115,7 @@ namespace MediaBrowser.Providers.Moviespublic Task<MetadataResult<T>> GetItemMetadata<T>(ItemLookupInfo id, CancellationToken cancellationToken)where T : Video, new(){- var movieDb = new GenericMovieDbInfo<T>(_logger, _jsonSerializer);+ var movieDb = new GenericMovieDbInfo<T>(_logger, _jsonSerializer, _libraryManager);return movieDb.GetMetadata(id, cancellationToken);}diff --git a/MediaBrowser.Providers/Movies/MovieDbSearch.cs b/MediaBrowser.Providers/Movies/MovieDbSearch.csindex ba7693043b..ae176e4897 100644--- a/MediaBrowser.Providers/Movies/MovieDbSearch.cs+++ b/MediaBrowser.Providers/Movies/MovieDbSearch.cs@@ -25,12 +25,13 @@ namespace MediaBrowser.Providers.Moviesprivate readonly ILogger _logger;private readonly IJsonSerializer _json;- private ILibraryManager _libraryManager;+ private readonly ILibraryManager _libraryManager;- public MovieDbSearch(ILogger logger, IJsonSerializer json)+ public MovieDbSearch(ILogger logger, IJsonSerializer json, ILibraryManager libraryManager){_logger = logger;_json = json;+ _libraryManager = libraryManager;}public Task<IEnumerable<RemoteSearchResult>> GetSearchResults(SeriesInfo idInfo, CancellationToken cancellationToken)diff --git a/MediaBrowser.Providers/Omdb/OmdbItemProvider.cs b/MediaBrowser.Providers/Omdb/OmdbItemProvider.csindex 1f8824c9a6..a3badd1dfc 100644--- a/MediaBrowser.Providers/Omdb/OmdbItemProvider.cs+++ b/MediaBrowser.Providers/Omdb/OmdbItemProvider.cs@@ -3,6 +3,7 @@ using MediaBrowser.Controller.Channels;using MediaBrowser.Controller.Entities;using MediaBrowser.Controller.Entities.Movies;using MediaBrowser.Controller.Entities.TV;+using MediaBrowser.Controller.Library;using MediaBrowser.Controller.Providers;using MediaBrowser.Model.Channels;using MediaBrowser.Model.Entities;@@ -24,12 +25,14 @@ namespace MediaBrowser.Providers.Omdbprivate readonly IJsonSerializer _jsonSerializer;private readonly IHttpClient _httpClient;private readonly ILogger _logger;+ private readonly ILibraryManager _libraryManager;- public OmdbItemProvider(IJsonSerializer jsonSerializer, IHttpClient httpClient, ILogger logger)+ public OmdbItemProvider(IJsonSerializer jsonSerializer, IHttpClient httpClient, ILogger logger, ILibraryManager libraryManager){_jsonSerializer = jsonSerializer;_httpClient = httpClient;_logger = logger;+ _libraryManager = libraryManager;}public async Task<IEnumerable<RemoteSearchResult>> GetSearchResults(SeriesInfo searchInfo, CancellationToken cancellationToken)@@ -160,7 +163,7 @@ namespace MediaBrowser.Providers.Omdbprivate async Task<Tuple<string, string, string>> GetMovieImdbId(ItemLookupInfo info, CancellationToken cancellationToken){- var result = await new GenericMovieDbInfo<Movie>(_logger, _jsonSerializer).GetMetadata(info, cancellationToken)+ var result = await new GenericMovieDbInfo<Movie>(_logger, _jsonSerializer, _libraryManager).GetMetadata(info, cancellationToken).ConfigureAwait(false);var imdb = result.HasMetadata ? result.Item.GetProviderId(MetadataProviders.Imdb) : null;diff --git a/MediaBrowser.Providers/TV/MovieDbSeriesProvider.cs b/MediaBrowser.Providers/TV/MovieDbSeriesProvider.csindex d435a6ba72..b4588741e2 100644--- a/MediaBrowser.Providers/TV/MovieDbSeriesProvider.cs+++ b/MediaBrowser.Providers/TV/MovieDbSeriesProvider.cs@@ -4,6 +4,7 @@ using MediaBrowser.Common.Net;using MediaBrowser.Controller.Configuration;using MediaBrowser.Controller.Entities;using MediaBrowser.Controller.Entities.TV;+using MediaBrowser.Controller.Library;using MediaBrowser.Controller.Localization;using MediaBrowser.Controller.Providers;using MediaBrowser.Model.Entities;@@ -34,6 +35,7 @@ namespace MediaBrowser.Providers.TVprivate readonly ILogger _logger;private readonly ILocalizationManager _localization;private readonly IHttpClient _httpClient;+ private readonly ILibraryManager _libraryManager;public MovieDbSeriesProvider(IJsonSerializer jsonSerializer, IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILogger logger, ILocalizationManager localization, IHttpClient httpClient){@@ -110,7 +112,7 @@ namespace MediaBrowser.Providers.TV}}- return await new MovieDbSearch(_logger, _jsonSerializer).GetSearchResults(searchInfo, cancellationToken).ConfigureAwait(false);+ return await new MovieDbSearch(_logger, _jsonSerializer, _libraryManager).GetSearchResults(searchInfo, cancellationToken).ConfigureAwait(false);}public async Task<MetadataResult<Series>> GetMetadata(SeriesInfo info, CancellationToken cancellationToken)@@ -151,7 +153,7 @@ namespace MediaBrowser.Providers.TVif (string.IsNullOrEmpty(tmdbId)){- var searchResults = await new MovieDbSearch(_logger, _jsonSerializer).GetSearchResults(info, cancellationToken).ConfigureAwait(false);+ var searchResults = await new MovieDbSearch(_logger, _jsonSerializer, _libraryManager).GetSearchResults(info, cancellationToken).ConfigureAwait(false);var searchResult = searchResults.FirstOrDefault();diff --git a/MediaBrowser.Providers/packages.config b/MediaBrowser.Providers/packages.configindex 48906c583a..a09acf8517 100644--- a/MediaBrowser.Providers/packages.config+++ b/MediaBrowser.Providers/packages.config@@ -1,7 +1,7 @@<?xml version="1.0" encoding="utf-8"?><packages><package id="MediaBrowser.BdInfo" version="1.0.0.10" targetFramework="net45" />- <package id="MediaBrowser.Naming" version="1.0.0.2" targetFramework="net45" />+ <package id="MediaBrowser.Naming" version="1.0.0.6" targetFramework="net45" /><package id="morelinq" version="1.1.0" targetFramework="net45" /><package id="taglib" version="2.1.0.0" targetFramework="net45" /></packages>\ No newline at end of filediff --git a/MediaBrowser.Server.Implementations/HttpServer/StreamWriter.cs b/MediaBrowser.Server.Implementations/HttpServer/StreamWriter.csindex 29b703e252..1db14e8878 100644--- a/MediaBrowser.Server.Implementations/HttpServer/StreamWriter.cs+++ b/MediaBrowser.Server.Implementations/HttpServer/StreamWriter.cs@@ -4,7 +4,6 @@ using System;using System.Collections.Generic;using System.Globalization;using System.IO;-using System.Threading.Tasks;namespace MediaBrowser.Server.Implementations.HttpServer{@@ -91,7 +90,7 @@ namespace MediaBrowser.Server.Implementations.HttpServerThrottleCallback = ThrottleCallback};}- WriteToAsync(responseStream);+ WriteToInternal(responseStream);}/// <summary>@@ -99,7 +98,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer/// </summary>/// <param name="responseStream">The response stream.</param>/// <returns>Task.</returns>- private void WriteToAsync(Stream responseStream)+ private void WriteToInternal(Stream responseStream){try{diff --git a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs b/MediaBrowser.Server.Implementations/Library/LibraryManager.csindex e2a2ce0a4d..9e695fa2ca 100644--- a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs+++ b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs@@ -1644,18 +1644,6 @@ namespace MediaBrowser.Server.Implementations.Libraryreturn parser.IsAudioFile(path);}- public bool IsMultiPartFile(string path)- {- var parser = new MultiPartParser(new ExpandedVideoOptions(), new AudioOptions(), new Naming.Logging.NullLogger());- return parser.Parse(path, FileInfoType.File).IsMultiPart;- }-- public bool IsMultiPartFolder(string path)- {- var parser = new MultiPartParser(new ExpandedVideoOptions(), new AudioOptions(), new Naming.Logging.NullLogger());- return parser.Parse(path, FileInfoType.Directory).IsMultiPart;- }-public int? GetSeasonNumberFromPath(string path){return SeriesResolver.GetSeasonNumberFromPath(path);@@ -1688,5 +1676,42 @@ namespace MediaBrowser.Server.Implementations.LibraryYear = result.Year};}++ public IEnumerable<FileSystemInfo> GetAdditionalParts(string file,+ VideoType type,+ IEnumerable<FileSystemInfo> files)+ {+ var resolver = new StackResolver(new ExpandedVideoOptions(), new AudioOptions(), new Naming.Logging.NullLogger());++ StackResult result;+ List<FileSystemInfo> filteredFiles;++ if (type == VideoType.BluRay || type == VideoType.Dvd)+ {+ filteredFiles = files.Where(i => (i.Attributes & FileAttributes.Directory) == FileAttributes.Directory)+ .ToList();++ result = resolver.ResolveDirectories(filteredFiles.Select(i => i.FullName));+ }+ else+ {+ filteredFiles = files.Where(i => (i.Attributes & FileAttributes.Directory) != FileAttributes.Directory)+ .ToList();++ result = resolver.ResolveFiles(filteredFiles.Select(i => i.FullName));+ }++ var stack = result.Stacks+ .FirstOrDefault(i => i.Files.Contains(file, StringComparer.OrdinalIgnoreCase));++ if (stack != null)+ {+ return stack.Files.Where(i => !string.Equals(i, file, StringComparison.OrdinalIgnoreCase))+ .Select(i => filteredFiles.FirstOrDefault(f => string.Equals(i, f.FullName, StringComparison.OrdinalIgnoreCase)))+ .Where(i => i != null);+ }++ return new List<FileSystemInfo>();+ }}}diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.csindex b7a414b9de..15125ac43f 100644--- a/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs+++ b/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs@@ -12,6 +12,8 @@ using System;using System.Collections.Generic;using System.IO;using System.Linq;+using MediaBrowser.Naming.Audio;+using MediaBrowser.Naming.Video;namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies{@@ -88,11 +90,6 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Moviesreturn FindMovie<MusicVideo>(args.Path, args.Parent, args.FileSystemChildren.ToList(), args.DirectoryService, false, false, collectionType);}- if (string.Equals(collectionType, CollectionType.AdultVideos, StringComparison.OrdinalIgnoreCase))- {- return FindMovie<Video>(args.Path, args.Parent, args.FileSystemChildren.ToList(), args.DirectoryService, true, false, collectionType);- }-if (string.Equals(collectionType, CollectionType.HomeVideos, StringComparison.OrdinalIgnoreCase)){return FindMovie<Video>(args.Path, args.Parent, args.FileSystemChildren.ToList(), args.DirectoryService, true, false, collectionType);@@ -128,11 +125,6 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Moviesitem = ResolveVideo<MusicVideo>(args);}- if (string.Equals(collectionType, CollectionType.AdultVideos, StringComparison.OrdinalIgnoreCase))- {- item = ResolveVideo<Video>(args);- }-// To find a movie file, the collection type must be movies or boxsets// Otherwise we'll consider it a plain video and let the video resolver handle itif (string.Equals(collectionType, CollectionType.Movies, StringComparison.OrdinalIgnoreCase) ||@@ -219,10 +211,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies};}- if (LibraryManager.IsMultiPartFolder(filename))- {- multiDiscFolders.Add(child);- }+ multiDiscFolders.Add(child);continue;}@@ -280,9 +269,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Moviesif (multiDiscFolders.Count > 0){- var folders = fileSystemEntries.Where(child => (child.Attributes & FileAttributes.Directory) == FileAttributes.Directory);-- return GetMultiDiscMovie<T>(multiDiscFolders, folders);+ return GetMultiDiscMovie<T>(multiDiscFolders, directoryService);}return null;@@ -293,16 +280,18 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies/// </summary>/// <typeparam name="T"></typeparam>/// <param name="multiDiscFolders">The folders.</param>- /// <param name="allFolders">All folders.</param>+ /// <param name="directoryService">The directory service.</param>/// <returns>``0.</returns>- private T GetMultiDiscMovie<T>(List<FileSystemInfo> multiDiscFolders, IEnumerable<FileSystemInfo> allFolders)+ private T GetMultiDiscMovie<T>(List<FileSystemInfo> multiDiscFolders, IDirectoryService directoryService)where T : Video, new(){var videoTypes = new List<VideoType>();var folderPaths = multiDiscFolders.Select(i => i.FullName).Where(i =>{- var subfolders = Directory.GetDirectories(i).Select(Path.GetFileName).ToList();+ var subfolders = directoryService.GetDirectories(i)+ .Select(d => d.Name)+ .ToList();if (subfolders.Any(IsDvdDirectory)){@@ -320,7 +309,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies}).OrderBy(i => i).ToList();// If different video types were found, don't allow this- if (videoTypes.Count > 0 && videoTypes.Any(i => i != videoTypes[0]))+ if (videoTypes.Distinct().Count() > 1){return null;}@@ -330,35 +319,24 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Moviesreturn null;}- // If there are other folders side by side that are folder rips, don't allow it- // TODO: Improve this to return null if any folder is present aside from our regularly ignored folders- if (allFolders.Except(multiDiscFolders).Any(i =>- {- var subfolders = Directory.GetDirectories(i.FullName).Select(Path.GetFileName).ToList();+ var resolver = new StackResolver(new ExpandedVideoOptions(), new AudioOptions(), new Naming.Logging.NullLogger());- if (subfolders.Any(IsDvdDirectory))- {- return true;- }- if (subfolders.Any(IsBluRayDirectory))- {- return true;- }+ var result = resolver.ResolveDirectories(folderPaths);- return false;-- }))+ if (result.Stacks.Count != 1){return null;}-+return new T{Path = folderPaths[0],IsMultiPart = true,- VideoType = videoTypes[0]+ VideoType = videoTypes[0],++ Name = result.Stacks[0].Name};}@@ -375,21 +353,22 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Moviesvar firstMovie = sortedMovies[0];- // They must all be part of the sequence if we're going to consider it a multi-part movie- if (sortedMovies.All(i => LibraryManager.IsMultiPartFile(i.Path)))- {- // Only support up to 8 (matches Plex), to help avoid incorrect detection- if (sortedMovies.Count <= 8)- {- firstMovie.IsMultiPart = true;+ var paths = sortedMovies.Select(i => i.Path).ToList();- _logger.Debug("Multi-part video found: " + firstMovie.Path);+ var resolver = new StackResolver(new ExpandedVideoOptions(), new AudioOptions(), new Naming.Logging.NullLogger());- return firstMovie;- }+ var result = resolver.ResolveFiles(paths);++ if (result.Stacks.Count != 1)+ {+ return null;}- return null;+ firstMovie.IsMultiPart = true;+ firstMovie.Name = result.Stacks[0].Name;++ // They must all be part of the sequence if we're going to consider it a multi-part movie+ return firstMovie;}private T GetMovieWithMultipleSources<T>(IEnumerable<T> movies)diff --git a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csprojindex 36fc04fca6..51482451f3 100644--- a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj+++ b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj@@ -51,7 +51,7 @@</Reference><Reference Include="MediaBrowser.Naming, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"><SpecificVersion>False</SpecificVersion>- <HintPath>..\packages\MediaBrowser.Naming.1.0.0.2\lib\portable-net45+sl4+wp71+win8+wpa81\MediaBrowser.Naming.dll</HintPath>+ <HintPath>..\packages\MediaBrowser.Naming.1.0.0.6\lib\portable-net45+sl4+wp71+win8+wpa81\MediaBrowser.Naming.dll</HintPath></Reference><Reference Include="Mono.Nat, Version=1.2.21.0, Culture=neutral, processorArchitecture=MSIL"><SpecificVersion>False</SpecificVersion>diff --git a/MediaBrowser.Server.Implementations/packages.config b/MediaBrowser.Server.Implementations/packages.configindex ae52e16166..98454bec0a 100644--- a/MediaBrowser.Server.Implementations/packages.config+++ b/MediaBrowser.Server.Implementations/packages.config@@ -1,6 +1,6 @@<?xml version="1.0" encoding="utf-8"?><packages>- <package id="MediaBrowser.Naming" version="1.0.0.2" targetFramework="net45" />+ <package id="MediaBrowser.Naming" version="1.0.0.6" targetFramework="net45" /><package id="Mono.Nat" version="1.2.21.0" targetFramework="net45" /><package id="morelinq" version="1.1.0" targetFramework="net45" /></packages>\ No newline at end of filediff --git a/MediaBrowser.Server.Startup.Common/FFMpeg/FFmpegValidator.cs b/MediaBrowser.Server.Startup.Common/FFMpeg/FFmpegValidator.csindex a2abea13cc..615203d75b 100644--- a/MediaBrowser.Server.Startup.Common/FFMpeg/FFmpegValidator.cs+++ b/MediaBrowser.Server.Startup.Common/FFMpeg/FFmpegValidator.cs@@ -26,21 +26,50 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeg_logger.Info("FFProbe: {0}", info.ProbePath);var fileInfo = new FileInfo(info.EncoderPath);- var cachePath = Path.Combine(_appPaths.CachePath, fileInfo.Length.ToString(CultureInfo.InvariantCulture).GetMD5().ToString("N"));+ var cachePath = Path.Combine(_appPaths.CachePath, "1" + fileInfo.Length.ToString(CultureInfo.InvariantCulture).GetMD5().ToString("N"));- if (!File.Exists(cachePath))+ ValidateCodecs(info.EncoderPath, cachePath);+ }++ private void ValidateCodecs(string ffmpegPath, string cachePath)+ {+ string output = null;+ try+ {+ output = File.ReadAllText(cachePath, Encoding.UTF8);+ }+ catch+ {++ }++ if (string.IsNullOrWhiteSpace(output)){- ValidateCodecs(info.EncoderPath);+ try+ {+ output = GetFFMpegOutput(ffmpegPath, "-encoders");+ }+ catch+ {+ return;+ }++ try+ {+ Directory.CreateDirectory(Path.GetDirectoryName(cachePath));+ File.WriteAllText(cachePath, output, Encoding.UTF8);+ }+ catch+ {- Directory.CreateDirectory(Path.GetDirectoryName(cachePath));- File.WriteAllText(cachePath, string.Empty, Encoding.UTF8);+ }}++ ValidateCodecsFromOutput(output);}- private void ValidateCodecs(string path)+ private void ValidateCodecsFromOutput(string output){- var output = GetOutput(path, "-encoders");-var required = new[]{"libx264",@@ -61,12 +90,13 @@ namespace MediaBrowser.Server.Startup.Common.FFMpegif (output.IndexOf(srch, StringComparison.OrdinalIgnoreCase) == -1){- throw new ArgumentException("ffmpeg is missing encoder " + encoder);+ _logger.Error("ffmpeg is missing encoder " + encoder);+ //throw new ArgumentException("ffmpeg is missing encoder " + encoder);}}}- private string GetOutput(string path, string arguments)+ private string GetFFMpegOutput(string path, string arguments){var process = new Process{