mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-31 04:04:21 -04:00
Add refresh routes for seasons/shows/collections/movies
This commit is contained in:
parent
525da02fce
commit
12aa73376a
@ -47,6 +47,29 @@ public class CollectionApi(
|
|||||||
LibraryItemRepository items
|
LibraryItemRepository items
|
||||||
) : CrudThumbsApi<Collection>(collections)
|
) : CrudThumbsApi<Collection>(collections)
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Refresh
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Ask a metadata refresh.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="identifier">The ID or slug of the <see cref="Collection"/>.</param>
|
||||||
|
/// <returns>Nothing</returns>
|
||||||
|
/// <response code="404">No episode with the given ID or slug could be found.</response>
|
||||||
|
[HttpPost("{identifier:id}/refresh")]
|
||||||
|
[PartialPermission(Kind.Write)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||||
|
public async Task<ActionResult> Refresh(Identifier identifier, [FromServices] IScanner scanner)
|
||||||
|
{
|
||||||
|
Guid id = await identifier.Match(
|
||||||
|
id => Task.FromResult(id),
|
||||||
|
async slug => (await collections.Get(slug)).Id
|
||||||
|
);
|
||||||
|
await scanner.SendRefreshRequest(nameof(Collection), id);
|
||||||
|
return NoContent();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Add a movie
|
/// Add a movie
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -38,10 +38,33 @@ namespace Kyoo.Core.Api;
|
|||||||
[Route("movies")]
|
[Route("movies")]
|
||||||
[Route("movie", Order = AlternativeRoute)]
|
[Route("movie", Order = AlternativeRoute)]
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[PartialPermission(nameof(Show))]
|
[PartialPermission(nameof(Movie))]
|
||||||
[ApiDefinition("Shows", Group = ResourcesGroup)]
|
[ApiDefinition("Movie", Group = ResourcesGroup)]
|
||||||
public class MovieApi(ILibraryManager libraryManager) : TranscoderApi<Movie>(libraryManager.Movies)
|
public class MovieApi(ILibraryManager libraryManager) : TranscoderApi<Movie>(libraryManager.Movies)
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Refresh
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Ask a metadata refresh.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="identifier">The ID or slug of the <see cref="Movie"/>.</param>
|
||||||
|
/// <returns>Nothing</returns>
|
||||||
|
/// <response code="404">No episode with the given ID or slug could be found.</response>
|
||||||
|
[HttpPost("{identifier:id}/refresh")]
|
||||||
|
[PartialPermission(Kind.Write)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||||
|
public async Task<ActionResult> Refresh(Identifier identifier, [FromServices] IScanner scanner)
|
||||||
|
{
|
||||||
|
Guid id = await identifier.Match(
|
||||||
|
id => Task.FromResult(id),
|
||||||
|
async slug => (await libraryManager.Movies.Get(slug)).Id
|
||||||
|
);
|
||||||
|
await scanner.SendRefreshRequest(nameof(Movie), id);
|
||||||
|
return NoContent();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get studio that made the show
|
/// Get studio that made the show
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Kyoo. If not, see <https://www.gnu.org/licenses/>.
|
// along with Kyoo. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@ -41,6 +42,29 @@ namespace Kyoo.Core.Api;
|
|||||||
public class SeasonApi(ILibraryManager libraryManager)
|
public class SeasonApi(ILibraryManager libraryManager)
|
||||||
: CrudThumbsApi<Season>(libraryManager.Seasons)
|
: CrudThumbsApi<Season>(libraryManager.Seasons)
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Refresh
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Ask a metadata refresh.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="identifier">The ID or slug of the <see cref="Season"/>.</param>
|
||||||
|
/// <returns>Nothing</returns>
|
||||||
|
/// <response code="404">No episode with the given ID or slug could be found.</response>
|
||||||
|
[HttpPost("{identifier:id}/refresh")]
|
||||||
|
[PartialPermission(Kind.Write)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||||
|
public async Task<ActionResult> Refresh(Identifier identifier, [FromServices] IScanner scanner)
|
||||||
|
{
|
||||||
|
Guid id = await identifier.Match(
|
||||||
|
id => Task.FromResult(id),
|
||||||
|
async slug => (await libraryManager.Seasons.Get(slug)).Id
|
||||||
|
);
|
||||||
|
await scanner.SendRefreshRequest(nameof(Season), id);
|
||||||
|
return NoContent();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get episodes in the season
|
/// Get episodes in the season
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -42,6 +42,29 @@ namespace Kyoo.Core.Api;
|
|||||||
[ApiDefinition("Shows", Group = ResourcesGroup)]
|
[ApiDefinition("Shows", Group = ResourcesGroup)]
|
||||||
public class ShowApi(ILibraryManager libraryManager) : CrudThumbsApi<Show>(libraryManager.Shows)
|
public class ShowApi(ILibraryManager libraryManager) : CrudThumbsApi<Show>(libraryManager.Shows)
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Refresh
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Ask a metadata refresh.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="identifier">The ID or slug of the <see cref="Show"/>.</param>
|
||||||
|
/// <returns>Nothing</returns>
|
||||||
|
/// <response code="404">No episode with the given ID or slug could be found.</response>
|
||||||
|
[HttpPost("{identifier:id}/refresh")]
|
||||||
|
[PartialPermission(Kind.Write)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||||
|
public async Task<ActionResult> Refresh(Identifier identifier, [FromServices] IScanner scanner)
|
||||||
|
{
|
||||||
|
Guid id = await identifier.Match(
|
||||||
|
id => Task.FromResult(id),
|
||||||
|
async slug => (await libraryManager.Shows.Get(slug)).Id
|
||||||
|
);
|
||||||
|
await scanner.SendRefreshRequest(nameof(Show), id);
|
||||||
|
return NoContent();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get seasons of this show
|
/// Get seasons of this show
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user