瀏覽代碼

Merge pull request #1978 from MediaBrowser/beta

Beta
Luke 9 年之前
父節點
當前提交
a9fb130b03

+ 2 - 2
Emby.Drawing/ImageProcessor.cs

@@ -246,7 +246,7 @@ namespace Emby.Drawing
                     var newHeight = Convert.ToInt32(newSize.Height);
                     var newHeight = Convert.ToInt32(newSize.Height);
 
 
                     _fileSystem.CreateDirectory(Path.GetDirectoryName(cacheFilePath));
                     _fileSystem.CreateDirectory(Path.GetDirectoryName(cacheFilePath));
-                    var tmpPath = Path.Combine(_appPaths.TempDirectory, Guid.NewGuid().ToString("N"));
+                    var tmpPath = Path.ChangeExtension(Path.Combine(_appPaths.TempDirectory, Guid.NewGuid().ToString("N")), Path.GetExtension(cacheFilePath));
                     _fileSystem.CreateDirectory(Path.GetDirectoryName(tmpPath));
                     _fileSystem.CreateDirectory(Path.GetDirectoryName(tmpPath));
 
 
                     await _imageProcessingSemaphore.WaitAsync().ConfigureAwait(false);
                     await _imageProcessingSemaphore.WaitAsync().ConfigureAwait(false);
@@ -433,7 +433,7 @@ namespace Emby.Drawing
             try
             try
             {
             {
                 _fileSystem.CreateDirectory(Path.GetDirectoryName(croppedImagePath));
                 _fileSystem.CreateDirectory(Path.GetDirectoryName(croppedImagePath));
-                var tmpPath = Path.Combine(_appPaths.TempDirectory, Guid.NewGuid().ToString("N"));
+                var tmpPath = Path.ChangeExtension(Path.Combine(_appPaths.TempDirectory, Guid.NewGuid().ToString("N")), Path.GetExtension(croppedImagePath));
                 _fileSystem.CreateDirectory(Path.GetDirectoryName(tmpPath));
                 _fileSystem.CreateDirectory(Path.GetDirectoryName(tmpPath));
 
 
                 await _imageProcessingSemaphore.WaitAsync().ConfigureAwait(false);
                 await _imageProcessingSemaphore.WaitAsync().ConfigureAwait(false);

+ 34 - 1
MediaBrowser.Api/EnvironmentService.cs

@@ -90,6 +90,17 @@ namespace MediaBrowser.Api
         public string Path { get; set; }
         public string Path { get; set; }
     }
     }
 
 
+    public class DefaultDirectoryBrowserInfo
+    {
+        public string Path { get; set; }
+    }
+
+    [Route("/Environment/DefaultDirectoryBrowser", "GET", Summary = "Gets the parent path of a given path")]
+    public class GetDefaultDirectoryBrowser : IReturn<DefaultDirectoryBrowserInfo>
+    {
+        
+    }
+
     /// <summary>
     /// <summary>
     /// Class EnvironmentService
     /// Class EnvironmentService
     /// </summary>
     /// </summary>
@@ -108,7 +119,6 @@ namespace MediaBrowser.Api
         /// Initializes a new instance of the <see cref="EnvironmentService" /> class.
         /// Initializes a new instance of the <see cref="EnvironmentService" /> class.
         /// </summary>
         /// </summary>
         /// <param name="networkManager">The network manager.</param>
         /// <param name="networkManager">The network manager.</param>
-        /// <exception cref="System.ArgumentNullException">networkManager</exception>
         public EnvironmentService(INetworkManager networkManager, IFileSystem fileSystem)
         public EnvironmentService(INetworkManager networkManager, IFileSystem fileSystem)
         {
         {
             if (networkManager == null)
             if (networkManager == null)
@@ -120,6 +130,29 @@ namespace MediaBrowser.Api
             _fileSystem = fileSystem;
             _fileSystem = fileSystem;
         }
         }
 
 
