Merge pull request #1970 from MediaBrowser/dev

Dev
This commit is contained in:
Luke 2016-07-23 02:18:37 -04:00 committed by GitHub
commit 7d0a645608
12 changed files with 69 additions and 20 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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[] { };

View File

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

View File

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

View File

@ -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);
//}
}
}

View File

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