Skip to content

Commit

Permalink
resolve mono build failure
Browse files Browse the repository at this point in the history
  • Loading branch information
LukePulverenti committed Nov 10, 2016
1 parent 0f5358f commit be2371c
Show file tree
Hide file tree
Showing 11 changed files with 79 additions and 43 deletions.
5 changes: 3 additions & 2 deletions MediaBrowser.Api/Images/ImageByNameService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using MediaBrowser.Common.IO;
using MediaBrowser.Controller.IO;
using MediaBrowser.Model.IO;
Expand Down Expand Up @@ -179,7 +180,7 @@ private string GetThemeName(string path, string rootImagePath)
/// </summary>
/// <param name="request">The request.</param>
/// <returns>System.Object.</returns>
public object Get(GetGeneralImage request)
public Task<object> Get(GetGeneralImage request)
{
var filename = string.Equals(request.Type, "primary", StringComparison.OrdinalIgnoreCase)
? "folder"
Expand Down Expand Up @@ -238,7 +239,7 @@ public object Get(GetRatingImage request)
/// </summary>
/// <param name="request">The request.</param>
/// <returns>System.Object.</returns>
public object Get(GetMediaInfoImage request)
public Task<object> Get(GetMediaInfoImage request)
{
var themeFolder = Path.Combine(_appPaths.MediaInfoImagesPath, request.Theme);

Expand Down
10 changes: 5 additions & 5 deletions MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ private async Task<object> GetSegmentResult(StreamState state, string playlistPa
// If all transcoding has completed, just return immediately
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);
Expand All @@ -441,7 +441,7 @@ private async Task<object> GetSegmentResult(StreamState state, string playlistPa
{
if (FileSystem.FileExists(segmentPath))
{
return GetSegmentResult(state, segmentPath, segmentIndex, transcodingJob);
return await GetSegmentResult(state, segmentPath, segmentIndex, transcodingJob).ConfigureAwait(false);
}
//break;
}
Expand All @@ -457,10 +457,10 @@ private async Task<object> GetSegmentResult(StreamState state, string playlistPa
}

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);

Expand All @@ -476,7 +476,7 @@ private object GetSegmentResult(StreamState state, string segmentPath, int index
ApiEntryPoint.Instance.OnTranscodeEndRequest(transcodingJob);
}
}
}).Result;
});
}

private async Task<object> GetMasterPlaylistInternal(StreamRequest request, string method)
Expand Down
4 changes: 2 additions & 2 deletions MediaBrowser.Api/Playback/Hls/HlsSegmentService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,13 @@ public Task<object> Get(GetHlsVideoSegmentLegacy request)
/// </summary>
/// <param name="request">The request.</param>
/// <returns>System.Object.</returns>
public object Get(GetHlsAudioSegmentLegacy request)
public Task<object> Get(GetHlsAudioSegmentLegacy request)
{
// TODO: Deprecate with new iOS app
var file = request.SegmentId + Path.GetExtension(Request.PathInfo);
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)
Expand Down
4 changes: 2 additions & 2 deletions MediaBrowser.Api/Social/SharingService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,14 @@ public async Task<object> Get(GetShareImage request)
{
if (image.IsLocalFile)
{
return _resultFactory.GetStaticFileResult(Request, image.Path);
return await _resultFactory.GetStaticFileResult(Request, image.Path).ConfigureAwait(false);
}

try
{
// Don't fail the request over this
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
{
Expand Down
74 changes: 54 additions & 20 deletions MediaBrowser.Controller/Entities/UserViewBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -566,18 +566,35 @@ private QueryResult<BaseItem> ConvertToResult(IEnumerable<BaseItem> items)

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") },
StartIndex = query.StartIndex,
Limit = query.Limit
});
IncludeItemTypes = new[] { typeof(Movie).Name },
Recursive = true,
EnableTotalRecordCount = false

return new QueryResult<BaseItem>
{
TotalRecordCount = result.TotalRecordCount,
Items = result.Items.Select(i => i.Item1).ToArray()
};
}).Items
.SelectMany(i => i.Genres)
.DistinctNames()
.Select(i =>
{
try
{
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)
Expand Down Expand Up @@ -692,18 +709,35 @@ private QueryResult<BaseItem> GetTvSeries(Folder parent, User user, InternalItem

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") },
StartIndex = query.StartIndex,
Limit = query.Limit
});
IncludeItemTypes = new[] { typeof(Series).Name },
Recursive = true,
EnableTotalRecordCount = false

return new QueryResult<BaseItem>
{
TotalRecordCount = result.TotalRecordCount,
Items = result.Items.Select(i => i.Item1).ToArray()
};
}).Items
.SelectMany(i => i.Genres)
.DistinctNames()
.Select(i =>
{
try
{
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)
Expand Down
6 changes: 3 additions & 3 deletions MediaBrowser.Server.Mono/MediaBrowser.Server.Mono.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
<Externalconsole>true</Externalconsole>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<DebugType>full</DebugType>
Expand All @@ -35,7 +35,7 @@
<PlatformTarget>AnyCPU</PlatformTarget>
<Externalconsole>true</Externalconsole>
<Prefer32Bit>false</Prefer32Bit>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<Optimize>false</Optimize>
Expand All @@ -55,7 +55,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release Mono|x86'">
<Prefer32Bit>false</Prefer32Bit>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<Reference Include="Emby.Common.Implementations">
Expand Down
2 changes: 1 addition & 1 deletion MediaBrowser.Server.Startup.Common/ApplicationHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1037,7 +1037,7 @@ private string GetCertificatePath(bool generateCertificate)

// Generate self-signed cert
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)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -983,7 +983,7 @@
});
};