+        public object Get(GetDefaultDirectoryBrowser request)
+        {
+            var result = new DefaultDirectoryBrowserInfo();
+
+            if (Environment.OSVersion.Platform == PlatformID.Unix)
+            {
+                try
+                {
+                    var qnap = "/share/CACHEDEV1_DATA";
+                    if (Directory.Exists(qnap))
+                    {
+                        result.Path = qnap;
+                    }
+                }
+                catch
+                {
+
+                }
+            }
+
+            return ToOptimizedResult(result);
+        }
+
         /// <summary>
         /// <summary>
         /// Gets the specified request.
         /// Gets the specified request.
         /// </summary>
         /// </summary>

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

@@ -351,7 +351,7 @@ namespace MediaBrowser.Api.Library
                     Id = request.Id,
                     Id = request.Id,
                     Limit = request.Limit,
                     Limit = request.Limit,
                     UserId = request.UserId,
                     UserId = request.UserId,
-                    ExcludeArtistNames = request.ExcludeArtistNames
+                    ExcludeArtistIds = request.ExcludeArtistIds
                 });
                 });
             }
             }
             if (item is MusicArtist)
             if (item is MusicArtist)

+ 4 - 0
MediaBrowser.Api/Playback/StreamState.cs

@@ -80,6 +80,10 @@ namespace MediaBrowser.Api.Playback
                     {
                     {
                         return 10;
                         return 10;
                     }
                     }
+                    if (userAgent.IndexOf("cfnetwork", StringComparison.OrdinalIgnoreCase) != -1)
+                    {
+                        return 10;
+                    }
 
 
                     return 6;
                     return 6;
                 }
                 }

+ 4 - 4
MediaBrowser.Api/SimilarItemsHelper.cs

@@ -26,7 +26,7 @@ namespace MediaBrowser.Api
         [ApiMember(Name = "Id", Description = "Item Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
         [ApiMember(Name = "Id", Description = "Item Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
         public string Id { get; set; }
         public string Id { get; set; }
 
 
-        public string ExcludeArtistNames { get; set; }
+        public string ExcludeArtistIds { get; set; }
     }
     }
 
 
     public class BaseGetSimilarItems : IReturn<ItemsResult>, IHasItemFields
     public class BaseGetSimilarItems : IReturn<ItemsResult>, IHasItemFields
@@ -72,10 +72,10 @@ namespace MediaBrowser.Api
                 Recursive = true
                 Recursive = true
             };
             };
 
 
-            // ExcludeArtistNames
-            if (!string.IsNullOrEmpty(request.ExcludeArtistNames))
+            // ExcludeArtistIds
+            if (!string.IsNullOrEmpty(request.ExcludeArtistIds))
             {
             {
-                query.ExcludeArtistNames = request.ExcludeArtistNames.Split('|');
+                query.ExcludeArtistIds = request.ExcludeArtistIds.Split('|');
             }
             }
 
 
             var inputItems = libraryManager.GetItemList(query);
             var inputItems = libraryManager.GetItemList(query);

+ 1 - 1
MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs

