mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-07-08 23:00:51 +02:00
switch to ExcludeArtistIds
This commit is contained in:
parent
df5cfc0c25
commit
7475722ecf
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue