|
|
|
@ -11,6 +11,7 @@ using MediaBrowser.Model.Providers;
|
|
|
|
|
using ServiceStack.ServiceHost;
|
|
|
|
|
using ServiceStack.Text.Controller;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Threading;
|
|
|
|
@ -70,6 +71,35 @@ namespace MediaBrowser.Api.Images
|
|
|
|
|
public string Name { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Route("/Items/{Id}/RemoteImages/Providers", "GET")]
|
|
|
|
|
[Api(Description = "Gets available remote image providers for an item")]
|
|
|
|
|
public class GetRemoteImageProviders : IReturn<List<ImageProviderInfo>>
|
|
|
|
|
{
|
|
|
|
|
/// <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 string Id { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Route("/Artists/{Name}/RemoteImages/Providers", "GET")]
|
|
|
|
|
[Route("/Genres/{Name}/RemoteImages/Providers", "GET")]
|
|
|
|
|
[Route("/GameGenres/{Name}/RemoteImages/Providers", "GET")]
|
|
|
|
|
[Route("/MusicGenres/{Name}/RemoteImages/Providers", "GET")]
|
|
|
|
|
[Route("/Persons/{Name}/RemoteImages/Providers", "GET")]
|
|
|
|
|
[Route("/Studios/{Name}/RemoteImages/Providers", "GET")]
|
|
|
|
|
[Api(Description = "Gets available remote image providers for an item")]
|
|
|
|
|
public class GetItemByNameRemoteImageProviders : IReturn<List<ImageProviderInfo>>
|
|
|
|
|
{
|
|
|
|
|
/// <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; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class BaseDownloadRemoteImage : IReturnVoid
|
|
|
|
|
{
|
|
|
|
|
[ApiMember(Name = "Type", Description = "The image type", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")]
|
|
|
|
@ -140,6 +170,37 @@ namespace MediaBrowser.Api.Images
|
|
|
|
|
_libraryManager = libraryManager;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public object Get(GetRemoteImageProviders request)
|
|
|
|
|
{
|
|
|
|
|
var item = _dtoService.GetItemByDtoId(request.Id);
|
|
|
|
|
|
|
|
|
|
var result = GetImageProviders(item);
|
|
|
|
|
|
|
|
|
|
return ToOptimizedResult(result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public object Get(GetItemByNameRemoteImageProviders request)
|
|
|
|
|
{
|
|
|
|
|
var pathInfo = PathInfo.Parse(RequestContext.PathInfo);
|
|
|
|
|
var type = pathInfo.GetArgumentValue<string>(0);
|
|
|
|
|
|
|
|
|
|
var item = GetItemByName(request.Name, type, _libraryManager);
|
|
|
|
|
|
|
|
|
|
var result = GetImageProviders(item);
|
|
|
|
|
|
|
|
|
|
return ToOptimizedResult(result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private List<ImageProviderInfo> GetImageProviders(BaseItem item)
|
|
|
|
|
{
|
|
|
|
|
return _providerManager.GetImageProviders(item).Select(i => new ImageProviderInfo
|
|
|
|
|
{
|
|
|
|
|
Name = i.Name,
|
|
|
|
|
Priority = i.Priority
|
|
|
|
|
|
|
|
|
|
}).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public object Get(GetRemoteImages request)
|
|
|
|
|
{
|
|
|
|
|
var item = _dtoService.GetItemByDtoId(request.Id);
|
|
|
|
|