浏览代码

resolve mono build failure

Luke Pulverenti 8 年之前
父节点
当前提交
abb7bb4fd2

+ 3 - 2
MediaBrowser.Api/Images/ImageByNameService.cs

@@ -7,6 +7,7 @@ using System;
 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;
@@ -179,7 +180,7 @@ namespace MediaBrowser.Api.Images
         /// </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"
@@ -238,7 +239,7 @@ namespace MediaBrowser.Api.Images
         /// </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);
 

+ 5 - 5
MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs

@@ -421,7 +421,7 @@ namespace MediaBrowser.Api.Playback.Hls
             // 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);
@@ -441,7 +441,7 @@ namespace MediaBrowser.Api.Playback.Hls
                             {
                                 if (FileSystem.FileExists(segmentPath))
                                 {
-                                    return GetSegmentResult(state, segmentPath, segmentIndex, transcodingJob);
+                                    return await GetSegmentResult(state, segmentPath, segmentIndex, transcodingJob).ConfigureAwait(false);
                                 }
                                 //break;
                             }
@@ -457,10 +457,10 @@ namespace MediaBrowser.Api.Playback.Hls
             }
 
             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);
 
@@ -476,7 +476,7 @@ namespace MediaBrowser.Api.Playback.Hls
                         ApiEntryPoint.Instance.OnTranscodeEndRequest(transcodingJob);
                     }
                 }
-            }).Result;
+            });
         }
 
         private async Task<object> GetMasterPlaylistInternal(StreamRequest request, string method)

+ 2 - 2
MediaBrowser.Api/Playback/Hls/HlsSegmentService.cs

@@ -124,13 +124,13 @@ namespace MediaBrowser.Api.Playback.Hls
         /// </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)

+ 2 - 2
MediaBrowser.Api/Social/SharingService.cs

@@ -146,14 +146,14 @@ namespace MediaBrowser.Api.Social
             {
                 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
                 {

+ 54 - 20
MediaBrowser.Controller/Entities/UserViewBuilder.cs

@@ -566,18 +566,35 @@ namespace MediaBrowser.Controller.Entities
 
         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)
@@ -692,18 +709,35 @@ namespace MediaBrowser.Controller.Entities
 
         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)

+ 3 - 3
MediaBrowser.Server.Mono/MediaBrowser.Server.Mono.csproj

@@ -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>
@@ -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>
@@ -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">

+ 1 - 1
MediaBrowser.Server.Startup.Common/ApplicationHost.cs

@@ -1037,7 +1037,7 @@ namespace MediaBrowser.Server.Startup.Common
 
             // 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)
             {

+ 1 - 1
Nuget/MediaBrowser.Common.nuspec

@@ -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>

+ 2 - 2
Nuget/MediaBrowser.Server.Core.nuspec

@@ -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>
@@ -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>