mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-06-29 10:23:36 +02:00
use new naming project
This commit is contained in:
parent
049ef9b4ec
commit
124754a04f
|
@ -273,7 +273,7 @@ namespace MediaBrowser.Api
|
|||
{
|
||||
if (job.Type == TranscodingJobType.Progressive)
|
||||
{
|
||||
const int timerDuration = 1500;
|
||||
const int timerDuration = 1000;
|
||||
|
||||
if (job.KillTimer == null)
|
||||
{
|
||||
|
|
|
@ -107,7 +107,7 @@ namespace MediaBrowser.Api.Playback.Hls
|
|||
throw;
|
||||
}
|
||||
|
||||
var waitCount = isLive ? 3 : 2;
|
||||
var waitCount = isLive ? 2 : 2;
|
||||
await WaitForMinimumSegmentCount(playlist, waitCount, cancellationTokenSource.Token).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -120,7 +120,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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -308,7 +308,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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -421,6 +421,7 @@ namespace MediaBrowser.Api.Playback.Progressive
|
|||
if (!File.Exists(outputPath))
|
||||
{
|
||||
job = await StartFfMpeg(state, outputPath, cancellationTokenSource).ConfigureAwait(false);
|
||||
job.ActiveRequestCount++;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -472,6 +472,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
}
|
||||
else
|
||||
{
|
||||
newItems.Add(child);
|
||||
validChildren.Add(child);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,7 +61,6 @@ namespace MediaBrowser.Controller.Entities
|
|||
{
|
||||
var standaloneTypes = new List<string>
|
||||
{
|
||||
CollectionType.AdultVideos,
|
||||
CollectionType.Books,
|
||||
CollectionType.HomeVideos,
|
||||
CollectionType.Photos,
|
||||
|
|
|
@ -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 =>
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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.Providers
|
|||
|
||||
return entry;
|
||||
}
|
||||
|
||||
public IEnumerable<FileSystemInfo> GetDirectories(string path)
|
||||
{
|
||||
return GetFileSystemEntries(path, false).Where(i => (i.Attributes & FileAttributes.Directory) == FileAttributes.Directory);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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.BoxSets
|
|||
private 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.BoxSets
|
|||
return 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 it
|
||||
if (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();
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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.Movies
|
|||
private 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.Movies
|
|||
return 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.Movies
|
|||
public 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);
|
||||
}
|
||||
|
|
|
@ -25,12 +25,13 @@ namespace MediaBrowser.Providers.Movies
|
|||
|
||||
private 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)
|
||||
|
|
|
@ -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.Omdb
|
|||
private 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.Omdb
|
|||
|
||||
private 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;
|
||||
|
|
|
@ -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.TV
|
|||
private 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.TV
|
|||
|
||||
if (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();
|
||||
|
||||
|
|
|
@ -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>
|
|
@ -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.HttpServer
|
|||
ThrottleCallback = 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
|
||||
{
|
||||
|
|
|
@ -1644,18 +1644,6 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
return 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.Library
|
|||
Year = 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>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.Movies
|
|||
return 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.Movies
|
|||
item = 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 it
|
||||
if (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.Movies
|
|||
|
||||
if (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.Movies
|
|||
return 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.Movies
|
|||
|
||||
var 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)))
|
||||
var paths = sortedMovies.Select(i => i.Path).ToList();
|
||||
|
||||
var resolver = new StackResolver(new ExpandedVideoOptions(), new AudioOptions(), new Naming.Logging.NullLogger());
|
||||
|
||||
var result = resolver.ResolveFiles(paths);
|
||||
|
||||
if (result.Stacks.Count != 1)
|
||||
{
|
||||
// Only support up to 8 (matches Plex), to help avoid incorrect detection
|
||||
if (sortedMovies.Count <= 8)
|
||||
{
|
||||
firstMovie.IsMultiPart = true;
|
||||
|
||||
_logger.Debug("Multi-part video found: " + firstMovie.Path);
|
||||
|
||||
return firstMovie;
|
||||
}
|
||||
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)
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
|
@ -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);
|
||||
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(cachePath));
|
||||
File.WriteAllText(cachePath, string.Empty, Encoding.UTF8);
|
||||
}
|
||||
ValidateCodecs(info.EncoderPath, cachePath);
|
||||
}
|
||||
|
||||
private void ValidateCodecs(string path)
|
||||
private void ValidateCodecs(string ffmpegPath, string cachePath)
|
||||
{
|
||||
var output = GetOutput(path, "-encoders");
|
||||
string output = null;
|
||||
try
|
||||
{
|
||||
output = File.ReadAllText(cachePath, Encoding.UTF8);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(output))
|
||||
{
|
||||
try
|
||||
{
|
||||
output = GetFFMpegOutput(ffmpegPath, "-encoders");
|
||||
}
|
||||
catch
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(cachePath));
|
||||
File.WriteAllText(cachePath, output, Encoding.UTF8);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
ValidateCodecsFromOutput(output);
|
||||
}
|
||||
|
||||
private void ValidateCodecsFromOutput(string output)
|
||||
{
|
||||
var required = new[]
|
||||
{
|
||||
"libx264",
|
||||
|
@ -61,12 +90,13 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeg
|
|||
|
||||
if (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
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue