mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-05-31 12:58:28 +01:00
Merge branch 'master' into network-rewrite
This commit is contained in:
@@ -251,8 +251,6 @@ public class ItemUpdateController : BaseJellyfinApiController
|
||||
channel.Height = request.Height.Value;
|
||||
}
|
||||
|
||||
item.Tags = request.Tags;
|
||||
|
||||
if (request.Taglines is not null)
|
||||
{
|
||||
item.Tagline = request.Taglines.FirstOrDefault();
|
||||
@@ -276,12 +274,19 @@ public class ItemUpdateController : BaseJellyfinApiController
|
||||
item.OfficialRating = request.OfficialRating;
|
||||
item.CustomRating = request.CustomRating;
|
||||
|
||||
var currentTags = item.Tags;
|
||||
var newTags = request.Tags;
|
||||
var removedTags = currentTags.Except(newTags).ToList();
|
||||
var addedTags = newTags.Except(currentTags).ToList();
|
||||
item.Tags = newTags;
|
||||
|
||||
if (item is Series rseries)
|
||||
{
|
||||
foreach (Season season in rseries.Children)
|
||||
{
|
||||
season.OfficialRating = request.OfficialRating;
|
||||
season.CustomRating = request.CustomRating;
|
||||
season.Tags = season.Tags.Concat(addedTags).Except(removedTags).Distinct().ToArray();
|
||||
season.OnMetadataChanged();
|
||||
await season.UpdateToRepositoryAsync(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false);
|
||||
|
||||
@@ -289,6 +294,7 @@ public class ItemUpdateController : BaseJellyfinApiController
|
||||
{
|
||||
ep.OfficialRating = request.OfficialRating;
|
||||
ep.CustomRating = request.CustomRating;
|
||||
ep.Tags = ep.Tags.Concat(addedTags).Except(removedTags).Distinct().ToArray();
|
||||
ep.OnMetadataChanged();
|
||||
await ep.UpdateToRepositoryAsync(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false);
|
||||
}
|
||||
@@ -300,6 +306,7 @@ public class ItemUpdateController : BaseJellyfinApiController
|
||||
{
|
||||
ep.OfficialRating = request.OfficialRating;
|
||||
ep.CustomRating = request.CustomRating;
|
||||
ep.Tags = ep.Tags.Concat(addedTags).Except(removedTags).Distinct().ToArray();
|
||||
ep.OnMetadataChanged();
|
||||
await ep.UpdateToRepositoryAsync(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false);
|
||||
}
|
||||
@@ -310,6 +317,7 @@ public class ItemUpdateController : BaseJellyfinApiController
|
||||
{
|
||||
track.OfficialRating = request.OfficialRating;
|
||||
track.CustomRating = request.CustomRating;
|
||||
track.Tags = track.Tags.Concat(addedTags).Except(removedTags).Distinct().ToArray();
|
||||
track.OnMetadataChanged();
|
||||
await track.UpdateToRepositoryAsync(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
@@ -503,6 +503,7 @@ public class ItemsController : BaseJellyfinApiController
|
||||
}
|
||||
}
|
||||
|
||||
query.Parent = null;
|
||||
result = folder.GetItems(query);
|
||||
}
|
||||
else
|
||||
@@ -511,10 +512,12 @@ public class ItemsController : BaseJellyfinApiController
|
||||
result = new QueryResult<BaseItem>(itemsArray);
|
||||
}
|
||||
|
||||
// result might include items not accessible by the user, DtoService will remove them
|
||||
var accessibleItems = _dtoService.GetBaseItemDtos(result.Items, dtoOptions, user);
|
||||
return new QueryResult<BaseItemDto>(
|
||||
startIndex,
|
||||
result.TotalRecordCount,
|
||||
_dtoService.GetBaseItemDtos(result.Items, dtoOptions, user));
|
||||
accessibleItems.Count,
|
||||
accessibleItems);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -64,6 +64,7 @@ public class PlaylistsController : BaseJellyfinApiController
|
||||
/// <param name="userId">The user id.</param>
|
||||
/// <param name="mediaType">The media type.</param>
|
||||
/// <param name="createPlaylistRequest">The create playlist payload.</param>
|
||||
/// <response code="200">Playlist created.</response>
|
||||
/// <returns>
|
||||
/// A <see cref="Task" /> that represents the asynchronous operation to create a playlist.
|
||||
/// The task result contains an <see cref="OkResult"/> indicating success.
|
||||
@@ -167,6 +168,8 @@ public class PlaylistsController : BaseJellyfinApiController
|
||||
/// <response code="404">Playlist not found.</response>
|
||||
/// <returns>The original playlist items.</returns>
|
||||
[HttpGet("{playlistId}/Items")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
public ActionResult<QueryResult<BaseItemDto>> GetPlaylistItems(
|
||||
[FromRoute, Required] Guid playlistId,
|
||||
[FromQuery, Required] Guid userId,
|
||||
@@ -189,9 +192,7 @@ public class PlaylistsController : BaseJellyfinApiController
|
||||
: _userManager.GetUserById(userId);
|
||||
|
||||
var items = playlist.GetManageableItems().ToArray();
|
||||
|
||||
var count = items.Length;
|
||||
|
||||
if (startIndex.HasValue)
|
||||
{
|
||||
items = items.Skip(startIndex.Value).ToArray();
|
||||
@@ -207,7 +208,6 @@ public class PlaylistsController : BaseJellyfinApiController
|
||||
.AddAdditionalDtoOptions(enableImages, enableUserData, imageTypeLimit, enableImageTypes);
|
||||
|
||||
var dtos = _dtoService.GetBaseItemDtos(items.Select(i => i.Item2).ToList(), dtoOptions, user);
|
||||
|
||||
for (int index = 0; index < dtos.Count; index++)
|
||||
{
|
||||
dtos[index].PlaylistItemId = items[index].Item1.Id;
|
||||
|
||||
Reference in New Issue
Block a user