update more from/similar
This commit is contained in:
parent
d286a86e19
commit
df5cfc0c25
|
@ -350,7 +350,8 @@ namespace MediaBrowser.Api.Library
|
||||||
Fields = request.Fields,
|
Fields = request.Fields,
|
||||||
Id = request.Id,
|
Id = request.Id,
|
||||||
Limit = request.Limit,
|
Limit = request.Limit,
|
||||||
UserId = request.UserId
|
UserId = request.UserId,
|
||||||
|
ExcludeArtistNames = request.ExcludeArtistNames
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (item is MusicArtist)
|
if (item is MusicArtist)
|
||||||
|
|
|
@ -25,6 +25,8 @@ namespace MediaBrowser.Api
|
||||||
/// <value>The id.</value>
|
/// <value>The id.</value>
|
||||||
[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 class BaseGetSimilarItems : IReturn<ItemsResult>, IHasItemFields
|
public class BaseGetSimilarItems : IReturn<ItemsResult>, IHasItemFields
|
||||||
|
@ -70,6 +72,12 @@ namespace MediaBrowser.Api
|
||||||
Recursive = true
|
Recursive = true
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// ExcludeArtistNames
|
||||||
|
if (!string.IsNullOrEmpty(request.ExcludeArtistNames))
|
||||||
|
{
|
||||||
|
query.ExcludeArtistNames = request.ExcludeArtistNames.Split('|');
|
||||||
|
}
|
||||||
|
|
||||||
var inputItems = libraryManager.GetItemList(query);
|
var inputItems = libraryManager.GetItemList(query);
|
||||||
|
|
||||||
var items = GetSimilaritems(item, libraryManager, inputItems, getSimilarityScore)
|
var items = GetSimilaritems(item, libraryManager, inputItems, getSimilarityScore)
|
||||||
|
|
|
@ -266,6 +266,8 @@ 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; }
|
||||||
|
|
||||||
[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; }
|
||||||
|
|
||||||
|
|
|
@ -368,6 +368,12 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
query.ArtistNames = request.Artists.Split('|');
|
query.ArtistNames = request.Artists.Split('|');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ExcludeArtistNames
|
||||||
|
if (!string.IsNullOrEmpty(request.ExcludeArtistNames))
|
||||||
|
{
|
||||||
|
query.ExcludeArtistNames = request.ExcludeArtistNames.Split('|');
|
||||||
|
}
|
||||||
|
|
||||||
// Albums
|
// Albums
|
||||||
if (!string.IsNullOrEmpty(request.Albums))
|
if (!string.IsNullOrEmpty(request.Albums))
|
||||||
{
|
{
|
||||||
|
|
|
@ -138,6 +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 AncestorWithPresentationUniqueKey { get; set; }
|
public string AncestorWithPresentationUniqueKey { get; set; }
|
||||||
|
|
||||||
public bool GroupByPresentationUniqueKey { get; set; }
|
public bool GroupByPresentationUniqueKey { get; set; }
|
||||||
|
@ -153,6 +154,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
|
|
||||||
AlbumNames = new string[] { };
|
AlbumNames = new string[] { };
|
||||||
ArtistNames = new string[] { };
|
ArtistNames = new string[] { };
|
||||||
|
ExcludeArtistNames = new string[] { };
|
||||||
ExcludeProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
ExcludeProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
||||||
BlockUnratedItems = new UnratedItem[] { };
|
BlockUnratedItems = new UnratedItem[] { };
|
||||||
|
|
|
@ -2883,6 +2883,20 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||||
whereClauses.Add(clause);
|
whereClauses.Add(clause);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (query.ExcludeArtistNames.Length > 0)
|
||||||
|
{
|
||||||
|
var clauses = new List<string>();
|
||||||
|
var index = 0;
|
||||||
|
foreach (var artist in query.ExcludeArtistNames)
|
||||||
|
{
|
||||||
|
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 clause = "(" + string.Join(" AND ", clauses.ToArray()) + ")";
|
||||||
|
whereClauses.Add(clause);
|
||||||
|
}
|
||||||
|
|
||||||
if (query.GenreIds.Length > 0)
|
if (query.GenreIds.Length > 0)
|
||||||
{
|
{
|
||||||
// Todo: improve without having to do this
|
// Todo: improve without having to do this
|
||||||
|
|
Loading…
Reference in New Issue
Block a user