mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-06-02 21:24:15 -04:00
applied review comments
This commit is contained in:
parent
058a567e00
commit
e20ecfc670
@ -22,10 +22,16 @@ namespace Emby.Server.Implementations.Data;
|
|||||||
public class ItemTypeLookup : IItemTypeLookup
|
public class ItemTypeLookup : IItemTypeLookup
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public IReadOnlyList<string> MusicGenreTypes => BaseItemKindNames.Where(e => e.Key is BaseItemKind.Audio or BaseItemKind.MusicVideo or BaseItemKind.MusicAlbum or BaseItemKind.MusicArtist).Select(e => e.Value).ToImmutableArray();
|
public IReadOnlyList<string> MusicGenreTypes { get; } = [
|
||||||
|
|
||||||
|
typeof(Audio).FullName!,
|
||||||
|
typeof(MusicVideo).FullName!,
|
||||||
|
typeof(MusicAlbum).FullName!,
|
||||||
|
typeof(MusicArtist).FullName!,
|
||||||
|
];
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public IDictionary<BaseItemKind, string> BaseItemKindNames { get; } = new Dictionary<BaseItemKind, string>()
|
public IReadOnlyDictionary<BaseItemKind, string> BaseItemKindNames { get; } = new Dictionary<BaseItemKind, string>()
|
||||||
{
|
{
|
||||||
{ BaseItemKind.AggregateFolder, typeof(AggregateFolder).FullName! },
|
{ BaseItemKind.AggregateFolder, typeof(AggregateFolder).FullName! },
|
||||||
{ BaseItemKind.Audio, typeof(Audio).FullName! },
|
{ BaseItemKind.Audio, typeof(Audio).FullName! },
|
||||||
|
@ -27,14 +27,7 @@ namespace Emby.Server.Implementations.Library
|
|||||||
|
|
||||||
public IReadOnlyList<BaseItem> GetInstantMixFromSong(Audio item, User? user, DtoOptions dtoOptions)
|
public IReadOnlyList<BaseItem> GetInstantMixFromSong(Audio item, User? user, DtoOptions dtoOptions)
|
||||||
{
|
{
|
||||||
var list = new List<BaseItem>
|
return GetInstantMixFromGenres(item.Genres, user, dtoOptions);
|
||||||
{
|
|
||||||
item
|
|
||||||
};
|
|
||||||
|
|
||||||
list.AddRange(GetInstantMixFromGenres(item.Genres, user, dtoOptions));
|
|
||||||
|
|
||||||
return [.. list];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
@ -16,10 +16,11 @@ namespace Jellyfin.Server.Implementations.Item;
|
|||||||
/// Manager for handling people.
|
/// Manager for handling people.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="dbProvider">Efcore Factory.</param>
|
/// <param name="dbProvider">Efcore Factory.</param>
|
||||||
|
/// <param name="itemTypeLookup">Items lookup service.</param>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// Initializes a new instance of the <see cref="PeopleRepository"/> class.
|
/// Initializes a new instance of the <see cref="PeopleRepository"/> class.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public class PeopleRepository(IDbContextFactory<JellyfinDbContext> dbProvider) : IPeopleRepository
|
public class PeopleRepository(IDbContextFactory<JellyfinDbContext> dbProvider, IItemTypeLookup itemTypeLookup) : IPeopleRepository
|
||||||
{
|
{
|
||||||
private readonly IDbContextFactory<JellyfinDbContext> _dbProvider = dbProvider;
|
private readonly IDbContextFactory<JellyfinDbContext> _dbProvider = dbProvider;
|
||||||
|
|
||||||
@ -118,8 +119,9 @@ public class PeopleRepository(IDbContextFactory<JellyfinDbContext> dbProvider) :
|
|||||||
{
|
{
|
||||||
if (filter.User is not null && filter.IsFavorite.HasValue)
|
if (filter.User is not null && filter.IsFavorite.HasValue)
|
||||||
{
|
{
|
||||||
query = query.Where(e => e.PersonType == typeof(Person).FullName)
|
var personType = itemTypeLookup.BaseItemKindNames[BaseItemKind.Person];
|
||||||
.Where(e => context.BaseItems.Where(d => context.UserData.Where(e => e.IsFavorite == filter.IsFavorite && e.UserId.Equals(filter.User.Id)).Any(f => f.Key == d.UserDataKey))
|
query = query.Where(e => e.PersonType == personType)
|
||||||
|
.Where(e => context.BaseItems.Where(d => context.UserData.Where(w => w.IsFavorite == filter.IsFavorite && w.UserId.Equals(filter.User.Id)).Any(f => f.Key == d.UserDataKey))
|
||||||
.Select(f => f.Name).Contains(e.Name));
|
.Select(f => f.Name).Contains(e.Name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,5 +18,5 @@ public interface IItemTypeLookup
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets mapping for all BaseItemKinds and their expected serialization target.
|
/// Gets mapping for all BaseItemKinds and their expected serialization target.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IDictionary<BaseItemKind, string> BaseItemKindNames { get; }
|
public IReadOnlyDictionary<BaseItemKind, string> BaseItemKindNames { get; }
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user