mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-07-04 13:22:52 +01:00
Added GetItemsWithPerson
This commit is contained in:
parent
ee1fa6e816
commit
0788f435c1
32
MediaBrowser.Api/HttpHandlers/ItemsWithPersonHandler.cs
Normal file
32
MediaBrowser.Api/HttpHandlers/ItemsWithPersonHandler.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using MediaBrowser.Controller;
|
||||
using MediaBrowser.Model.Entities;
|
||||
|
||||
namespace MediaBrowser.Api.HttpHandlers
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets all items within containing a person
|
||||
/// </summary>
|
||||
public class ItemsWithPersonHandler : ItemListHandler
|
||||
{
|
||||
protected override IEnumerable<BaseItem> ItemsToSerialize
|
||||
{
|
||||
get
|
||||
{
|
||||
Folder parent = ApiService.GetItemById(QueryString["id"]) as Folder;
|
||||
|
||||
PersonType? personType = null;
|
||||
|
||||
string type = QueryString["persontype"];
|
||||
|
||||
if (!string.IsNullOrEmpty(type))
|
||||
{
|
||||
personType = (PersonType)Enum.Parse(typeof(PersonType), type, true);
|
||||
}
|
||||
|
||||
return Kernel.Instance.GetItemsWithPerson(parent, QueryString["name"], personType, UserId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -55,6 +55,7 @@
|
||||
<Compile Include="HttpHandlers\InProgressItemsHandler.cs" />
|
||||
<Compile Include="HttpHandlers\ItemHandler.cs" />
|
||||
<Compile Include="HttpHandlers\ItemListHandler.cs" />
|
||||
<Compile Include="HttpHandlers\ItemsWithPersonHandler.cs" />
|
||||
<Compile Include="HttpHandlers\JsonHandler.cs" />
|
||||
<Compile Include="HttpHandlers\PersonHandler.cs" />
|
||||
<Compile Include="HttpHandlers\PluginConfigurationHandler.cs" />
|
||||
|
||||
@@ -61,6 +61,10 @@ namespace MediaBrowser.Api
|
||||
{
|
||||
return new ItemsWithYearHandler();
|
||||
}
|
||||
else if (localPath.EndsWith("/api/itemswithperson", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return new ItemsWithPersonHandler();
|
||||
}
|
||||
else if (localPath.EndsWith("/api/years", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return new YearsHandler();
|
||||
|
||||
Reference in New Issue
Block a user