You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
jellyfin/MediaBrowser.Api/HttpHandlers/ItemHandler.cs

37 lines
965 B

using System;
using System.Linq;
using System.Threading.Tasks;
using MediaBrowser.Common.Net.Handlers;
using MediaBrowser.Controller;
using MediaBrowser.Model.DTO;
13 years ago
using MediaBrowser.Model.Entities;
namespace MediaBrowser.Api.HttpHandlers
{
public class ItemHandler : BaseJsonHandler<DTOBaseItem>
13 years ago
{
protected async override Task<DTOBaseItem> GetObjectToSerialize()
13 years ago
{
Guid userId = Guid.Parse(QueryString["userid"]);
User user = Kernel.Instance.Users.First(u => u.Id == userId);
BaseItem item = ItemToSerialize;
if (item == null)
{
return null;
13 years ago
}
return await ApiService.GetDTOBaseItem(item, user);
13 years ago
}
protected virtual BaseItem ItemToSerialize
13 years ago
{
get
13 years ago
{
return ApiService.GetItemById(QueryString["id"]);
13 years ago
}
}
}
}