mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-07-09 03:04:20 -04:00
Fixing episodes, people and collection images
This commit is contained in:
parent
559160ad7b
commit
bb3e912ffa
@ -111,7 +111,7 @@ namespace Kyoo.Models
|
||||
/// By default, the http path for the thumbnail is returned from the public API.
|
||||
/// This can be disabled using the internal query flag.
|
||||
/// </summary>
|
||||
[SerializeAs("{HOST}/api/episodes/{Slug}/thumb")]
|
||||
[SerializeAs("{HOST}/api/episodes/{Slug}/thumbnail")]
|
||||
[Obsolete("Use Images instead of this, this is only kept for the API response.")]
|
||||
public string Thumb => Images?.GetValueOrDefault(Models.Images.Thumbnail);
|
||||
|
||||
|
@ -174,6 +174,13 @@ namespace Kyoo.Tasks
|
||||
|
||||
item = await _metadataProvider.Get(item);
|
||||
await _thumbnailsManager.DownloadImages(item);
|
||||
|
||||
if (item is Show show && show.People != null)
|
||||
{
|
||||
foreach (PeopleRole role in show.People)
|
||||
await _thumbnailsManager.DownloadImages(role.People);
|
||||
}
|
||||
|
||||
return await _libraryManager.CreateIfNotExists(item);
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ using Kyoo.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Threading.Tasks;
|
||||
using Kyoo.CommonApi;
|
||||
using Kyoo.Models.Exceptions;
|
||||
using Kyoo.Models.Options;
|
||||
using Kyoo.Models.Permissions;
|
||||
using Microsoft.Extensions.Options;
|
||||
@ -19,11 +20,18 @@ namespace Kyoo.Api
|
||||
public class CollectionApi : CrudApi<Collection>
|
||||
{
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
|
||||
public CollectionApi(ILibraryManager libraryManager, IOptions<BasicOptions> options)
|
||||
private readonly IFileSystem _files;
|
||||
private readonly IThumbnailsManager _thumbs;
|
||||
|
||||
public CollectionApi(ILibraryManager libraryManager,
|
||||
IFileSystem files,
|
||||
IThumbnailsManager thumbs,
|
||||
IOptions<BasicOptions> options)
|
||||
: base(libraryManager.CollectionRepository, options.Value.PublicUrl)
|
||||
{
|
||||
_libraryManager = libraryManager;
|
||||
_files = files;
|
||||
_thumbs = thumbs;
|
||||
}
|
||||
|
||||
[HttpGet("{id:int}/show")]
|
||||
@ -129,5 +137,48 @@ namespace Kyoo.Api
|
||||
return BadRequest(new {Error = ex.Message});
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("{slug}/poster")]
|
||||
public async Task<IActionResult> GetPoster(string slug)
|
||||
{
|
||||
try
|
||||
{
|
||||
Collection collection = await _libraryManager.Get<Collection>(slug);
|
||||
return _files.FileResult(await _thumbs.GetImagePath(collection, Images.Poster));
|
||||
}
|
||||
catch (ItemNotFoundException)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("{slug}/logo")]
|
||||
public async Task<IActionResult> GetLogo(string slug)
|
||||
{
|
||||
try
|
||||
{
|
||||
Collection collection = await _libraryManager.Get<Collection>(slug);
|
||||
return _files.FileResult(await _thumbs.GetImagePath(collection, Images.Logo));
|
||||
}
|
||||
catch (ItemNotFoundException)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("{slug}/backdrop")]
|
||||
[HttpGet("{slug}/thumbnail")]
|
||||
public async Task<IActionResult> GetBackdrop(string slug)
|
||||
{
|
||||
try
|
||||
{
|
||||
Collection collection = await _libraryManager.Get<Collection>(slug);
|
||||
return _files.FileResult(await _thumbs.GetImagePath(collection, Images.Thumbnail));
|
||||
}
|
||||
catch (ItemNotFoundException)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user