commit
3fb6a10e89
|
@ -7,6 +7,7 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using MediaBrowser.Common.IO;
|
using MediaBrowser.Common.IO;
|
||||||
using MediaBrowser.Controller.IO;
|
using MediaBrowser.Controller.IO;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
|
@ -179,7 +180,7 @@ namespace MediaBrowser.Api.Images
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="request">The request.</param>
|
/// <param name="request">The request.</param>
|
||||||
/// <returns>System.Object.</returns>
|
/// <returns>System.Object.</returns>
|
||||||
public object Get(GetGeneralImage request)
|
public Task<object> Get(GetGeneralImage request)
|
||||||
{
|
{
|
||||||
var filename = string.Equals(request.Type, "primary", StringComparison.OrdinalIgnoreCase)
|
var filename = string.Equals(request.Type, "primary", StringComparison.OrdinalIgnoreCase)
|
||||||
? "folder"
|
? "folder"
|
||||||
|
@ -238,7 +239,7 @@ namespace MediaBrowser.Api.Images
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="request">The request.</param>
|
/// <param name="request">The request.</param>
|
||||||
/// <returns>System.Object.</returns>
|
/// <returns>System.Object.</returns>
|
||||||
public object Get(GetMediaInfoImage request)
|
public Task<object> Get(GetMediaInfoImage request)
|
||||||
{
|
{
|
||||||
var themeFolder = Path.Combine(_appPaths.MediaInfoImagesPath, request.Theme);
|
var themeFolder = Path.Combine(_appPaths.MediaInfoImagesPath, request.Theme);
|
||||||
|
|
||||||
|
|
|
@ -421,7 +421,7 @@ namespace MediaBrowser.Api.Playback.Hls
|
||||||
// If all transcoding has completed, just return immediately
|
// If all transcoding has completed, just return immediately
|
||||||
if (transcodingJob != null && transcodingJob.HasExited && FileSystem.FileExists(segmentPath))
|
if (transcodingJob != null && transcodingJob.HasExited && FileSystem.FileExists(segmentPath))
|
||||||
{
|
{
|
||||||
return GetSegmentResult(state, segmentPath, segmentIndex, transcodingJob);
|
return await GetSegmentResult(state, segmentPath, segmentIndex, transcodingJob).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
var segmentFilename = Path.GetFileName(segmentPath);
|
var segmentFilename = Path.GetFileName(segmentPath);
|
||||||
|
@ -441,7 +441,7 @@ namespace MediaBrowser.Api.Playback.Hls
|
||||||
{
|
{
|
||||||
if (FileSystem.FileExists(segmentPath))
|
if (FileSystem.FileExists(segmentPath))
|
||||||
{
|
{
|
||||||
return GetSegmentResult(state, segmentPath, segmentIndex, transcodingJob);
|
return await GetSegmentResult(state, segmentPath, segmentIndex, transcodingJob).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
//break;
|
//break;
|
||||||
}
|
}
|
||||||
|
@ -457,10 +457,10 @@ namespace MediaBrowser.Api.Playback.Hls
|
||||||
}
|
}
|
||||||
|
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
return GetSegmentResult(state, segmentPath, segmentIndex, transcodingJob);
|
return await GetSegmentResult(state, segmentPath, segmentIndex, transcodingJob).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private object GetSegmentResult(StreamState state, string segmentPath, int index, TranscodingJob transcodingJob)
|
private Task<object> GetSegmentResult(StreamState state, string segmentPath, int index, TranscodingJob transcodingJob)
|
||||||
{
|
{
|
||||||
var segmentEndingPositionTicks = GetEndPositionTicks(state, index);
|
var segmentEndingPositionTicks = GetEndPositionTicks(state, index);
|
||||||
|
|
||||||
|
@ -476,7 +476,7 @@ namespace MediaBrowser.Api.Playback.Hls
|
||||||
ApiEntryPoint.Instance.OnTranscodeEndRequest(transcodingJob);
|
ApiEntryPoint.Instance.OnTranscodeEndRequest(transcodingJob);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).Result;
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<object> GetMasterPlaylistInternal(StreamRequest request, string method)
|
private async Task<object> GetMasterPlaylistInternal(StreamRequest request, string method)
|
||||||
|
|
|
@ -124,13 +124,13 @@ namespace MediaBrowser.Api.Playback.Hls
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="request">The request.</param>
|
/// <param name="request">The request.</param>
|
||||||
/// <returns>System.Object.</returns>
|
/// <returns>System.Object.</returns>
|
||||||
public object Get(GetHlsAudioSegmentLegacy request)
|
public Task<object> Get(GetHlsAudioSegmentLegacy request)
|
||||||
{
|
{
|
||||||
// TODO: Deprecate with new iOS app
|
// TODO: Deprecate with new iOS app
|
||||||
var file = request.SegmentId + Path.GetExtension(Request.PathInfo);
|
var file = request.SegmentId + Path.GetExtension(Request.PathInfo);
|
||||||
file = Path.Combine(_appPaths.TranscodingTempPath, file);
|
file = Path.Combine(_appPaths.TranscodingTempPath, file);
|
||||||
|
|
||||||
return ResultFactory.GetStaticFileResult(Request, file, FileShareMode.ReadWrite).Result;
|
return ResultFactory.GetStaticFileResult(Request, file, FileShareMode.ReadWrite);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Task<object> GetFileResult(string path, string playlistPath)
|
private Task<object> GetFileResult(string path, string playlistPath)
|
||||||
|
|
|
@ -146,14 +146,14 @@ namespace MediaBrowser.Api.Social
|
||||||
{
|
{
|
||||||
if (image.IsLocalFile)
|
if (image.IsLocalFile)
|
||||||
{
|
{
|
||||||
return _resultFactory.GetStaticFileResult(Request, image.Path);
|
return await _resultFactory.GetStaticFileResult(Request, image.Path).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Don't fail the request over this
|
// Don't fail the request over this
|
||||||
var updatedImage = await _libraryManager.ConvertImageToLocal(item, image, 0).ConfigureAwait(false);
|
var updatedImage = await _libraryManager.ConvertImageToLocal(item, image, 0).ConfigureAwait(false);
|
||||||
return _resultFactory.GetStaticFileResult(Request, updatedImage.Path);
|
return await _resultFactory.GetStaticFileResult(Request, updatedImage.Path).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
|
|
@ -566,18 +566,35 @@ namespace MediaBrowser.Controller.Entities
|
||||||
|
|
||||||
private async Task<QueryResult<BaseItem>> GetMovieGenres(Folder parent, User user, InternalItemsQuery query)
|
private async Task<QueryResult<BaseItem>> GetMovieGenres(Folder parent, User user, InternalItemsQuery query)
|
||||||
{
|
{
|
||||||
var result = _libraryManager.GetGenres(new InternalItemsQuery(user)
|
var tasks = parent.QueryRecursive(new InternalItemsQuery(user)
|
||||||
{
|
{
|
||||||
AncestorIds = new[] { parent.Id.ToString("N") },
|
IncludeItemTypes = new[] { typeof(Movie).Name },
|
||||||
StartIndex = query.StartIndex,
|
Recursive = true,
|
||||||
Limit = query.Limit
|
EnableTotalRecordCount = false
|
||||||
});
|
|
||||||
|
|
||||||
return new QueryResult<BaseItem>
|
}).Items
|
||||||
|
.SelectMany(i => i.Genres)
|
||||||
|
.DistinctNames()
|
||||||
|
.Select(i =>
|
||||||
{
|
{
|
||||||
TotalRecordCount = result.TotalRecordCount,
|
try
|
||||||
Items = result.Items.Select(i => i.Item1).ToArray()
|
{
|
||||||
};
|
return _libraryManager.GetGenre(i);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
// Full exception logged at lower levels
|
||||||
|
_logger.Error("Error getting genre");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
.Where(i => i != null)
|
||||||
|
.Select(i => GetUserView(i.Name, SpecialFolder.MovieGenre, i.SortName, parent));
|
||||||
|
|
||||||
|
var genres = await Task.WhenAll(tasks).ConfigureAwait(false);
|
||||||
|
|
||||||
|
return GetResult(genres, parent, query);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<QueryResult<BaseItem>> GetMovieGenreItems(Folder queryParent, Folder displayParent, User user, InternalItemsQuery query)
|
private async Task<QueryResult<BaseItem>> GetMovieGenreItems(Folder queryParent, Folder displayParent, User user, InternalItemsQuery query)
|
||||||
|
@ -692,18 +709,35 @@ namespace MediaBrowser.Controller.Entities
|
||||||
|
|
||||||
private async Task<QueryResult<BaseItem>> GetTvGenres(Folder parent, User user, InternalItemsQuery query)
|
private async Task<QueryResult<BaseItem>> GetTvGenres(Folder parent, User user, InternalItemsQuery query)
|
||||||
{
|
{
|
||||||
var result = _libraryManager.GetGenres(new InternalItemsQuery(user)
|
var tasks = parent.QueryRecursive(new InternalItemsQuery(user)
|
||||||
{
|
{
|
||||||
AncestorIds = new[] { parent.Id.ToString("N") },
|
IncludeItemTypes = new[] { typeof(Series).Name },
|
||||||
StartIndex = query.StartIndex,
|
Recursive = true,
|
||||||
Limit = query.Limit
|
EnableTotalRecordCount = false
|
||||||
});
|
|
||||||
|
|
||||||
return new QueryResult<BaseItem>
|
}).Items
|
||||||
|
.SelectMany(i => i.Genres)
|
||||||
|
.DistinctNames()
|
||||||
|
.Select(i =>
|
||||||
{
|
{
|
||||||
TotalRecordCount = result.TotalRecordCount,
|
try
|
||||||
Items = result.Items.Select(i => i.Item1).ToArray()
|
{
|
||||||
};
|
return _libraryManager.GetGenre(i);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
// Full exception logged at lower levels
|
||||||
|
_logger.Error("Error getting genre");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
.Where(i => i != null)
|
||||||
|
.Select(i => GetUserView(i.Name, SpecialFolder.TvGenre, i.SortName, parent));
|
||||||
|
|
||||||
|
var genres = await Task.WhenAll(tasks).ConfigureAwait(false);
|
||||||
|
|
||||||
|
return GetResult(genres, parent, query);
|
||||||
}
|
}
|
||||||
|
|
||||||
private QueryResult<BaseItem> GetTvGenreItems(Folder queryParent, Folder displayParent, User user, InternalItemsQuery query)
|
private QueryResult<BaseItem> GetTvGenreItems(Folder queryParent, Folder displayParent, User user, InternalItemsQuery query)
|
||||||
|
|
|
@ -196,7 +196,9 @@ namespace MediaBrowser.Server.Implementations.HttpServer
|
||||||
return new WebSocketSharpListener(_logger, cert, _memoryStreamProvider, _textEncoding, _networkManager, _socketFactory, _cryptoProvider, new StreamFactory(), enableDualMode, GetRequest);
|
return new WebSocketSharpListener(_logger, cert, _memoryStreamProvider, _textEncoding, _networkManager, _socketFactory, _cryptoProvider, new StreamFactory(), enableDualMode, GetRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ICertificate GetCert(string certificateLocation)
|
public ICertificate GetCert(string certificateLocation)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
X509Certificate2 localCert = new X509Certificate2(certificateLocation);
|
X509Certificate2 localCert = new X509Certificate2(certificateLocation);
|
||||||
//localCert.PrivateKey = PrivateKey.CreateFromFile(pvk_file).RSA;
|
//localCert.PrivateKey = PrivateKey.CreateFromFile(pvk_file).RSA;
|
||||||
|
@ -208,6 +210,12 @@ namespace MediaBrowser.Server.Implementations.HttpServer
|
||||||
|
|
||||||
return new Certificate(localCert);
|
return new Certificate(localCert);
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logger.ErrorException("Error loading cert from {0}", ex, certificateLocation);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private IHttpRequest GetRequest(HttpListenerContext httpContext)
|
private IHttpRequest GetRequest(HttpListenerContext httpContext)
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<PlatformTarget>x86</PlatformTarget>
|
<PlatformTarget>x86</PlatformTarget>
|
||||||
<Externalconsole>true</Externalconsole>
|
<Externalconsole>true</Externalconsole>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||||
<DebugType>full</DebugType>
|
<DebugType>full</DebugType>
|
||||||
|
@ -35,7 +35,7 @@
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
<Externalconsole>true</Externalconsole>
|
<Externalconsole>true</Externalconsole>
|
||||||
<Prefer32Bit>false</Prefer32Bit>
|
<Prefer32Bit>false</Prefer32Bit>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
<Optimize>false</Optimize>
|
<Optimize>false</Optimize>
|
||||||
|
@ -55,7 +55,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release Mono|x86'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release Mono|x86'">
|
||||||
<Prefer32Bit>false</Prefer32Bit>
|
<Prefer32Bit>false</Prefer32Bit>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Emby.Common.Implementations">
|
<Reference Include="Emby.Common.Implementations">
|
||||||
|
|
|
@ -1037,7 +1037,7 @@ namespace MediaBrowser.Server.Startup.Common
|
||||||
|
|
||||||
// Generate self-signed cert
|
// Generate self-signed cert
|
||||||
var certHost = GetHostnameFromExternalDns(ServerConfigurationManager.Configuration.WanDdns);
|
var certHost = GetHostnameFromExternalDns(ServerConfigurationManager.Configuration.WanDdns);
|
||||||
var certPath = Path.Combine(ServerConfigurationManager.ApplicationPaths.ProgramDataPath, "ssl", "cert_" + certHost.GetMD5().ToString("N") + ".pfx");
|
var certPath = Path.Combine(ServerConfigurationManager.ApplicationPaths.ProgramDataPath, "ssl", "cert_" + (certHost + "1").GetMD5().ToString("N") + ".pfx");
|
||||||
|
|
||||||
if (generateCertificate)
|
if (generateCertificate)
|
||||||
{
|
{
|
||||||
|
|
|
@ -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.688</version>
|
<version>3.0.689</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>
|
||||||
|
|
|
@ -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.688</version>
|
<version>3.0.689</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.688" />
|
<dependency id="MediaBrowser.Common" version="3.0.689" />
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</metadata>
|
</metadata>
|
||||||
<files>
|
<files>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user