|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
|
using System.Diagnostics.CodeAnalysis;
|
|
|
|
|
using System.Globalization;
|
|
|
|
|
using System.IO;
|
|
|
|
@ -90,9 +91,9 @@ namespace Jellyfin.Api.Controllers
|
|
|
|
|
[SuppressMessage("Microsoft.Performance", "CA1801:ReviewUnusedParameters", MessageId = "imageType", Justification = "Imported from ServiceStack")]
|
|
|
|
|
[SuppressMessage("Microsoft.Performance", "CA1801:ReviewUnusedParameters", MessageId = "index", Justification = "Imported from ServiceStack")]
|
|
|
|
|
public async Task<ActionResult> PostUserImage(
|
|
|
|
|
[FromRoute] Guid userId,
|
|
|
|
|
[FromRoute] ImageType imageType,
|
|
|
|
|
[FromRoute] int? index = null)
|
|
|
|
|
[FromRoute, Required] Guid userId,
|
|
|
|
|
[FromRoute, Required] ImageType imageType,
|
|
|
|
|
[FromRoute, Required] int? index = null)
|
|
|
|
|
{
|
|
|
|
|
if (!RequestHelpers.AssertCanUpdateUser(_authContext, HttpContext.Request, userId, true))
|
|
|
|
|
{
|
|
|
|
@ -137,9 +138,9 @@ namespace Jellyfin.Api.Controllers
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status403Forbidden)]
|
|
|
|
|
public ActionResult DeleteUserImage(
|
|
|
|
|
[FromRoute] Guid userId,
|
|
|
|
|
[FromRoute] ImageType imageType,
|
|
|
|
|
[FromRoute] int? index = null)
|
|
|
|
|
[FromRoute, Required] Guid userId,
|
|
|
|
|
[FromRoute, Required] ImageType imageType,
|
|
|
|
|
[FromRoute, Required] int? index = null)
|
|
|
|
|
{
|
|
|
|
|
if (!RequestHelpers.AssertCanUpdateUser(_authContext, HttpContext.Request, userId, true))
|
|
|
|
|
{
|
|
|
|
@ -175,9 +176,9 @@ namespace Jellyfin.Api.Controllers
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
|
|
|
|
public async Task<ActionResult> DeleteItemImage(
|
|
|
|
|
[FromRoute] Guid itemId,
|
|
|
|
|
[FromRoute] ImageType imageType,
|
|
|
|
|
[FromRoute] int? imageIndex = null)
|
|
|
|
|
[FromRoute, Required] Guid itemId,
|
|
|
|
|
[FromRoute, Required] ImageType imageType,
|
|
|
|
|
[FromRoute, Required] int? imageIndex = null)
|
|
|
|
|
{
|
|
|
|
|
var item = _libraryManager.GetItemById(itemId);
|
|
|
|
|
if (item == null)
|
|
|
|
@ -205,9 +206,9 @@ namespace Jellyfin.Api.Controllers
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
|
|
|
|
[SuppressMessage("Microsoft.Performance", "CA1801:ReviewUnusedParameters", MessageId = "index", Justification = "Imported from ServiceStack")]
|
|
|
|
|
public async Task<ActionResult> SetItemImage(
|
|
|
|
|
[FromRoute] Guid itemId,
|
|
|
|
|
[FromRoute] ImageType imageType,
|
|
|
|
|
[FromRoute] int? imageIndex = null)
|
|
|
|
|
[FromRoute, Required] Guid itemId,
|
|
|
|
|
[FromRoute, Required] ImageType imageType,
|
|
|
|
|
[FromRoute, Required] int? imageIndex = null)
|
|
|
|
|
{
|
|
|
|
|
var item = _libraryManager.GetItemById(itemId);
|
|
|
|
|
if (item == null)
|
|
|
|
@ -238,9 +239,9 @@ namespace Jellyfin.Api.Controllers
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
|
|
|
|
public async Task<ActionResult> UpdateItemImageIndex(
|
|
|
|
|
[FromRoute] Guid itemId,
|
|
|
|
|
[FromRoute] ImageType imageType,
|
|
|
|
|
[FromRoute] int imageIndex,
|
|
|
|
|
[FromRoute, Required] Guid itemId,
|
|
|
|
|
[FromRoute, Required] ImageType imageType,
|
|
|
|
|
[FromRoute, Required] int imageIndex,
|
|
|
|
|
[FromQuery] int newIndex)
|
|
|
|
|
{
|
|
|
|
|
var item = _libraryManager.GetItemById(itemId);
|
|
|
|
@ -264,7 +265,7 @@ namespace Jellyfin.Api.Controllers
|
|
|
|
|
[Authorize(Policy = Policies.DefaultAuthorization)]
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
|
|
|
|
public async Task<ActionResult<IEnumerable<ImageInfo>>> GetItemImageInfos([FromRoute] Guid itemId)
|
|
|
|
|
public async Task<ActionResult<IEnumerable<ImageInfo>>> GetItemImageInfos([FromRoute, Required] Guid itemId)
|
|
|
|
|
{
|
|
|
|
|
var item = _libraryManager.GetItemById(itemId);
|
|
|
|
|
if (item == null)
|
|
|
|
@ -352,10 +353,10 @@ namespace Jellyfin.Api.Controllers
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
|
|
|
|
public async Task<ActionResult> GetItemImage(
|
|
|
|
|
[FromRoute] Guid itemId,
|
|
|
|
|
[FromRoute] ImageType imageType,
|
|
|
|
|
[FromRoute] int? maxWidth,
|
|
|
|
|
[FromRoute] int? maxHeight,
|
|
|
|
|
[FromRoute, Required] Guid itemId,
|
|
|
|
|
[FromRoute, Required] ImageType imageType,
|
|
|
|
|
[FromRoute, Required] int? maxWidth,
|
|
|
|
|
[FromRoute, Required] int? maxHeight,
|
|
|
|
|
[FromQuery] int? width,
|
|
|
|
|
[FromQuery] int? height,
|
|
|
|
|
[FromQuery] int? quality,
|
|
|
|
@ -368,7 +369,7 @@ namespace Jellyfin.Api.Controllers
|
|
|
|
|
[FromQuery] int? blur,
|
|
|
|
|
[FromQuery] string? backgroundColor,
|
|
|
|
|
[FromQuery] string? foregroundLayer,
|
|
|
|
|
[FromRoute] int? imageIndex = null)
|
|
|
|
|
[FromRoute, Required] int? imageIndex = null)
|
|
|
|
|
{
|
|
|
|
|
var item = _libraryManager.GetItemById(itemId);
|
|
|
|
|
if (item == null)
|
|
|
|
@ -430,23 +431,23 @@ namespace Jellyfin.Api.Controllers
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
|
|
|
|
public async Task<ActionResult> GetItemImage2(
|
|
|
|
|
[FromRoute] Guid itemId,
|
|
|
|
|
[FromRoute] ImageType imageType,
|
|
|
|
|
[FromRoute] int? maxWidth,
|
|
|
|
|
[FromRoute] int? maxHeight,
|
|
|
|
|
[FromRoute, Required] Guid itemId,
|
|
|
|
|
[FromRoute, Required] ImageType imageType,
|
|
|
|
|
[FromRoute, Required] int? maxWidth,
|
|
|
|
|
[FromRoute, Required] int? maxHeight,
|
|
|
|
|
[FromQuery] int? width,
|
|
|
|
|
[FromQuery] int? height,
|
|
|
|
|
[FromQuery] int? quality,
|
|
|
|
|
[FromRoute] string tag,
|
|
|
|
|
[FromRoute, Required] string tag,
|
|
|
|
|
[FromQuery] bool? cropWhitespace,
|
|
|
|
|
[FromRoute] string format,
|
|
|
|
|
[FromRoute, Required] string format,
|
|
|
|
|
[FromQuery] bool? addPlayedIndicator,
|
|
|
|
|
[FromRoute] double? percentPlayed,
|
|
|
|
|
[FromRoute] int? unplayedCount,
|
|
|
|
|
[FromRoute, Required] double? percentPlayed,
|
|
|
|
|
[FromRoute, Required] int? unplayedCount,
|
|
|
|
|
[FromQuery] int? blur,
|
|
|
|
|
[FromQuery] string? backgroundColor,
|
|
|
|
|
[FromQuery] string? foregroundLayer,
|
|
|
|
|
[FromRoute] int? imageIndex = null)
|
|
|
|
|
[FromRoute, Required] int? imageIndex = null)
|
|
|
|
|
{
|
|
|
|
|
var item = _libraryManager.GetItemById(itemId);
|
|
|
|
|
if (item == null)
|
|
|
|
@ -508,14 +509,14 @@ namespace Jellyfin.Api.Controllers
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
|
|
|
|
public async Task<ActionResult> GetArtistImage(
|
|
|
|
|
[FromRoute] string name,
|
|
|
|
|
[FromRoute] ImageType imageType,
|
|
|
|
|
[FromRoute] string tag,
|
|
|
|
|
[FromRoute] string format,
|
|
|
|
|
[FromRoute] int? maxWidth,
|
|
|
|
|
[FromRoute] int? maxHeight,
|
|
|
|
|
[FromRoute] double? percentPlayed,
|
|
|
|
|
[FromRoute] int? unplayedCount,
|
|
|
|
|
[FromRoute, Required] string name,
|
|
|
|
|
[FromRoute, Required] ImageType imageType,
|
|
|
|
|
[FromRoute, Required] string tag,
|
|
|
|
|
[FromRoute, Required] string format,
|
|
|
|
|
[FromRoute, Required] int? maxWidth,
|
|
|
|
|
[FromRoute, Required] int? maxHeight,
|
|
|
|
|
[FromRoute, Required] double? percentPlayed,
|
|
|
|
|
[FromRoute, Required] int? unplayedCount,
|
|
|
|
|
[FromQuery] int? width,
|
|
|
|
|
[FromQuery] int? height,
|
|
|
|
|
[FromQuery] int? quality,
|
|
|
|
@ -524,7 +525,7 @@ namespace Jellyfin.Api.Controllers
|
|
|
|
|
[FromQuery] int? blur,
|
|
|
|
|
[FromQuery] string? backgroundColor,
|
|
|
|
|
[FromQuery] string? foregroundLayer,
|
|
|
|
|
[FromRoute] int? imageIndex = null)
|
|
|
|
|
[FromRoute, Required] int? imageIndex = null)
|
|
|
|
|
{
|
|
|
|
|
var item = _libraryManager.GetArtist(name);
|
|
|
|
|
if (item == null)
|
|
|
|
@ -586,14 +587,14 @@ namespace Jellyfin.Api.Controllers
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
|
|
|
|
public async Task<ActionResult> GetGenreImage(
|
|
|
|
|
[FromRoute] string name,
|
|
|
|
|
[FromRoute] ImageType imageType,
|
|
|
|
|
[FromRoute] string tag,
|
|
|
|
|
[FromRoute] string format,
|
|
|
|
|
[FromRoute] int? maxWidth,
|
|
|
|
|
[FromRoute] int? maxHeight,
|
|
|
|
|
[FromRoute] double? percentPlayed,
|
|
|
|
|
[FromRoute] int? unplayedCount,
|
|
|
|
|
[FromRoute, Required] string name,
|
|
|
|
|
[FromRoute, Required] ImageType imageType,
|
|
|
|
|
[FromRoute, Required] string tag,
|
|
|
|
|
[FromRoute, Required] string format,
|
|
|
|
|
[FromRoute, Required] int? maxWidth,
|
|
|
|
|
[FromRoute, Required] int? maxHeight,
|
|
|
|
|
[FromRoute, Required] double? percentPlayed,
|
|
|
|
|
[FromRoute, Required] int? unplayedCount,
|
|
|
|
|
[FromQuery] int? width,
|
|
|
|
|
[FromQuery] int? height,
|
|
|
|
|
[FromQuery] int? quality,
|
|
|
|
@ -602,7 +603,7 @@ namespace Jellyfin.Api.Controllers
|
|
|
|
|
[FromQuery] int? blur,
|
|
|
|
|
[FromQuery] string? backgroundColor,
|
|
|
|
|
[FromQuery] string? foregroundLayer,
|
|
|
|
|
[FromRoute] int? imageIndex = null)
|
|
|
|
|
[FromRoute, Required] int? imageIndex = null)
|
|
|
|
|
{
|
|
|
|
|
var item = _libraryManager.GetGenre(name);
|
|
|
|
|
if (item == null)
|
|
|
|
@ -664,14 +665,14 @@ namespace Jellyfin.Api.Controllers
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
|
|
|
|
public async Task<ActionResult> GetMusicGenreImage(
|
|
|
|
|
[FromRoute] string name,
|
|
|
|
|
[FromRoute] ImageType imageType,
|
|
|
|
|
[FromRoute] string tag,
|
|
|
|
|
[FromRoute] string format,
|
|
|
|
|
[FromRoute] int? maxWidth,
|
|
|
|
|
[FromRoute] int? maxHeight,
|
|
|
|
|
[FromRoute] double? percentPlayed,
|
|
|
|
|
[FromRoute] int? unplayedCount,
|
|
|
|
|
[FromRoute, Required] string name,
|
|
|
|
|
[FromRoute, Required] ImageType imageType,
|
|
|
|
|
[FromRoute, Required] string tag,
|
|
|
|
|
[FromRoute, Required] string format,
|
|
|
|
|
[FromRoute, Required] int? maxWidth,
|
|
|
|
|
[FromRoute, Required] int? maxHeight,
|
|
|
|
|
[FromRoute, Required] double? percentPlayed,
|
|
|
|
|
[FromRoute, Required] int? unplayedCount,
|
|
|
|
|
[FromQuery] int? width,
|
|
|
|
|
[FromQuery] int? height,
|
|
|
|
|
[FromQuery] int? quality,
|
|
|
|
@ -680,7 +681,7 @@ namespace Jellyfin.Api.Controllers
|
|
|
|
|
[FromQuery] int? blur,
|
|
|
|
|
[FromQuery] string? backgroundColor,
|
|
|
|
|
[FromQuery] string? foregroundLayer,
|
|
|
|
|
[FromRoute] int? imageIndex = null)
|
|
|
|
|
[FromRoute, Required] int? imageIndex = null)
|
|
|
|
|
{
|
|
|
|
|
var item = _libraryManager.GetMusicGenre(name);
|
|
|
|
|
if (item == null)
|
|
|
|
@ -742,14 +743,14 @@ namespace Jellyfin.Api.Controllers
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
|
|
|
|
public async Task<ActionResult> GetPersonImage(
|
|
|
|
|
[FromRoute] string name,
|
|
|
|
|
[FromRoute] ImageType imageType,
|
|
|
|
|
[FromRoute] string tag,
|
|
|
|
|
[FromRoute] string format,
|
|
|
|
|
[FromRoute] int? maxWidth,
|
|
|
|
|
[FromRoute] int? maxHeight,
|
|
|
|
|
[FromRoute] double? percentPlayed,
|
|
|
|
|
[FromRoute] int? unplayedCount,
|
|
|
|
|
[FromRoute, Required] string name,
|
|
|
|
|
[FromRoute, Required] ImageType imageType,
|
|
|
|
|
[FromRoute, Required] string tag,
|
|
|
|
|
[FromRoute, Required] string format,
|
|
|
|
|
[FromRoute, Required] int? maxWidth,
|
|
|
|
|
[FromRoute, Required] int? maxHeight,
|
|
|
|
|
[FromRoute, Required] double? percentPlayed,
|
|
|
|
|
[FromRoute, Required] int? unplayedCount,
|
|
|
|
|
[FromQuery] int? width,
|
|
|
|
|
[FromQuery] int? height,
|
|
|
|
|
[FromQuery] int? quality,
|
|
|
|
@ -758,7 +759,7 @@ namespace Jellyfin.Api.Controllers
|
|
|
|
|
[FromQuery] int? blur,
|
|
|
|
|
[FromQuery] string? backgroundColor,
|
|
|
|
|
[FromQuery] string? foregroundLayer,
|
|
|
|
|
[FromRoute] int? imageIndex = null)
|
|
|
|
|
[FromRoute, Required] int? imageIndex = null)
|
|
|
|
|
{
|
|
|
|
|
var item = _libraryManager.GetPerson(name);
|
|
|
|
|
if (item == null)
|
|
|
|
@ -820,14 +821,14 @@ namespace Jellyfin.Api.Controllers
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
|
|
|
|
public async Task<ActionResult> GetStudioImage(
|
|
|
|
|
[FromRoute] string name,
|
|
|
|
|
[FromRoute] ImageType imageType,
|
|
|
|
|
[FromRoute] string tag,
|
|
|
|
|
[FromRoute] string format,
|
|
|
|
|
[FromRoute] int? maxWidth,
|
|
|
|
|
[FromRoute] int? maxHeight,
|
|
|
|
|
[FromRoute] double? percentPlayed,
|
|
|
|
|
[FromRoute] int? unplayedCount,
|
|
|
|
|
[FromRoute, Required] string name,
|
|
|
|
|
[FromRoute, Required] ImageType imageType,
|
|
|
|
|
[FromRoute, Required] string tag,
|
|
|
|
|
[FromRoute, Required] string format,
|
|
|
|
|
[FromRoute, Required] int? maxWidth,
|
|
|
|
|
[FromRoute, Required] int? maxHeight,
|
|
|
|
|
[FromRoute, Required] double? percentPlayed,
|
|
|
|
|
[FromRoute, Required] int? unplayedCount,
|
|
|
|
|
[FromQuery] int? width,
|
|
|
|
|
[FromQuery] int? height,
|
|
|
|
|
[FromQuery] int? quality,
|
|
|
|
@ -836,7 +837,7 @@ namespace Jellyfin.Api.Controllers
|
|
|
|
|
[FromQuery] int? blur,
|
|
|
|
|
[FromQuery] string? backgroundColor,
|
|
|
|
|
[FromQuery] string? foregroundLayer,
|
|
|
|
|
[FromRoute] int? imageIndex = null)
|
|
|
|
|
[FromRoute, Required] int? imageIndex = null)
|
|
|
|
|
{
|
|
|
|
|
var item = _libraryManager.GetStudio(name);
|
|
|
|
|
if (item == null)
|
|
|
|
@ -898,8 +899,8 @@ namespace Jellyfin.Api.Controllers
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
|
|
|
|
public async Task<ActionResult> GetUserImage(
|
|
|
|
|
[FromRoute] Guid userId,
|
|
|
|
|
[FromRoute] ImageType imageType,
|
|
|
|
|
[FromRoute, Required] Guid userId,
|
|
|
|
|
[FromRoute, Required] ImageType imageType,
|
|
|
|
|
[FromQuery] string? tag,
|
|
|
|
|
[FromQuery] string? format,
|
|
|
|
|
[FromQuery] int? maxWidth,
|
|
|
|
@ -914,7 +915,7 @@ namespace Jellyfin.Api.Controllers
|
|
|
|
|
[FromQuery] int? blur,
|
|
|
|
|
[FromQuery] string? backgroundColor,
|
|
|
|
|
[FromQuery] string? foregroundLayer,
|
|
|
|
|
[FromRoute] int? imageIndex = null)
|
|
|
|
|
[FromRoute, Required] int? imageIndex = null)
|
|
|
|
|
{
|
|
|
|
|
var user = _userManager.GetUserById(userId);
|
|
|
|
|
if (user == null)
|
|
|
|
|