mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-24 01:34:45 +03:00
Added GetItemsWithPerson
This commit is contained in:
parent
ee1fa6e816
commit
0788f435c1
@@ -306,6 +306,29 @@ namespace MediaBrowser.Controller
|
||||
return GetParentalAllowedRecursiveChildren(parent, userId).Where(f => f.Studios != null && f.Studios.Any(s => s.Equals(studio, StringComparison.OrdinalIgnoreCase)));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Finds all recursive items within a top-level parent that contain the given person and are allowed for the current user
|
||||
/// </summary>
|
||||
/// <param name="personType">Specify this to limit results to a specific PersonType</param>
|
||||
public IEnumerable<BaseItem> GetItemsWithPerson(Folder parent, string person, PersonType? personType, Guid userId)
|
||||
{
|
||||
return GetParentalAllowedRecursiveChildren(parent, userId).Where(c =>
|
||||
{
|
||||
if (c.People != null)
|
||||
{
|
||||
if (personType.HasValue)
|
||||
{
|
||||
return c.People.Any(p => p.Name.Equals(person, StringComparison.OrdinalIgnoreCase) && p.PersonType == personType.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
return c.People.Any(p => p.Name.Equals(person, StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
}
|
||||
/// <summary>
|
||||
/// Finds all recursive items within a top-level parent that contain the given genre and are allowed for the current user
|
||||
/// </summary>
|
||||
@@ -321,7 +344,7 @@ namespace MediaBrowser.Controller
|
||||
{
|
||||
return GetParentalAllowedRecursiveChildren(parent, userId).Where(f => f.ProductionYear.HasValue && f.ProductionYear == year);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Finds all recursive items within a top-level parent that contain the given person and are allowed for the current user
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user