|
|
|
@ -1,12 +1,9 @@
|
|
|
|
|
using MediaBrowser.Common.Configuration;
|
|
|
|
|
using MediaBrowser.Common.Extensions;
|
|
|
|
|
using MediaBrowser.Common.IO;
|
|
|
|
|
using MediaBrowser.Common.Net;
|
|
|
|
|
using MediaBrowser.Controller;
|
|
|
|
|
using MediaBrowser.Controller.Dto;
|
|
|
|
|
using MediaBrowser.Controller.Entities;
|
|
|
|
|
using MediaBrowser.Controller.Entities.Audio;
|
|
|
|
|
using MediaBrowser.Controller.Entities.TV;
|
|
|
|
|
using MediaBrowser.Controller.Library;
|
|
|
|
|
using MediaBrowser.Controller.Persistence;
|
|
|
|
|
using MediaBrowser.Controller.Providers;
|
|
|
|
@ -39,6 +36,23 @@ namespace MediaBrowser.Api.Images
|
|
|
|
|
public string Id { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Route("/Artists/{Name}/Images", "GET")]
|
|
|
|
|
[Route("/Genres/{Name}/Images", "GET")]
|
|
|
|
|
[Route("/GameGenres/{Name}/Images", "GET")]
|
|
|
|
|
[Route("/MusicGenres/{Name}/Images", "GET")]
|
|
|
|
|
[Route("/Persons/{Name}/Images", "GET")]
|
|
|
|
|
[Route("/Studios/{Name}/Images", "GET")]
|
|
|
|
|
[Api(Description = "Gets information about an item's images")]
|
|
|
|
|
public class GetItemByNameImageInfos : IReturn<List<ImageInfo>>
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets or sets the id.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <value>The id.</value>
|
|
|
|
|
[ApiMember(Name = "Name", Description = "Name", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
|
|
|
|
|
public string Name { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Route("/Items/{Id}/Images/{Type}", "GET")]
|
|
|
|
|
[Route("/Items/{Id}/Images/{Type}/{Index}", "GET")]
|
|
|
|
|
[Api(Description = "Gets an item image")]
|
|
|
|
@ -88,142 +102,128 @@ namespace MediaBrowser.Api.Images
|
|
|
|
|
public int NewIndex { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Class DeleteItemImage
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Route("/Items/{Id}/Images/{Type}", "DELETE")]
|
|
|
|
|
[Route("/Items/{Id}/Images/{Type}/{Index}", "DELETE")]
|
|
|
|
|
[Api(Description = "Deletes an item image")]
|
|
|
|
|
public class DeleteItemImage : DeleteImageRequest, IReturnVoid
|
|
|
|
|
[Route("/Artists/{Name}/Images/{Type}/{Index}/Index", "POST")]
|
|
|
|
|
[Route("/Genres/{Name}/Images/{Type}/{Index}/Index", "POST")]
|
|
|
|
|
[Route("/GameGenres/{Name}/Images/{Type}/{Index}/Index", "POST")]
|
|
|
|
|
[Route("/MusicGenres/{Name}/Images/{Type}/{Index}/Index", "POST")]
|
|
|
|
|
[Route("/Persons/{Name}/Images/{Type}/{Index}/Index", "POST")]
|
|
|
|
|
[Route("/Studios/{Name}/Images/{Type}/{Index}/Index", "POST")]
|
|
|
|
|
[Route("/Years/{Year}/Images/{Type}/{Index}/Index", "POST")]
|
|
|
|
|
[Api(Description = "Updates the index for an item image")]
|
|
|
|
|
public class UpdateItemByNameImageIndex : IReturnVoid
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets or sets the id.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <value>The id.</value>
|
|
|
|
|
[ApiMember(Name = "Id", Description = "Item Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
|
|
|
|
|
public Guid Id { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Class GetPersonImage
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Route("/Persons/{Name}/Images/{Type}", "GET")]
|
|
|
|
|
[Route("/Persons/{Name}/Images/{Type}/{Index}", "GET")]
|
|
|
|
|
[Api(Description = "Gets a person image")]
|
|
|
|
|
public class GetPersonImage : ImageRequest
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets or sets the name.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <value>The name.</value>
|
|
|
|
|
[ApiMember(Name = "Name", Description = "Person name", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
|
|
|
|
|
[ApiMember(Name = "Name", Description = "Item name", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")]
|
|
|
|
|
public string Name { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Class GetArtistImage
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Route("/Artists/{Name}/Images/{Type}", "GET")]
|
|
|
|
|
[Route("/Artists/{Name}/Images/{Type}/{Index}", "GET")]
|
|
|
|
|
[Api(Description = "Gets an artist image")]
|
|
|
|
|
public class GetArtistImage : ImageRequest
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets or sets the name.
|
|
|
|
|
/// Gets or sets the type of the image.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <value>The name.</value>
|
|
|
|
|
[ApiMember(Name = "Name", Description = "Artist name", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
|
|
|
|
|
public string Name { get; set; }
|
|
|
|
|
}
|
|
|
|
|
/// <value>The type of the image.</value>
|
|
|
|
|
[ApiMember(Name = "Type", Description = "Image Type", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")]
|
|
|
|
|
public ImageType Type { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Class GetStudioImage
|
|
|
|
|
/// Gets or sets the index.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Route("/Studios/{Name}/Images/{Type}", "GET")]
|
|
|
|
|
[Route("/Studios/{Name}/Images/{Type}/{Index}", "GET")]
|
|
|
|
|
[Api(Description = "Gets a studio image")]
|
|
|
|
|
public class GetStudioImage : ImageRequest
|
|
|
|
|
{
|
|
|
|
|
/// <value>The index.</value>
|
|
|
|
|
[ApiMember(Name = "Index", Description = "Image Index", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "POST")]
|
|
|
|
|
public int Index { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets or sets the name.
|
|
|
|
|
/// Gets or sets the new index.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <value>The name.</value>
|
|
|
|
|
[ApiMember(Name = "Name", Description = "Studio name", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
|
|
|
|
|
public string Name { get; set; }
|
|
|
|
|
/// <value>The new index.</value>
|
|
|
|
|
[ApiMember(Name = "NewIndex", Description = "The new image index", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")]
|
|
|
|
|
public int NewIndex { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Class GetGenreImage
|
|
|
|
|
/// Class GetPersonImage
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Route("/Artists/{Name}/Images/{Type}", "GET")]
|
|
|
|
|
[Route("/Artists/{Name}/Images/{Type}/{Index}", "GET")]
|
|
|
|
|
[Route("/Genres/{Name}/Images/{Type}", "GET")]
|
|
|
|
|
[Route("/Genres/{Name}/Images/{Type}/{Index}", "GET")]
|
|
|
|
|
[Api(Description = "Gets a genre image")]
|
|
|
|
|
public class GetGenreImage : ImageRequest
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets or sets the name.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <value>The name.</value>
|
|
|
|
|
[ApiMember(Name = "Name", Description = "Genre name", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
|
|
|
|
|
public string Name { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Route("/GameGenres/{Name}/Images/{Type}", "GET")]
|
|
|
|
|
[Route("/GameGenres/{Name}/Images/{Type}/{Index}", "GET")]
|
|
|
|
|
[Route("/MusicGenres/{Name}/Images/{Type}", "GET")]
|
|
|
|
|
[Route("/MusicGenres/{Name}/Images/{Type}/{Index}", "GET")]
|
|
|
|
|
[Api(Description = "Gets a genre image")]
|
|
|
|
|
public class GetMusicGenreImage : ImageRequest
|
|
|
|
|
[Route("/Persons/{Name}/Images/{Type}", "GET")]
|
|
|
|
|
[Route("/Persons/{Name}/Images/{Type}/{Index}", "GET")]
|
|
|
|
|
[Route("/Studios/{Name}/Images/{Type}", "GET")]
|
|
|
|
|
[Route("/Studios/{Name}/Images/{Type}/{Index}", "GET")]
|
|
|
|
|
[Route("/Years/{Year}/Images/{Type}", "GET")]
|
|
|
|
|
[Route("/Years/{Year}/Images/{Type}/{Index}", "GET")]
|
|
|
|
|
[Api(Description = "Gets an item by name image")]
|
|
|
|
|
public class GetItemByNameImage : ImageRequest
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets or sets the name.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <value>The name.</value>
|
|
|
|
|
[ApiMember(Name = "Name", Description = "Genre name", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
|
|
|
|
|
[ApiMember(Name = "Name", Description = "Item name", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
|
|
|
|
|
public string Name { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Route("/GameGenres/{Name}/Images/{Type}", "GET")]
|
|
|
|
|
[Route("/GameGenres/{Name}/Images/{Type}/{Index}", "GET")]
|
|
|
|
|
[Api(Description = "Gets a genre image")]
|
|
|
|
|
public class GetGameGenreImage : ImageRequest
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Class GetUserImage
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Route("/Users/{Id}/Images/{Type}", "GET")]
|
|
|
|
|
[Route("/Users/{Id}/Images/{Type}/{Index}", "GET")]
|
|
|
|
|
[Api(Description = "Gets a user image")]
|
|
|
|
|
public class GetUserImage : ImageRequest
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets or sets the name.
|
|
|
|
|
/// Gets or sets the id.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <value>The name.</value>
|
|
|
|
|
[ApiMember(Name = "Name", Description = "Genre name", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
|
|
|
|
|
public string Name { get; set; }
|
|
|
|
|
/// <value>The id.</value>
|
|
|
|
|
[ApiMember(Name = "Id", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
|
|
|
|
|
public Guid Id { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Class GetYearImage
|
|
|
|
|
/// Class DeleteItemImage
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Route("/Years/{Year}/Images/{Type}", "GET")]
|
|
|
|
|
[Route("/Years/{Year}/Images/{Type}/{Index}", "GET")]
|
|
|
|
|
[Api(Description = "Gets a year image")]
|
|
|
|
|
public class GetYearImage : ImageRequest
|
|
|
|
|
[Route("/Items/{Id}/Images/{Type}", "DELETE")]
|
|
|
|
|
[Route("/Items/{Id}/Images/{Type}/{Index}", "DELETE")]
|
|
|
|
|
[Api(Description = "Deletes an item image")]
|
|
|
|
|
public class DeleteItemImage : DeleteImageRequest, IReturnVoid
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets or sets the year.
|
|
|
|
|
/// Gets or sets the id.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <value>The year.</value>
|
|
|
|
|
[ApiMember(Name = "Year", Description = "Year", IsRequired = true, DataType = "int", ParameterType = "path", Verb = "GET")]
|
|
|
|
|
public int Year { get; set; }
|
|
|
|
|
/// <value>The id.</value>
|
|
|
|
|
[ApiMember(Name = "Id", Description = "Item Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "DELETE")]
|
|
|
|
|
public Guid Id { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Class GetUserImage
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Route("/Users/{Id}/Images/{Type}", "GET")]
|
|
|
|
|
[Route("/Users/{Id}/Images/{Type}/{Index}", "GET")]
|
|
|
|
|
[Api(Description = "Gets a user image")]
|
|
|
|
|
public class GetUserImage : ImageRequest
|
|
|
|
|
[Route("/Artists/{Name}/Images/{Type}", "DELETE")]
|
|
|
|
|
[Route("/Artists/{Name}/Images/{Type}/{Index}", "DELETE")]
|
|
|
|
|
[Route("/Genres/{Name}/Images/{Type}", "DELETE")]
|
|
|
|
|
[Route("/Genres/{Name}/Images/{Type}/{Index}", "DELETE")]
|
|
|
|
|
[Route("/GameGenres/{Name}/Images/{Type}", "DELETE")]
|
|
|
|
|
[Route("/GameGenres/{Name}/Images/{Type}/{Index}", "DELETE")]
|
|
|
|
|
[Route("/MusicGenres/{Name}/Images/{Type}", "DELETE")]
|
|
|
|
|
[Route("/MusicGenres/{Name}/Images/{Type}/{Index}", "DELETE")]
|
|
|
|
|
[Route("/Persons/{Name}/Images/{Type}", "DELETE")]
|
|
|
|
|
[Route("/Persons/{Name}/Images/{Type}/{Index}", "DELETE")]
|
|
|
|
|
[Route("/Studios/{Name}/Images/{Type}", "DELETE")]
|
|
|
|
|
[Route("/Studios/{Name}/Images/{Type}/{Index}", "DELETE")]
|
|
|
|
|
[Route("/Years/{Year}/Images/{Type}", "DELETE")]
|
|
|
|
|
[Route("/Years/{Year}/Images/{Type}/{Index}", "DELETE")]
|
|
|
|
|
[Api(Description = "Deletes an item image")]
|
|
|
|
|
public class DeleteItemByNameImage : DeleteImageRequest, IReturnVoid
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets or sets the id.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <value>The id.</value>
|
|
|
|
|
[ApiMember(Name = "Id", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
|
|
|
|
|
public Guid Id { get; set; }
|
|
|
|
|
[ApiMember(Name = "Name", Description = "Item name", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "DELETE")]
|
|
|
|
|
public string Name { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -286,6 +286,37 @@ namespace MediaBrowser.Api.Images
|
|
|
|
|
public Stream RequestStream { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Route("/Artists/{Name}/Images/{Type}", "POST")]
|
|
|
|
|
[Route("/Artists/{Name}/Images/{Type}/{Index}", "POST")]
|
|
|
|
|
[Route("/Genres/{Name}/Images/{Type}", "POST")]
|
|
|
|
|
[Route("/Genres/{Name}/Images/{Type}/{Index}", "POST")]
|
|
|
|
|
[Route("/GameGenres/{Name}/Images/{Type}", "POST")]
|
|
|
|
|
[Route("/GameGenres/{Name}/Images/{Type}/{Index}", "POST")]
|
|
|
|
|
[Route("/MusicGenres/{Name}/Images/{Type}", "POST")]
|
|
|
|
|
[Route("/MusicGenres/{Name}/Images/{Type}/{Index}", "POST")]
|
|
|
|
|
[Route("/Persons/{Name}/Images/{Type}", "POST")]
|
|
|
|
|
[Route("/Persons/{Name}/Images/{Type}/{Index}", "POST")]
|
|
|
|
|
[Route("/Studios/{Name}/Images/{Type}", "POST")]
|
|
|
|
|
[Route("/Studios/{Name}/Images/{Type}/{Index}", "POST")]
|
|
|
|
|
[Route("/Years/{Year}/Images/{Type}", "POST")]
|
|
|
|
|
[Route("/Years/{Year}/Images/{Type}/{Index}", "POST")]
|
|
|
|
|
[Api(Description = "Posts an item image")]
|
|
|
|
|
public class PostItemByNameImage : DeleteImageRequest, IRequiresRequestStream, IReturnVoid
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets or sets the id.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <value>The id.</value>
|
|
|
|
|
[ApiMember(Name = "Name", Description = "Item name", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")]
|
|
|
|
|
public string Name { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The raw Http Request Input Stream
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <value>The request stream.</value>
|
|
|
|
|
public Stream RequestStream { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Class ImageService
|
|
|
|
|
/// </summary>
|
|
|
|
@ -337,6 +368,28 @@ namespace MediaBrowser.Api.Images
|
|
|
|
|
return ToOptimizedResult(result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public object Get(GetItemByNameImageInfos request)
|
|
|
|
|
{
|
|
|
|
|
var result = GetItemByNameImageInfos(request).Result;
|
|
|
|
|
|
|
|
|
|
return ToOptimizedResult(result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the item by name image infos.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="request">The request.</param>
|
|
|
|
|
/// <returns>Task{List{ImageInfo}}.</returns>
|
|
|
|
|
public async Task<List<ImageInfo>> GetItemByNameImageInfos(GetItemByNameImageInfos request)
|
|
|
|
|
{
|
|
|
|
|
var pathInfo = PathInfo.Parse(RequestContext.PathInfo);
|
|
|
|
|
var type = pathInfo.GetArgumentValue<string>(0);
|
|
|
|
|
|
|
|
|
|
var item = await GetItemByName(request.Name, type, _libraryManager).ConfigureAwait(false);
|
|
|
|
|
|
|
|
|
|
return await GetItemImageInfos(item).ConfigureAwait(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the item image infos.
|
|
|
|
|
/// </summary>
|
|
|
|
@ -476,92 +529,43 @@ namespace MediaBrowser.Api.Images
|
|
|
|
|
return GetImage(request, item);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the specified request.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="request">The request.</param>
|
|
|
|
|
/// <returns>System.Object.</returns>
|
|
|
|
|
public object Get(GetYearImage request)
|
|
|
|
|
public object Get(GetItemByNameImage request)
|
|
|
|
|
{
|
|
|
|
|
var item = _libraryManager.GetYear(request.Year).Result;
|
|
|
|
|
|
|
|
|
|
return GetImage(request, item);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the specified request.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="request">The request.</param>
|
|
|
|
|
/// <returns>System.Object.</returns>
|
|
|
|
|
public object Get(GetStudioImage request)
|
|
|
|
|
{
|
|
|
|
|
var item = GetStudio(request.Name, _libraryManager).Result;
|
|
|
|
|
|
|
|
|
|
return GetImage(request, item);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the specified request.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="request">The request.</param>
|
|
|
|
|
/// <returns>System.Object.</returns>
|
|
|
|
|
public object Get(GetPersonImage request)
|
|
|
|
|
{
|
|
|
|
|
var item = GetPerson(request.Name, _libraryManager).Result;
|
|
|
|
|
|
|
|
|
|
return GetImage(request, item);
|
|
|
|
|
}
|
|
|
|
|
var pathInfo = PathInfo.Parse(RequestContext.PathInfo);
|
|
|
|
|
var type = pathInfo.GetArgumentValue<string>(0);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the specified request.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="request">The request.</param>
|
|
|
|
|
/// <returns>System.Object.</returns>
|
|
|
|
|
public object Get(GetArtistImage request)
|
|
|
|
|
{
|
|
|
|
|
var item = GetArtist(request.Name, _libraryManager).Result;
|
|
|
|
|
var item = GetItemByName(request.Name, type, _libraryManager).Result;
|
|
|
|
|
|
|
|
|
|
return GetImage(request, item);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the specified request.
|
|
|
|
|
/// Posts the specified request.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="request">The request.</param>
|
|
|
|
|
/// <returns>System.Object.</returns>
|
|
|
|
|
public object Get(GetGenreImage request)
|
|
|
|
|
public void Post(PostUserImage request)
|
|
|
|
|
{
|
|
|
|
|
var item = GetGenre(request.Name, _libraryManager).Result;
|
|
|
|
|
|
|
|
|
|
return GetImage(request, item);
|
|
|
|
|
}
|
|
|
|
|
var pathInfo = PathInfo.Parse(RequestContext.PathInfo);
|
|
|
|
|
var id = new Guid(pathInfo.GetArgumentValue<string>(1));
|
|
|
|
|
|
|
|
|
|
public object Get(GetMusicGenreImage request)
|
|
|
|
|
{
|
|
|
|
|
var item = GetMusicGenre(request.Name, _libraryManager).Result;
|
|
|
|
|
request.Type = (ImageType)Enum.Parse(typeof(ImageType), pathInfo.GetArgumentValue<string>(3), true);
|
|
|
|
|
|
|
|
|
|
return GetImage(request, item);
|
|
|
|
|
}
|
|
|
|
|
var item = _userManager.Users.First(i => i.Id == id);
|
|
|
|
|
|
|
|
|
|
public object Get(GetGameGenreImage request)
|
|
|
|
|
{
|
|
|
|
|
var item = GetGameGenre(request.Name, _libraryManager).Result;
|
|
|
|
|
var task = PostImage(item, request.RequestStream, request.Type, RequestContext.ContentType);
|
|
|
|
|
|
|
|
|
|
return GetImage(request, item);
|
|
|
|
|
Task.WaitAll(task);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Posts the specified request.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="request">The request.</param>
|
|
|
|
|
public void Post(PostUserImage request)
|
|
|
|
|
public void Post(PostItemByNameImage request)
|
|
|
|
|
{
|
|
|
|
|
var pathInfo = PathInfo.Parse(RequestContext.PathInfo);
|
|
|
|
|
var id = new Guid(pathInfo.GetArgumentValue<string>(1));
|
|
|
|
|
var type = pathInfo.GetArgumentValue<string>(0);
|
|
|
|
|
var name = pathInfo.GetArgumentValue<string>(1);
|
|
|
|
|
|
|
|
|
|
request.Type = (ImageType)Enum.Parse(typeof(ImageType), pathInfo.GetArgumentValue<string>(3), true);
|
|
|
|
|
|
|
|
|
|
var item = _userManager.Users.First(i => i.Id == id);
|
|
|
|
|
var item = GetItemByName(name, type, _libraryManager).Result;
|
|
|
|
|
|
|
|
|
|
var task = PostImage(item, request.RequestStream, request.Type, RequestContext.ContentType);
|
|
|
|
|
|
|
|
|
@ -612,6 +616,22 @@ namespace MediaBrowser.Api.Images
|
|
|
|
|
Task.WaitAll(task);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Deletes the specified request.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="request">The request.</param>
|
|
|
|
|
public void Delete(DeleteItemByNameImage request)
|
|
|
|
|
{
|
|
|
|
|
var pathInfo = PathInfo.Parse(RequestContext.PathInfo);
|
|
|
|
|
var type = pathInfo.GetArgumentValue<string>(0);
|
|
|
|
|
|
|
|
|
|
var item = GetItemByName(request.Name, type, _libraryManager).Result;
|
|
|
|
|
|
|
|
|
|
var task = item.DeleteImage(request.Type, request.Index);
|
|
|
|
|
|
|
|
|
|
Task.WaitAll(task);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Posts the specified request.
|
|
|
|
|
/// </summary>
|
|
|
|
@ -625,6 +645,22 @@ namespace MediaBrowser.Api.Images
|
|
|
|
|
Task.WaitAll(task);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Posts the specified request.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="request">The request.</param>
|
|
|
|
|
public void Post(UpdateItemByNameImageIndex request)
|
|
|
|
|
{
|
|
|
|
|
var pathInfo = PathInfo.Parse(RequestContext.PathInfo);
|
|
|
|
|
var type = pathInfo.GetArgumentValue<string>(0);
|
|
|
|
|
|
|
|
|
|
var item = GetItemByName(request.Name, type, _libraryManager).Result;
|
|
|
|
|
|
|
|
|
|
var task = UpdateItemIndex(item, request.Type, request.Index, request.NewIndex);
|
|
|
|
|
|
|
|
|
|
Task.WaitAll(task);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Updates the index of the item.
|
|
|
|
|
/// </summary>
|
|
|
|
|