mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-07-05 21:33:02 +02:00
Removed generics from IBNItem
This commit is contained in:
parent
ef03988442
commit
4527a18738
|
@ -194,7 +194,7 @@ namespace MediaBrowser.Api
|
||||||
dto.LocalTrailers = await Task.WhenAll<DTOBaseItem>(item.LocalTrailers.Select(c => GetDTOBaseItem(c, user, false, false))).ConfigureAwait(false);
|
dto.LocalTrailers = await Task.WhenAll<DTOBaseItem>(item.LocalTrailers.Select(c => GetDTOBaseItem(c, user, false, false))).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async Task AttachPeople(DTOBaseItem dto, BaseItem item)
|
private static async Task AttachPeople(DTOBaseItem dto, BaseItem item)
|
||||||
{
|
{
|
||||||
// Attach People by transforming them into BaseItemPerson (DTO)
|
// Attach People by transforming them into BaseItemPerson (DTO)
|
||||||
|
@ -256,5 +256,16 @@ namespace MediaBrowser.Api
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static IBNItem GetIBNItem(BaseEntity entity, int itemCount)
|
||||||
|
{
|
||||||
|
return new IBNItem()
|
||||||
|
{
|
||||||
|
Id = entity.Id,
|
||||||
|
BaseItemCount = itemCount,
|
||||||
|
HasPrimaryImage = !string.IsNullOrEmpty(entity.PrimaryImagePath),
|
||||||
|
Name = entity.Name
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,9 +12,9 @@ namespace MediaBrowser.Api.HttpHandlers
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a single genre
|
/// Gets a single genre
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class GenreHandler : BaseJsonHandler<IBNItem<Genre>>
|
public class GenreHandler : BaseJsonHandler<IBNItem>
|
||||||
{
|
{
|
||||||
protected override Task<IBNItem<Genre>> GetObjectToSerialize()
|
protected override Task<IBNItem> GetObjectToSerialize()
|
||||||
{
|
{
|
||||||
Folder parent = ApiService.GetItemById(QueryString["id"]) as Folder;
|
Folder parent = ApiService.GetItemById(QueryString["id"]) as Folder;
|
||||||
Guid userId = Guid.Parse(QueryString["userid"]);
|
Guid userId = Guid.Parse(QueryString["userid"]);
|
||||||
|
@ -28,7 +28,7 @@ namespace MediaBrowser.Api.HttpHandlers
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a Genre
|
/// Gets a Genre
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private async Task<IBNItem<Genre>> GetGenre(Folder parent, User user, string name)
|
private async Task<IBNItem> GetGenre(Folder parent, User user, string name)
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
|
@ -44,11 +44,7 @@ namespace MediaBrowser.Api.HttpHandlers
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the original entity so that we can also supply the PrimaryImagePath
|
// Get the original entity so that we can also supply the PrimaryImagePath
|
||||||
return new IBNItem<Genre>()
|
return ApiService.GetIBNItem(await Kernel.Instance.ItemController.GetGenre(name).ConfigureAwait(false), count);
|
||||||
{
|
|
||||||
Item = await Kernel.Instance.ItemController.GetGenre(name).ConfigureAwait(false),
|
|
||||||
BaseItemCount = count
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,9 +9,9 @@ using MediaBrowser.Model.Entities;
|
||||||
|
|
||||||
namespace MediaBrowser.Api.HttpHandlers
|
namespace MediaBrowser.Api.HttpHandlers
|
||||||
{
|
{
|
||||||
public class GenresHandler : BaseJsonHandler<IEnumerable<IBNItem<Genre>>>
|
public class GenresHandler : BaseJsonHandler<IEnumerable<IBNItem>>
|
||||||
{
|
{
|
||||||
protected override Task<IEnumerable<IBNItem<Genre>>> GetObjectToSerialize()
|
protected override Task<IEnumerable<IBNItem>> GetObjectToSerialize()
|
||||||
{
|
{
|
||||||
Folder parent = ApiService.GetItemById(QueryString["id"]) as Folder;
|
Folder parent = ApiService.GetItemById(QueryString["id"]) as Folder;
|
||||||
Guid userId = Guid.Parse(QueryString["userid"]);
|
Guid userId = Guid.Parse(QueryString["userid"]);
|
||||||
|
@ -24,7 +24,7 @@ namespace MediaBrowser.Api.HttpHandlers
|
||||||
/// Gets all genres from all recursive children of a folder
|
/// Gets all genres from all recursive children of a folder
|
||||||
/// The CategoryInfo class is used to keep track of the number of times each genres appears
|
/// The CategoryInfo class is used to keep track of the number of times each genres appears
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private async Task<IEnumerable<IBNItem<Genre>>> GetAllGenres(Folder parent, User user)
|
private async Task<IEnumerable<IBNItem>> GetAllGenres(Folder parent, User user)
|
||||||
{
|
{
|
||||||
Dictionary<string, int> data = new Dictionary<string, int>();
|
Dictionary<string, int> data = new Dictionary<string, int>();
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ namespace MediaBrowser.Api.HttpHandlers
|
||||||
|
|
||||||
IEnumerable<Genre> entities = await Task.WhenAll<Genre>(data.Keys.Select(key => { return Kernel.Instance.ItemController.GetGenre(key); })).ConfigureAwait(false);
|
IEnumerable<Genre> entities = await Task.WhenAll<Genre>(data.Keys.Select(key => { return Kernel.Instance.ItemController.GetGenre(key); })).ConfigureAwait(false);
|
||||||
|
|
||||||
return entities.Select(e => new IBNItem<Genre>() { Item = e, BaseItemCount = data[e.Name] });
|
return entities.Select(e => ApiService.GetIBNItem(e, data[e.Name]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,9 +12,9 @@ namespace MediaBrowser.Api.HttpHandlers
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a single Person
|
/// Gets a single Person
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class PersonHandler : BaseJsonHandler<IBNItem<Person>>
|
public class PersonHandler : BaseJsonHandler<IBNItem>
|
||||||
{
|
{
|
||||||
protected override Task<IBNItem<Person>> GetObjectToSerialize()
|
protected override Task<IBNItem> GetObjectToSerialize()
|
||||||
{
|
{
|
||||||
Folder parent = ApiService.GetItemById(QueryString["id"]) as Folder;
|
Folder parent = ApiService.GetItemById(QueryString["id"]) as Folder;
|
||||||
Guid userId = Guid.Parse(QueryString["userid"]);
|
Guid userId = Guid.Parse(QueryString["userid"]);
|
||||||
|
@ -28,7 +28,7 @@ namespace MediaBrowser.Api.HttpHandlers
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a Person
|
/// Gets a Person
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private async Task<IBNItem<Person>> GetPerson(Folder parent, User user, string name)
|
private async Task<IBNItem> GetPerson(Folder parent, User user, string name)
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
|
@ -44,11 +44,7 @@ namespace MediaBrowser.Api.HttpHandlers
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the original entity so that we can also supply the PrimaryImagePath
|
// Get the original entity so that we can also supply the PrimaryImagePath
|
||||||
return new IBNItem<Person>()
|
return ApiService.GetIBNItem(await Kernel.Instance.ItemController.GetPerson(name).ConfigureAwait(false), count);
|
||||||
{
|
|
||||||
Item = await Kernel.Instance.ItemController.GetPerson(name).ConfigureAwait(false),
|
|
||||||
BaseItemCount = count
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,9 +12,9 @@ namespace MediaBrowser.Api.HttpHandlers
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a single studio
|
/// Gets a single studio
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class StudioHandler : BaseJsonHandler<IBNItem<Studio>>
|
public class StudioHandler : BaseJsonHandler<IBNItem>
|
||||||
{
|
{
|
||||||
protected override Task<IBNItem<Studio>> GetObjectToSerialize()
|
protected override Task<IBNItem> GetObjectToSerialize()
|
||||||
{
|
{
|
||||||
Folder parent = ApiService.GetItemById(QueryString["id"]) as Folder;
|
Folder parent = ApiService.GetItemById(QueryString["id"]) as Folder;
|
||||||
Guid userId = Guid.Parse(QueryString["userid"]);
|
Guid userId = Guid.Parse(QueryString["userid"]);
|
||||||
|
@ -28,7 +28,7 @@ namespace MediaBrowser.Api.HttpHandlers
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a Studio
|
/// Gets a Studio
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private async Task<IBNItem<Studio>> GetStudio(Folder parent, User user, string name)
|
private async Task<IBNItem> GetStudio(Folder parent, User user, string name)
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
|
@ -44,11 +44,7 @@ namespace MediaBrowser.Api.HttpHandlers
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the original entity so that we can also supply the PrimaryImagePath
|
// Get the original entity so that we can also supply the PrimaryImagePath
|
||||||
return new IBNItem<Studio>()
|
return ApiService.GetIBNItem(await Kernel.Instance.ItemController.GetStudio(name).ConfigureAwait(false), count);
|
||||||
{
|
|
||||||
Item = await Kernel.Instance.ItemController.GetStudio(name).ConfigureAwait(false),
|
|
||||||
BaseItemCount = count
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,9 +9,9 @@ using MediaBrowser.Model.Entities;
|
||||||
|
|
||||||
namespace MediaBrowser.Api.HttpHandlers
|
namespace MediaBrowser.Api.HttpHandlers
|
||||||
{
|
{
|
||||||
public class StudiosHandler : BaseJsonHandler<IEnumerable<IBNItem<Studio>>>
|
public class StudiosHandler : BaseJsonHandler<IEnumerable<IBNItem>>
|
||||||
{
|
{
|
||||||
protected override Task<IEnumerable<IBNItem<Studio>>> GetObjectToSerialize()
|
protected override Task<IEnumerable<IBNItem>> GetObjectToSerialize()
|
||||||
{
|
{
|
||||||
Folder parent = ApiService.GetItemById(QueryString["id"]) as Folder;
|
Folder parent = ApiService.GetItemById(QueryString["id"]) as Folder;
|
||||||
Guid userId = Guid.Parse(QueryString["userid"]);
|
Guid userId = Guid.Parse(QueryString["userid"]);
|
||||||
|
@ -24,7 +24,7 @@ namespace MediaBrowser.Api.HttpHandlers
|
||||||
/// Gets all studios from all recursive children of a folder
|
/// Gets all studios from all recursive children of a folder
|
||||||
/// The CategoryInfo class is used to keep track of the number of times each studio appears
|
/// The CategoryInfo class is used to keep track of the number of times each studio appears
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private async Task<IEnumerable<IBNItem<Studio>>> GetAllStudios(Folder parent, User user)
|
private async Task<IEnumerable<IBNItem>> GetAllStudios(Folder parent, User user)
|
||||||
{
|
{
|
||||||
Dictionary<string, int> data = new Dictionary<string, int>();
|
Dictionary<string, int> data = new Dictionary<string, int>();
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ namespace MediaBrowser.Api.HttpHandlers
|
||||||
|
|
||||||
IEnumerable<Studio> entities = await Task.WhenAll<Studio>(data.Keys.Select(key => { return Kernel.Instance.ItemController.GetStudio(key); })).ConfigureAwait(false);
|
IEnumerable<Studio> entities = await Task.WhenAll<Studio>(data.Keys.Select(key => { return Kernel.Instance.ItemController.GetStudio(key); })).ConfigureAwait(false);
|
||||||
|
|
||||||
return entities.Select(e => new IBNItem<Studio>() { Item = e, BaseItemCount = data[e.Name] });
|
return entities.Select(e => ApiService.GetIBNItem(e, data[e.Name]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,9 +12,9 @@ namespace MediaBrowser.Api.HttpHandlers
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a single year
|
/// Gets a single year
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class YearHandler : BaseJsonHandler<IBNItem<Year>>
|
public class YearHandler : BaseJsonHandler<IBNItem>
|
||||||
{
|
{
|
||||||
protected override Task<IBNItem<Year>> GetObjectToSerialize()
|
protected override Task<IBNItem> GetObjectToSerialize()
|
||||||
{
|
{
|
||||||
Folder parent = ApiService.GetItemById(QueryString["id"]) as Folder;
|
Folder parent = ApiService.GetItemById(QueryString["id"]) as Folder;
|
||||||
Guid userId = Guid.Parse(QueryString["userid"]);
|
Guid userId = Guid.Parse(QueryString["userid"]);
|
||||||
|
@ -28,7 +28,7 @@ namespace MediaBrowser.Api.HttpHandlers
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a Year
|
/// Gets a Year
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private async Task<IBNItem<Year>> GetYear(Folder parent, User user, int year)
|
private async Task<IBNItem> GetYear(Folder parent, User user, int year)
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
|
@ -44,11 +44,7 @@ namespace MediaBrowser.Api.HttpHandlers
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the original entity so that we can also supply the PrimaryImagePath
|
// Get the original entity so that we can also supply the PrimaryImagePath
|
||||||
return new IBNItem<Year>()
|
return ApiService.GetIBNItem(await Kernel.Instance.ItemController.GetYear(year).ConfigureAwait(false), count);
|
||||||
{
|
|
||||||
Item = await Kernel.Instance.ItemController.GetYear(year).ConfigureAwait(false),
|
|
||||||
BaseItemCount = count
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,9 +9,9 @@ using MediaBrowser.Model.Entities;
|
||||||
|
|
||||||
namespace MediaBrowser.Api.HttpHandlers
|
namespace MediaBrowser.Api.HttpHandlers
|
||||||
{
|
{
|
||||||
public class YearsHandler : BaseJsonHandler<IEnumerable<IBNItem<Year>>>
|
public class YearsHandler : BaseJsonHandler<IEnumerable<IBNItem>>
|
||||||
{
|
{
|
||||||
protected override Task<IEnumerable<IBNItem<Year>>> GetObjectToSerialize()
|
protected override Task<IEnumerable<IBNItem>> GetObjectToSerialize()
|
||||||
{
|
{
|
||||||
Folder parent = ApiService.GetItemById(QueryString["id"]) as Folder;
|
Folder parent = ApiService.GetItemById(QueryString["id"]) as Folder;
|
||||||
Guid userId = Guid.Parse(QueryString["userid"]);
|
Guid userId = Guid.Parse(QueryString["userid"]);
|
||||||
|
@ -24,7 +24,7 @@ namespace MediaBrowser.Api.HttpHandlers
|
||||||
/// Gets all years from all recursive children of a folder
|
/// Gets all years from all recursive children of a folder
|
||||||
/// The CategoryInfo class is used to keep track of the number of times each year appears
|
/// The CategoryInfo class is used to keep track of the number of times each year appears
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private async Task<IEnumerable<IBNItem<Year>>> GetAllYears(Folder parent, User user)
|
private async Task<IEnumerable<IBNItem>> GetAllYears(Folder parent, User user)
|
||||||
{
|
{
|
||||||
Dictionary<int, int> data = new Dictionary<int, int>();
|
Dictionary<int, int> data = new Dictionary<int, int>();
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ namespace MediaBrowser.Api.HttpHandlers
|
||||||
|
|
||||||
IEnumerable<Year> entities = await Task.WhenAll<Year>(data.Keys.Select(key => { return Kernel.Instance.ItemController.GetYear(key); })).ConfigureAwait(false);
|
IEnumerable<Year> entities = await Task.WhenAll<Year>(data.Keys.Select(key => { return Kernel.Instance.ItemController.GetYear(key); })).ConfigureAwait(false);
|
||||||
|
|
||||||
return entities.Select(e => new IBNItem<Year>() { Item = e, BaseItemCount = data[int.Parse(e.Name)] });
|
return entities.Select(e => ApiService.GetIBNItem(e, data[int.Parse(e.Name)]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -197,26 +197,26 @@ namespace MediaBrowser.ApiInteraction
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets all Genres
|
/// Gets all Genres
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public async Task<IEnumerable<IBNItem<Genre>>> GetAllGenresAsync(Guid userId)
|
public async Task<IEnumerable<IBNItem>> GetAllGenresAsync(Guid userId)
|
||||||
{
|
{
|
||||||
string url = ApiUrl + "/genres?userId=" + userId.ToString();
|
string url = ApiUrl + "/genres?userId=" + userId.ToString();
|
||||||
|
|
||||||
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
|
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
return DataSerializer.DeserializeFromStream<IEnumerable<IBNItem<Genre>>>(stream);
|
return DataSerializer.DeserializeFromStream<IEnumerable<IBNItem>>(stream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets all Years
|
/// Gets all Years
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public async Task<IEnumerable<IBNItem<Year>>> GetAllYearsAsync(Guid userId)
|
public async Task<IEnumerable<IBNItem>> GetAllYearsAsync(Guid userId)
|
||||||
{
|
{
|
||||||
string url = ApiUrl + "/years?userId=" + userId.ToString();
|
string url = ApiUrl + "/years?userId=" + userId.ToString();
|
||||||
|
|
||||||
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
|
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
return DataSerializer.DeserializeFromStream<IEnumerable<IBNItem<Year>>>(stream);
|
return DataSerializer.DeserializeFromStream<IEnumerable<IBNItem>>(stream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,13 +277,13 @@ namespace MediaBrowser.ApiInteraction
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets all studious
|
/// Gets all studious
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public async Task<IEnumerable<IBNItem<Studio>>> GetAllStudiosAsync(Guid userId)
|
public async Task<IEnumerable<IBNItem>> GetAllStudiosAsync(Guid userId)
|
||||||
{
|
{
|
||||||
string url = ApiUrl + "/studios?userId=" + userId.ToString();
|
string url = ApiUrl + "/studios?userId=" + userId.ToString();
|
||||||
|
|
||||||
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
|
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
return DataSerializer.DeserializeFromStream<IEnumerable<IBNItem<Studio>>>(stream);
|
return DataSerializer.DeserializeFromStream<IEnumerable<IBNItem>>(stream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -303,52 +303,52 @@ namespace MediaBrowser.ApiInteraction
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a studio
|
/// Gets a studio
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public async Task<IBNItem<Studio>> GetStudioAsync(Guid userId, string name)
|
public async Task<IBNItem> GetStudioAsync(Guid userId, string name)
|
||||||
{
|
{
|
||||||
string url = ApiUrl + "/studio?userId=" + userId.ToString() + "&name=" + name;
|
string url = ApiUrl + "/studio?userId=" + userId.ToString() + "&name=" + name;
|
||||||
|
|
||||||
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
|
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
return DataSerializer.DeserializeFromStream<IBNItem<Studio>>(stream);
|
return DataSerializer.DeserializeFromStream<IBNItem>(stream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a genre
|
/// Gets a genre
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public async Task<IBNItem<Genre>> GetGenreAsync(Guid userId, string name)
|
public async Task<IBNItem> GetGenreAsync(Guid userId, string name)
|
||||||
{
|
{
|
||||||
string url = ApiUrl + "/genre?userId=" + userId.ToString() + "&name=" + name;
|
string url = ApiUrl + "/genre?userId=" + userId.ToString() + "&name=" + name;
|
||||||
|
|
||||||
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
|
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
return DataSerializer.DeserializeFromStream<IBNItem<Genre>>(stream);
|
return DataSerializer.DeserializeFromStream<IBNItem>(stream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a person
|
/// Gets a person
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public async Task<IBNItem<Person>> GetPersonAsync(Guid userId, string name)
|
public async Task<IBNItem> GetPersonAsync(Guid userId, string name)
|
||||||
{
|
{
|
||||||
string url = ApiUrl + "/person?userId=" + userId.ToString() + "&name=" + name;
|
string url = ApiUrl + "/person?userId=" + userId.ToString() + "&name=" + name;
|
||||||
|
|
||||||
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
|
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
return DataSerializer.DeserializeFromStream<IBNItem<Person>>(stream);
|
return DataSerializer.DeserializeFromStream<IBNItem>(stream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a year
|
/// Gets a year
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public async Task<IBNItem<Year>> GetYearAsync(Guid userId, int year)
|
public async Task<IBNItem> GetYearAsync(Guid userId, int year)
|
||||||
{
|
{
|
||||||
string url = ApiUrl + "/year?userId=" + userId.ToString() + "&year=" + year;
|
string url = ApiUrl + "/year?userId=" + userId.ToString() + "&year=" + year;
|
||||||
|
|
||||||
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
|
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
return DataSerializer.DeserializeFromStream<IBNItem<Year>>(stream);
|
return DataSerializer.DeserializeFromStream<IBNItem>(stream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,24 @@
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace MediaBrowser.Model.DTO
|
namespace MediaBrowser.Model.DTO
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This is a stub class used by the api to get IBN types along with their item counts
|
/// This is a stub class used by the api to get IBN types along with their item counts
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class IBNItem<T>
|
public class IBNItem
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The actual genre, year, studio, etc
|
/// The name of the person, genre, etc
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public T Item { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The id of the person, genre, etc
|
||||||
|
/// </summary>
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
|
||||||
|
public bool HasPrimaryImage { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The number of items that have the genre, year, studio, etc
|
/// The number of items that have the genre, year, studio, etc
|
||||||
|
|
Loading…
Reference in a new issue