Merge pull request #1978 from MediaBrowser/beta

Beta
pull/1154/head
Luke 9 years ago committed by GitHub
commit a9fb130b03

@ -246,7 +246,7 @@ namespace Emby.Drawing
var newHeight = Convert.ToInt32(newSize.Height);
_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));
await _imageProcessingSemaphore.WaitAsync().ConfigureAwait(false);
@ -433,7 +433,7 @@ namespace Emby.Drawing
try
{
_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));
await _imageProcessingSemaphore.WaitAsync().ConfigureAwait(false);

@ -90,6 +90,17 @@ namespace MediaBrowser.Api
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>
/// Class EnvironmentService
/// </summary>
@ -108,7 +119,6 @@ namespace MediaBrowser.Api
/// Initializes a new instance of the <see cref="EnvironmentService" /> class.
/// </summary>
/// <param name="networkManager">The network manager.</param>
/// <exception cref="System.ArgumentNullException">networkManager</exception>
public EnvironmentService(INetworkManager networkManager, IFileSystem fileSystem)
{
if (networkManager == null)
@ -120,6 +130,29 @@ namespace MediaBrowser.Api
_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>
/// Gets the specified request.
/// </summary>

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

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

@ -26,7 +26,7 @@ namespace MediaBrowser.Api
[ApiMember(Name = "Id", Description = "Item Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
public string Id { get; set; }
public string ExcludeArtistNames { get; set; }
public string ExcludeArtistIds { get; set; }
}
public class BaseGetSimilarItems : IReturn<ItemsResult>, IHasItemFields
@ -72,10 +72,10 @@ namespace MediaBrowser.Api
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);

@ -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)]
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)]
public string ArtistIds { get; set; }

@ -368,10 +368,10 @@ namespace MediaBrowser.Api.UserLibrary
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

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

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

@ -2883,15 +2883,19 @@ namespace MediaBrowser.Server.Implementations.Persistence
whereClauses.Add(clause);
}
if (query.ExcludeArtistNames.Length > 0)
if (query.ExcludeArtistIds.Length > 0)
{
var clauses = new List<string>();
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()) + ")";
whereClauses.Add(clause);

@ -13,6 +13,7 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using CommonIO;
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Model.Configuration;
namespace MediaBrowser.Server.Implementations.Photos
@ -247,7 +248,7 @@ namespace MediaBrowser.Server.Implementations.Photos
{
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);
}

@ -12,6 +12,8 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using CommonIO;
using MediaBrowser.Controller.Library;
using MediaBrowser.Model.Querying;
namespace MediaBrowser.Server.Implementations.Playlists
{
@ -65,4 +67,36 @@ namespace MediaBrowser.Server.Implementations.Playlists
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);
//}
}
}

@ -125,6 +125,15 @@
<Content Include="dashboard-ui\components\filterdialog\style.css">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</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">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>

Loading…
Cancel
Save