mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
update db querying
This commit is contained in:
parent
dfafa98da3
commit
23fe6dc4be
@ -350,6 +350,18 @@ namespace MediaBrowser.Api.Reports
|
|||||||
query.MaxParentalRating = _localization.GetRatingLevel(request.MinOfficialRating);
|
query.MaxParentalRating = _localization.GetRatingLevel(request.MinOfficialRating);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Artists
|
||||||
|
if (!string.IsNullOrEmpty(request.Artists))
|
||||||
|
{
|
||||||
|
query.ArtistNames = request.Artists.Split('|');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Albums
|
||||||
|
if (!string.IsNullOrEmpty(request.Albums))
|
||||||
|
{
|
||||||
|
query.AlbumNames = request.Albums.Split('|');
|
||||||
|
}
|
||||||
|
|
||||||
if (request.HasQueryLimit == false)
|
if (request.HasQueryLimit == false)
|
||||||
{
|
{
|
||||||
query.StartIndex = null;
|
query.StartIndex = null;
|
||||||
@ -378,57 +390,6 @@ namespace MediaBrowser.Api.Reports
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Artists
|
|
||||||
if (!string.IsNullOrEmpty(request.Artists))
|
|
||||||
{
|
|
||||||
var artists = request.Artists.Split('|');
|
|
||||||
|
|
||||||
var audio = i as IHasArtist;
|
|
||||||
|
|
||||||
if (!(audio != null && artists.Any(audio.HasAnyArtist)))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Albums
|
|
||||||
if (!string.IsNullOrEmpty(request.Albums))
|
|
||||||
{
|
|
||||||
var albums = request.Albums.Split('|');
|
|
||||||
|
|
||||||
var audio = i as Audio;
|
|
||||||
|
|
||||||
if (audio != null)
|
|
||||||
{
|
|
||||||
if (!albums.Any(a => string.Equals(a, audio.Album, StringComparison.OrdinalIgnoreCase)))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var album = i as MusicAlbum;
|
|
||||||
|
|
||||||
if (album != null)
|
|
||||||
{
|
|
||||||
if (!albums.Any(a => string.Equals(a, album.Name, StringComparison.OrdinalIgnoreCase)))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var musicVideo = i as MusicVideo;
|
|
||||||
|
|
||||||
if (musicVideo != null)
|
|
||||||
{
|
|
||||||
if (!albums.Any(a => string.Equals(a, musicVideo.Album, StringComparison.OrdinalIgnoreCase)))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -323,6 +323,18 @@ namespace MediaBrowser.Api.UserLibrary
|
|||||||
query.MaxParentalRating = _localization.GetRatingLevel(request.MinOfficialRating);
|
query.MaxParentalRating = _localization.GetRatingLevel(request.MinOfficialRating);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Artists
|
||||||
|
if (!string.IsNullOrEmpty(request.Artists))
|
||||||
|
{
|
||||||
|
query.ArtistNames = request.Artists.Split('|');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Albums
|
||||||
|
if (!string.IsNullOrEmpty(request.Albums))
|
||||||
|
{
|
||||||
|
query.AlbumNames = request.Albums.Split('|');
|
||||||
|
}
|
||||||
|
|
||||||
return query;
|
return query;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -345,57 +357,6 @@ namespace MediaBrowser.Api.UserLibrary
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Artists
|
|
||||||
if (!string.IsNullOrEmpty(request.Artists))
|
|
||||||
{
|
|
||||||
var artists = request.Artists.Split('|');
|
|
||||||
|
|
||||||
var audio = i as IHasArtist;
|
|
||||||
|
|
||||||
if (!(audio != null && artists.Any(audio.HasAnyArtist)))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Albums
|
|
||||||
if (!string.IsNullOrEmpty(request.Albums))
|
|
||||||
{
|
|
||||||
var albums = request.Albums.Split('|');
|
|
||||||
|
|
||||||
var audio = i as Audio;
|
|
||||||
|
|
||||||
if (audio != null)
|
|
||||||
{
|
|
||||||
if (!albums.Any(a => string.Equals(a, audio.Album, StringComparison.OrdinalIgnoreCase)))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var album = i as MusicAlbum;
|
|
||||||
|
|
||||||
if (album != null)
|
|
||||||
{
|
|
||||||
if (!albums.Any(a => string.Equals(a, album.Name, StringComparison.OrdinalIgnoreCase)))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var musicVideo = i as MusicVideo;
|
|
||||||
|
|
||||||
if (musicVideo != null)
|
|
||||||
{
|
|
||||||
if (!albums.Any(a => string.Equals(a, musicVideo.Album, StringComparison.OrdinalIgnoreCase)))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1175,6 +1175,18 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (query.AlbumNames.Length > 0)
|
||||||
|
{
|
||||||
|
Logger.Debug("Query requires post-filtering due to AlbumNames");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (query.ArtistNames.Length > 0)
|
||||||
|
{
|
||||||
|
Logger.Debug("Query requires post-filtering due to ArtistNames");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,8 +128,14 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
public SeriesStatus[] SeriesStatuses { get; set; }
|
public SeriesStatus[] SeriesStatuses { get; set; }
|
||||||
public string AlbumArtistStartsWithOrGreater { get; set; }
|
public string AlbumArtistStartsWithOrGreater { get; set; }
|
||||||
|
|
||||||
|
public string[] AlbumNames { get; set; }
|
||||||
|
public string[] ArtistNames { get; set; }
|
||||||
|
|
||||||
public InternalItemsQuery()
|
public InternalItemsQuery()
|
||||||
{
|
{
|
||||||
|
AlbumNames = new string[] { };
|
||||||
|
ArtistNames = new string[] { };
|
||||||
|
|
||||||
BlockUnratedItems = new UnratedItem[] { };
|
BlockUnratedItems = new UnratedItem[] { };
|
||||||
Tags = new string[] { };
|
Tags = new string[] { };
|
||||||
OfficialRatings = new string[] { };
|
OfficialRatings = new string[] { };
|
||||||
|
@ -1768,6 +1768,53 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Artists
|
||||||
|
if (query.ArtistNames.Length > 0)
|
||||||
|
{
|
||||||
|
var audio = item as IHasArtist;
|
||||||
|
|
||||||
|
if (!(audio != null && query.ArtistNames.Any(audio.HasAnyArtist)))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Albums
|
||||||
|
if (query.AlbumNames.Length > 0)
|
||||||
|
{
|
||||||
|
var audio = item as Audio.Audio;
|
||||||
|
|
||||||
|
if (audio != null)
|
||||||
|
{
|
||||||
|
if (!query.AlbumNames.Any(a => string.Equals(a, audio.Album, StringComparison.OrdinalIgnoreCase)))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var album = item as MusicAlbum;
|
||||||
|
|
||||||
|
if (album != null)
|
||||||
|
{
|
||||||
|
if (!query.AlbumNames.Any(a => string.Equals(a, album.Name, StringComparison.OrdinalIgnoreCase)))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var musicVideo = item as MusicVideo;
|
||||||
|
|
||||||
|
if (musicVideo != null)
|
||||||
|
{
|
||||||
|
if (!query.AlbumNames.Any(a => string.Equals(a, musicVideo.Album, StringComparison.OrdinalIgnoreCase)))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user