@@ -266,7 +266,7 @@ namespace MediaBrowser.Api.UserLibrary
         [ApiMember(Name = "Artists", Description = "Optional. If specified, results will be filtered based on artist. This allows multiple, pipe delimeted.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
         [ApiMember(Name = "Artists", Description = "Optional. If specified, results will be filtered based on artist. This allows multiple, pipe delimeted.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
         public string Artists { get; set; }
         public string Artists { get; set; }
 
 
-        public string ExcludeArtistNames { get; set; }
+        public string ExcludeArtistIds { get; set; }
 
 
         [ApiMember(Name = "ArtistIds", Description = "Optional. If specified, results will be filtered based on artist. This allows multiple, pipe delimeted.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
         [ApiMember(Name = "ArtistIds", Description = "Optional. If specified, results will be filtered based on artist. This allows multiple, pipe delimeted.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
         public string ArtistIds { get; set; }
         public string ArtistIds { get; set; }

+ 3 - 3
MediaBrowser.Api/UserLibrary/ItemsService.cs

@@ -368,10 +368,10 @@ namespace MediaBrowser.Api.UserLibrary
                 query.ArtistNames = request.Artists.Split('|');
                 query.ArtistNames = request.Artists.Split('|');
             }
             }
 
 
-            // ExcludeArtistNames
-            if (!string.IsNullOrEmpty(request.ExcludeArtistNames))
+            // ExcludeArtistIds
+            if (!string.IsNullOrEmpty(request.ExcludeArtistIds))
             {
             {
-                query.ExcludeArtistNames = request.ExcludeArtistNames.Split('|');
+                query.ExcludeArtistIds = request.ExcludeArtistIds.Split('|');
             }
             }
 
 
             // Albums
             // Albums

+ 1 - 1
MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/DeleteCacheFileTask.cs

@@ -71,7 +71,7 @@ namespace MediaBrowser.Common.Implementations.ScheduledTasks.Tasks
 
 
             progress.Report(90);
             progress.Report(90);
 
 
-            minDateModified = DateTime.UtcNow.AddDays(-2);
+            minDateModified = DateTime.UtcNow.AddDays(-1);
 
 
             try
             try
             {
             {

+ 2 - 2
MediaBrowser.Controller/Entities/InternalItemsQuery.cs

@@ -138,7 +138,7 @@ namespace MediaBrowser.Controller.Entities
 
 
         public string[] AlbumNames { get; set; }
         public string[] AlbumNames { get; set; }
         public string[] ArtistNames { get; set; }
         public string[] ArtistNames { get; set; }
-        public string[] ExcludeArtistNames { get; set; }
+        public string[] ExcludeArtistIds { get; set; }
         public string AncestorWithPresentationUniqueKey { get; set; }
         public string AncestorWithPresentationUniqueKey { get; set; }
 
 
         public bool GroupByPresentationUniqueKey { get; set; }
         public bool GroupByPresentationUniqueKey { get; set; }
@@ -154,7 +154,7 @@ namespace MediaBrowser.Controller.Entities
 
 
             AlbumNames = new string[] { };
             AlbumNames = new string[] { };
             ArtistNames = new string[] { };
             ArtistNames = new string[] { };
-            ExcludeArtistNames = new string[] { };
+            ExcludeArtistIds = new string[] { };
             ExcludeProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
             ExcludeProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
 
 
             BlockUnratedItems = new UnratedItem[] { };
             BlockUnratedItems = new UnratedItem[] { };

+ 9 - 5
MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs

@@ -2883,15 +2883,19 @@ namespace MediaBrowser.Server.Implementations.Persistence
                 whereClauses.Add(clause);
                 whereClauses.Add(clause);
             }
             }
 
 
-            if (query.ExcludeArtistNames.Length > 0)
+            if (query.ExcludeArtistIds.Length > 0)
             {
             {
                 var clauses = new List<string>();
                 var clauses = new List<string>();
                 var index = 0;
                 var index = 0;
-                foreach (var artist in query.ExcludeArtistNames)
+                foreach (var artistId in query.ExcludeArtistIds)
                 {
                 {
-                    clauses.Add("@ExcludeArtistName" + index + " not in (select CleanValue from itemvalues where ItemId=Guid and Type <= 1)");
-                    cmd.Parameters.Add(cmd, "@ExcludeArtistName" + index, DbType.String).Value = artist.RemoveDiacritics();
-                    index++;
+                    var artistItem = RetrieveItem(new Guid(artistId));
+                    if (artistItem != null)
+                    {
+                        clauses.Add("@ExcludeArtistName" + index + " not in (select CleanValue from itemvalues where ItemId=Guid and Type <= 1)");
+                        cmd.Parameters.Add(cmd, "@ExcludeArtistName" + index, DbType.String).Value = artistItem.Name.RemoveDiacritics();
+                        index++;
+                    }
                 }
                 }
                 var clause = "(" + string.Join(" AND ", clauses.ToArray()) + ")";
                 var clause = "(" + string.Join(" AND ", clauses.ToArray()) + ")";
                 whereClauses.Add(clause);
                 whereClauses.Add(clause);

+ 2 - 1
MediaBrowser.Server.Implementations/Photos/BaseDynamicImageProvider.cs

@@ -13,6 +13,7 @@ using System.Linq;
 using System.Threading;
 using System.Threading;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
 using CommonIO;
 using CommonIO;
+using MediaBrowser.Controller.Entities.Audio;
 using MediaBrowser.Model.Configuration;
 using MediaBrowser.Model.Configuration;
 
 
 namespace MediaBrowser.Server.Implementations.Photos
 namespace MediaBrowser.Server.Implementations.Photos
@@ -247,7 +248,7 @@ namespace MediaBrowser.Server.Implementations.Photos
                 {
                 {
                     return await CreateSquareCollage(item, itemsWithImages, outputPath).ConfigureAwait(false);
                     return await CreateSquareCollage(item, itemsWithImages, outputPath).ConfigureAwait(false);
                 }
                 }
-                if (item is Playlist)
+                if (item is Playlist || item is MusicGenre)
                 {
                 {
                     return await CreateSquareCollage(item, itemsWithImages, outputPath).ConfigureAwait(false);
                     return await CreateSquareCollage(item, itemsWithImages, outputPath).ConfigureAwait(false);
                 }
                 }

+ 34 - 0
MediaBrowser.Server.Implementations/Playlists/PlaylistImageProvider.cs

@@ -12,6 +12,8 @@ using System.Collections.Generic;
 using System.Linq;
 using System.Linq;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
 using CommonIO;
 using CommonIO;
+using MediaBrowser.Controller.Library;
+using MediaBrowser.Model.Querying;
 
 
 namespace MediaBrowser.Server.Implementations.Playlists
 namespace MediaBrowser.Server.Implementations.Playlists
 {
 {
@@ -65,4 +67,36 @@ namespace MediaBrowser.Server.Implementations.Playlists
             return Task.FromResult(GetFinalItems(items));
             return Task.FromResult(GetFinalItems(items));
         }
         }
     }
     }
+
+    public class MusicGenreImageProvider : BaseDynamicImageProvider<MusicGenre>
+    {
+        private readonly ILibraryManager _libraryManager;
+
+        public MusicGenreImageProvider(IFileSystem fileSystem, IProviderManager providerManager, IApplicationPaths applicationPaths, IImageProcessor imageProcessor, ILibraryManager libraryManager) : base(fileSystem, providerManager, applicationPaths, imageProcessor)
+        {
+            _libraryManager = libraryManager;
+        }
+
+        protected override Task<List<BaseItem>> GetItemsWithImages(IHasImages item)
+        {
+            var items = _libraryManager.GetItemList(new InternalItemsQuery
+            {
+                Genres = new[] { item.Name },
+                IncludeItemTypes = new[] { typeof(MusicAlbum).Name, typeof(MusicVideo).Name, typeof(Audio).Name },
+                SortBy = new[] { ItemSortBy.Random },
+                Limit = 4,
+                Recursive = true,
+                ImageTypes = new[] { ImageType.Primary }
+
+            }).ToList();
+
+            return Task.FromResult(GetFinalItems(items));
+        }
+
+        //protected override Task<string> CreateImage(IHasImages item, List<BaseItem> itemsWithImages, string outputPathWithoutExtension, ImageType imageType, int imageIndex)
+        //{
+        //    return CreateSingleImage(itemsWithImages, outputPathWithoutExtension, ImageType.Primary);
+        //}
+    }
+
 }
 }

+ 9 - 0
MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj

@@ -125,6 +125,15 @@
     <Content Include="dashboard-ui\components\filterdialog\style.css">
     <Content Include="dashboard-ui\components\filterdialog\style.css">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
     </Content>
+    <Content Include="dashboard-ui\components\groupedcards.js">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
+    <Content Include="dashboard-ui\components\guestinviter\connectlink.js">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
+    <Content Include="dashboard-ui\components\guestinviter\connectlink.template.html">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
     <Content Include="dashboard-ui\components\guestinviter\guestinviter.js">
     <Content Include="dashboard-ui\components\guestinviter\guestinviter.js">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
     </Content>