Pārlūkot izejas kodu

fix skiasharp reference

Luke Pulverenti 7 gadi atpakaļ
vecāks
revīzija
9d78482358

+ 7 - 4
Emby.Server.Implementations/HttpServer/HttpResultFactory.cs

@@ -424,11 +424,14 @@ namespace Emby.Server.Implementations.HttpServer
 
 
             options.ResponseHeaders = options.ResponseHeaders ?? new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
             options.ResponseHeaders = options.ResponseHeaders ?? new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
 
 
-            // Quotes are valid in linux. They'll possibly cause issues here
-            var filename = (Path.GetFileName(path) ?? string.Empty).Replace("\"", string.Empty);
-            if (!string.IsNullOrWhiteSpace(filename))
+            if (!options.ResponseHeaders.ContainsKey("Content-Disposition"))
             {
             {
-                options.ResponseHeaders["Content-Disposition"] = "inline; filename=\"" + filename + "\"";
+                // Quotes are valid in linux. They'll possibly cause issues here
+                var filename = (Path.GetFileName(path) ?? string.Empty).Replace("\"", string.Empty);
+                if (!string.IsNullOrWhiteSpace(filename))
+                {
+                    options.ResponseHeaders["Content-Disposition"] = "inline; filename=\"" + filename + "\"";
+                }
             }
             }
 
 
             return GetStaticResult(requestContext, options);
             return GetStaticResult(requestContext, options);

+ 1 - 1
Emby.Server.Implementations/Services/ServiceExec.cs

@@ -58,7 +58,7 @@ namespace Emby.Server.Implementations.Services
 
 
     internal static class ServiceExecGeneral
     internal static class ServiceExecGeneral
     {
     {
-        public static Dictionary<string, ServiceMethod> execMap = new Dictionary<string, ServiceMethod>();
+        private static Dictionary<string, ServiceMethod> execMap = new Dictionary<string, ServiceMethod>();
 
 
         public static void CreateServiceRunnersFor(Type requestType, List<ServiceMethod> actions)
         public static void CreateServiceRunnersFor(Type requestType, List<ServiceMethod> actions)
         {
         {

+ 10 - 1
MediaBrowser.Api/Library/LibraryService.cs

@@ -518,9 +518,18 @@ namespace MediaBrowser.Api.Library
                 LogDownload(item, user, auth);
                 LogDownload(item, user, auth);
             }
             }
 
 
+            var path = item.Path;
+
+            // Quotes are valid in linux. They'll possibly cause issues here
+            var filename = (Path.GetFileName(path) ?? string.Empty).Replace("\"", string.Empty);
+            if (!string.IsNullOrWhiteSpace(filename))
+            {
+                headers["Content-Disposition"] = "attachment; filename=\"" + filename + "\"";
+            }
+
             return ResultFactory.GetStaticFileResult(Request, new StaticFileResultOptions
             return ResultFactory.GetStaticFileResult(Request, new StaticFileResultOptions
             {
             {
-                Path = item.Path,
+                Path = path,
                 ResponseHeaders = headers
                 ResponseHeaders = headers
             });
             });
         }
         }

+ 34 - 27
MediaBrowser.Controller/Entities/BaseItem.cs

@@ -186,21 +186,6 @@ namespace MediaBrowser.Controller.Entities
             }
             }
         }
         }
 
 
-        [IgnoreDataMember]
-        public string SlugName
-        {
-            get
-            {
-                var name = Name;
-                if (string.IsNullOrWhiteSpace(name))
-                {
-                    return string.Empty;
-                }
-
-                return SlugReplaceChars.Aggregate(name, (current, c) => current.Replace(c, SlugChar));
-            }
-        }
-
         [IgnoreDataMember]
         [IgnoreDataMember]
         public bool IsUnaired
         public bool IsUnaired
         {
         {
@@ -664,27 +649,34 @@ namespace MediaBrowser.Controller.Entities
             }
             }
 
 
             var sortable = Name.Trim().ToLower();
             var sortable = Name.Trim().ToLower();
-            sortable = ConfigurationManager.Configuration.SortRemoveCharacters.Aggregate(sortable, (current, search) => current.Replace(search.ToLower(), string.Empty));
 
 
-            sortable = ConfigurationManager.Configuration.SortReplaceCharacters.Aggregate(sortable, (current, search) => current.Replace(search.ToLower(), " "));
+            foreach (var removeChar in ConfigurationManager.Configuration.SortRemoveCharacters)
+            {
+                sortable = sortable.Replace(removeChar, string.Empty);
+            }
+
+            foreach (var replaceChar in ConfigurationManager.Configuration.SortReplaceCharacters)
+            {
+                sortable = sortable.Replace(replaceChar, " ");
+            }
 
 
             foreach (var search in ConfigurationManager.Configuration.SortRemoveWords)
             foreach (var search in ConfigurationManager.Configuration.SortRemoveWords)
             {
             {
-                var searchLower = search.ToLower();
                 // Remove from beginning if a space follows
                 // Remove from beginning if a space follows
-                if (sortable.StartsWith(searchLower + " "))
+                if (sortable.StartsWith(search + " "))
                 {
                 {
-                    sortable = sortable.Remove(0, searchLower.Length + 1);
+                    sortable = sortable.Remove(0, search.Length + 1);
                 }
                 }
                 // Remove from middle if surrounded by spaces
                 // Remove from middle if surrounded by spaces
-                sortable = sortable.Replace(" " + searchLower + " ", " ");
+                sortable = sortable.Replace(" " + search + " ", " ");
 
 
                 // Remove from end if followed by a space
                 // Remove from end if followed by a space
-                if (sortable.EndsWith(" " + searchLower))
+                if (sortable.EndsWith(" " + search))
                 {
                 {
-                    sortable = sortable.Remove(sortable.Length - (searchLower.Length + 1));
+                    sortable = sortable.Remove(sortable.Length - (search.Length + 1));
                 }
                 }
             }
             }
+
             return ModifySortChunks(sortable);
             return ModifySortChunks(sortable);
         }
         }
 
 
@@ -771,7 +763,15 @@ namespace MediaBrowser.Controller.Entities
         public T FindParent<T>()
         public T FindParent<T>()
             where T : Folder
             where T : Folder
         {
         {
-            return GetParents().OfType<T>().FirstOrDefault();
+            foreach (var parent in GetParents())
+            {
+                var item = parent as T;
+                if (item != null)
+                {
+                    return item;
+                }
+            }
+            return null;
         }
         }
 
 
         [IgnoreDataMember]
         [IgnoreDataMember]
@@ -2140,8 +2140,8 @@ namespace MediaBrowser.Controller.Entities
             }
             }
 
 
             var filename = System.IO.Path.GetFileNameWithoutExtension(Path);
             var filename = System.IO.Path.GetFileNameWithoutExtension(Path);
-            var extensions = new[] { ".nfo", ".xml", ".srt" }.ToList();
-            extensions.AddRange(SupportedImageExtensionsList);
+            var extensions = new List<string> { ".nfo", ".xml", ".srt" };
+            extensions.AddRange(SupportedImageExtensions);
 
 
             return FileSystem.GetFiles(FileSystem.GetDirectoryName(Path), extensions.ToArray(extensions.Count), false, false)
             return FileSystem.GetFiles(FileSystem.GetDirectoryName(Path), extensions.ToArray(extensions.Count), false, false)
                 .Where(i => System.IO.Path.GetFileNameWithoutExtension(i.FullName).StartsWith(filename, StringComparison.OrdinalIgnoreCase))
                 .Where(i => System.IO.Path.GetFileNameWithoutExtension(i.FullName).StartsWith(filename, StringComparison.OrdinalIgnoreCase))
@@ -2392,7 +2392,14 @@ namespace MediaBrowser.Controller.Entities
                 return this;
                 return this;
             }
             }
 
 
-            return GetParents().FirstOrDefault(i => i.IsTopParent);
+            foreach (var parent in GetParents())
+            {
+                if (parent.IsTopParent)
+                {
+                    return parent;
+                }
+            }
+            return null;
         }
         }
 
 
         [IgnoreDataMember]
         [IgnoreDataMember]

+ 0 - 7
MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj

@@ -270,13 +270,6 @@
     <PostBuildEvent>
     <PostBuildEvent>
     </PostBuildEvent>
     </PostBuildEvent>
   </PropertyGroup>
   </PropertyGroup>
-  <Import Project="..\packages\SkiaSharp.1.58.1\build\net45\SkiaSharp.targets" Condition="Exists('..\packages\SkiaSharp.1.58.1\build\net45\SkiaSharp.targets')" />
-  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
-    <PropertyGroup>
-      <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
-    </PropertyGroup>
-    <Error Condition="!Exists('..\packages\SkiaSharp.1.58.1\build\net45\SkiaSharp.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\SkiaSharp.1.58.1\build\net45\SkiaSharp.targets'))" />
-  </Target>
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
        Other similar extension points exist, see Microsoft.Common.targets.
        Other similar extension points exist, see Microsoft.Common.targets.
   <Target Name="BeforeBuild">
   <Target Name="BeforeBuild">