self.supportsDirectPlay = function (mediaSource) {
self.supportsDirectPlay = function (mediaSource, itemType) {

return new Promise(function (resolve, reject) {
if (mediaSource.SupportsDirectPlay) {
Expand All @@ -996,6 +996,7 @@
}
else {
var val = mediaSource.Path.toLowerCase().replace('https:', 'http').indexOf(ApiClient.serverAddress().toLowerCase().replace('https:', 'http').substring(0, 14)) == 0;
//resolve(val || itemType !== 'TvChannel');
resolve(val);
}
}
Expand Down
8 changes: 4 additions & 4 deletions MediaBrowser.WebDashboard/dashboard-ui/scripts/mediaplayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -491,10 +491,10 @@ define(['appSettings', 'userSettings', 'appStorage', 'datetime', 'browser'], fun
return Promise.resolve();
};

function getOptimalMediaSource(mediaType, versions) {
function getOptimalMediaSource(mediaType, itemType, versions) {

var promises = versions.map(function (v) {
return MediaController.supportsDirectPlay(v);
return MediaController.supportsDirectPlay(v, itemType);
});

return Promise.all(promises).then(function (responses) {
Expand Down Expand Up @@ -730,14 +730,14 @@ define(['appSettings', 'userSettings', 'appStorage', 'datetime', 'browser'], fun

if (validatePlaybackInfoResult(playbackInfoResult)) {

getOptimalMediaSource(item.MediaType, playbackInfoResult.MediaSources).then(function (mediaSource) {
getOptimalMediaSource(item.MediaType, item.Type, playbackInfoResult.MediaSources).then(function (mediaSource) {
if (mediaSource) {

if (mediaSource.RequiresOpening) {

MediaController.getLiveStream(item.Id, playbackInfoResult.PlaySessionId, deviceProfile, startPosition, mediaSource, null, null).then(function (openLiveStreamResult) {

MediaController.supportsDirectPlay(openLiveStreamResult.MediaSource).then(function (result) {
MediaController.supportsDirectPlay(openLiveStreamResult.MediaSource, item.Type).then(function (result) {

openLiveStreamResult.MediaSource.enableDirectPlay = result;
callback(openLiveStreamResult.MediaSource);
Expand Down
2 changes: 1 addition & 1 deletion Nuget/MediaBrowser.Common.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>MediaBrowser.Common</id>
<version>3.0.688</version>
<version>3.0.689</version>
<title>Emby.Common</title>
<authors>Emby Team</authors>
<owners>ebr,Luke,scottisafool</owners>
Expand Down
4 changes: 2 additions & 2 deletions Nuget/MediaBrowser.Server.Core.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>MediaBrowser.Server.Core</id>
<version>3.0.688</version>
<version>3.0.689</version>
<title>Emby.Server.Core</title>
<authors>Emby Team</authors>
<owners>ebr,Luke,scottisafool</owners>
Expand All @@ -12,7 +12,7 @@
<description>Contains core components required to build plugins for Emby Server.</description>
<copyright>Copyright © Emby 2013</copyright>
<dependencies>
<dependency id="MediaBrowser.Common" version="3.0.688" />
<dependency id="MediaBrowser.Common" version="3.0.689" />
</dependencies>
</metadata>
<files>
Expand Down

0 comments on commit be2371c

Please sign in to comment.