Adds playlist management and playback

This commit is contained in:
BinaryAlley committed 2026-10-21 16:30:58 +03:00
1 parent 009a0c8156
commit 9889c86c76
296 files changed
+18830 -367

No files matched your search

@@ -0,0 +1,24 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Presentation.Web.Common.Enums.Playlists;
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.DTO.Playlists;
/// <summary>
/// Data transfer object for the editable scalars of a playlist after a details update.
/// </summary>
/// <param name="Id">The Id of the playlist.</param>
/// <param name="Name">The name of the playlist.</param>
/// <param name="Description">The description of the playlist, if applicable.</param>
/// <param name="Type">The kind of media the playlist holds.</param>
/// <param name="UpdatedOnUtc">The date and time when the playlist was last updated, if applicable.</param>
[DebuggerDisplay("Id: {Id}; Name: {Name}")]
public sealed record PlaylistDetailsDto(
Guid Id,
string Name,
string? Description,
PlaylistType Type,
DateTime? UpdatedOnUtc
);
@@ -0,0 +1,31 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Presentation.Web.Common.Enums.Playlists;
using System;
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.DTO.Playlists;
/// <summary>
/// Data transfer object for a playlist together with its ordered entries.
/// </summary>
/// <param name="Id">The Id of the playlist.</param>
/// <param name="Name">The name of the playlist.</param>
/// <param name="Description">The description of the playlist, if applicable.</param>
/// <param name="Type">The kind of media the playlist holds.</param>
/// <param name="EntryCount">The number of entries the playlist holds, even when only a window of them is returned.</param>
/// <param name="Entries">The ordered entries of the requested window of the playlist.</param>
/// <param name="CreatedOnUtc">The date and time when the playlist was created.</param>
/// <param name="UpdatedOnUtc">The date and time when the playlist was last updated, if applicable.</param>
[DebuggerDisplay("Id: {Id}; Name: {Name}; Entries: {Entries.Count}")]
public sealed record PlaylistDto(
Guid Id,
string Name,
string? Description,
PlaylistType Type,
int EntryCount,
List<PlaylistEntryDto> Entries,
DateTime CreatedOnUtc,
DateTime? UpdatedOnUtc
);
@@ -0,0 +1,19 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.DTO.Playlists;
/// <summary>
/// Data transfer object for the result of appending several tracks to a playlist.
/// </summary>
/// <param name="PlaylistId">The Id of the playlist the entries were added to.</param>
/// <param name="AddedCount">The number of entries that were appended, including repeated tracks.</param>
/// <param name="UpdatedOnUtc">The date and time when the playlist was last updated, if applicable.</param>
[DebuggerDisplay("PlaylistId: {PlaylistId}; AddedCount: {AddedCount}")]
public sealed record PlaylistEntriesAddedDto(
Guid PlaylistId,
int AddedCount,
DateTime? UpdatedOnUtc
);
@@ -0,0 +1,19 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.DTO.Playlists;
/// <summary>
/// Data transfer object for an entry appended to a playlist.
/// </summary>
/// <param name="PlaylistId">The Id of the playlist the entry was added to.</param>
/// <param name="Entry">The added entry.</param>
/// <param name="UpdatedOnUtc">The date and time when the playlist was last updated, if applicable.</param>
[DebuggerDisplay("PlaylistId: {PlaylistId}; Entry: {Entry.Id}")]
public sealed record PlaylistEntryAddedDto(
Guid PlaylistId,
PlaylistEntryDto Entry,
DateTime? UpdatedOnUtc
);
@@ -0,0 +1,38 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Presentation.Web.Common.Enums.Playlists;
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.DTO.Playlists;
/// <summary>
/// Data transfer object for an ordered playlist entry together with the display details of the media item it references.
/// </summary>
/// <param name="Id">The Id of the entry.</param>
/// <param name="MediaItemId">The Id of the media item referenced by the entry.</param>
/// <param name="MediaItemType">The kind of media item referenced by the entry.</param>
/// <param name="Position">The zero based position of the entry in the playlist.</param>
/// <param name="LibraryId">The Id of the media library that contains the media item, or an empty Guid when the item no longer exists.</param>
/// <param name="CollectionId">The Id of the collection that contains the media item, or an empty Guid when the item no longer exists.</param>
/// <param name="CreatorId">The Id of the creator of the media item, or an empty Guid when the item no longer exists.</param>
/// <param name="MediaItemTitle">The title of the media item, or an empty string when the item no longer exists.</param>
/// <param name="CollectionTitle">The title of the collection that contains the media item, or an empty string when the item no longer exists.</param>
/// <param name="CreatorName">The name of the creator of the media item, or an empty string when the item no longer exists.</param>
/// <param name="DurationInSeconds">The duration of the media item in seconds, or zero when the item no longer exists.</param>
/// <param name="CoverPath">The path of the cover art of the collection, if available.</param>
[DebuggerDisplay("Id: {Id}; MediaItemId: {MediaItemId}; Position: {Position}")]
public sealed record PlaylistEntryDto(
Guid Id,
Guid MediaItemId,
PlaylistMediaItemType MediaItemType,
int Position,
Guid LibraryId,
Guid CollectionId,
Guid CreatorId,
string MediaItemTitle,
string CollectionTitle,
string CreatorName,
int DurationInSeconds,
string? CoverPath
);
@@ -0,0 +1,21 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.DTO.Playlists;
/// <summary>
/// Data transfer object for the result of moving one entry of a playlist to a new position.
/// </summary>
/// <param name="PlaylistId">The Id of the playlist whose entry was moved.</param>
/// <param name="EntryId">The Id of the moved entry.</param>
/// <param name="Position">The new zero based position of the entry.</param>
/// <param name="UpdatedOnUtc">The date and time when the playlist was last updated, if applicable.</param>
[DebuggerDisplay("PlaylistId: {PlaylistId}; EntryId: {EntryId}; Position: {Position}")]
public sealed record PlaylistEntryMovedDto(
Guid PlaylistId,
Guid EntryId,
int Position,
DateTime? UpdatedOnUtc
);
@@ -0,0 +1,28 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Presentation.Web.Common.Enums.Playlists;
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.DTO.Playlists;
/// <summary>
/// Data transfer object for a playlist in a list, without its entries.
/// </summary>
/// <param name="Id">The Id of the playlist.</param>
/// <param name="Name">The name of the playlist.</param>
/// <param name="Description">The description of the playlist, if applicable.</param>
/// <param name="Type">The kind of media the playlist holds.</param>
/// <param name="EntryCount">The number of entries of the playlist.</param>
/// <param name="CreatedOnUtc">The date and time when the playlist was created.</param>
/// <param name="UpdatedOnUtc">The date and time when the playlist was last updated, if applicable.</param>
[DebuggerDisplay("Id: {Id}; Name: {Name}; EntryCount: {EntryCount}")]
public sealed record PlaylistSummaryDto(
Guid Id,
string Name,
string? Description,
PlaylistType Type,
int EntryCount,
DateTime CreatedOnUtc,
DateTime? UpdatedOnUtc
);
@@ -0,0 +1,22 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Enums.Playlists;
/// <summary>
/// Enumeration for the kinds of media item an ordered playlist entry can reference.
/// </summary>
[DebuggerDisplay("{ToString()}")]
public enum PlaylistMediaItemType
{
/// <summary>
/// An entry that references a music track.
/// </summary>
MusicTrack,
/// <summary>
/// An entry that references a video file.
/// </summary>
VideoFile,
}
@@ -0,0 +1,17 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Enums.Playlists;
/// <summary>
/// Enumeration for the kinds of media a playlist can hold.
/// </summary>
[DebuggerDisplay("{ToString()}")]
public enum PlaylistType
{
/// <summary>
/// A playlist whose ordered entries reference music tracks.
/// </summary>
Music,
}
@@ -0,0 +1,16 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Requests.Playlists;
/// <summary>
/// Represents a request for adding several tracks to a playlist of the current user, in order.
/// </summary>
/// <param name="TrackIds">The Ids of the tracks to add, in the order they must take. Required.</param>
[DebuggerDisplay("TrackCount: {TrackIds.Count}")]
public record AddPlaylistEntriesRequest(
List<Guid>? TrackIds
);
@@ -0,0 +1,15 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Requests.Playlists;
/// <summary>
/// Represents a request for adding a track to a playlist of the current user.
/// </summary>
/// <param name="TrackId">The Id of the track to add. Required.</param>
[DebuggerDisplay("TrackId: {TrackId}")]
public record AddPlaylistEntryRequest(
Guid? TrackId
);
@@ -0,0 +1,19 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Requests.Playlists;
/// <summary>
/// Represents a request to add every track of a music library, an artist or an album to a playlist, resolved on the server.
/// </summary>
/// <param name="LibraryId">The Id of the music library the scope belongs to. Required.</param>
/// <param name="ArtistId">The Id of the artist the scope is limited to. Optional.</param>
/// <param name="AlbumId">The Id of the album the scope is limited to. Optional.</param>
[DebuggerDisplay("LibraryId: {LibraryId}; ArtistId: {ArtistId}; AlbumId: {AlbumId}")]
public record AddPlaylistScopeEntriesRequest(
Guid LibraryId,
Guid? ArtistId,
Guid? AlbumId
);
@@ -0,0 +1,19 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Presentation.Web.Common.Enums.Playlists;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Requests.Playlists;
/// <summary>
/// Represents a request for creating a playlist of the current user.
/// </summary>
/// <param name="Name">The name of the playlist. Required.</param>
/// <param name="Description">The description of the playlist. Optional.</param>
/// <param name="Type">The kind of media the playlist holds. Required.</param>
[DebuggerDisplay("Name: {Name}")]
public record CreatePlaylistRequest(
string? Name,
string? Description,
PlaylistType? Type
);
@@ -0,0 +1,16 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Requests.Playlists;
/// <summary>
/// Represents a request for getting a window of the entries of a playlist of the current user.
/// </summary>
/// <param name="Offset">The zero based position of the first entry to return. Optional; defaults to 0.</param>
/// <param name="Limit">The maximum number of entries to return, from 1 to 1000. Optional; defaults to 200.</param>
[DebuggerDisplay("Offset: {Offset}; Limit: {Limit}")]
public record GetPlaylistRequest(
int? Offset,
int? Limit
);
@@ -0,0 +1,14 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Requests.Playlists;
/// <summary>
/// Represents a request for moving one entry of a playlist of the current user to a new position.
/// </summary>
/// <param name="TargetPosition">The new zero based position of the entry. Required.</param>
[DebuggerDisplay("TargetPosition: {TargetPosition}")]
public record MovePlaylistEntryRequest(
int? TargetPosition
);
@@ -0,0 +1,16 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Requests.Playlists;
/// <summary>
/// Represents a request for updating the details of a playlist of the current user.
/// </summary>
/// <param name="Name">The name of the playlist. Required.</param>
/// <param name="Description">The description of the playlist. Optional.</param>
[DebuggerDisplay("Name: {Name}")]
public record UpdatePlaylistRequest(
string? Name,
string? Description
);
@@ -0,0 +1,24 @@
namespace Lumina.Presentation.Web.Common.Routes;
/// <summary>
/// Class for the collection of remote API routes called by this Web application.
/// </summary>
public static partial class ApiRoutes
{
/// <summary>
/// Routes for the playlists endpoints of the remote API.
/// </summary>
public static class Playlists
{
public const string GET_PLAYLISTS = "users/me/playlists";
public const string CREATE_PLAYLIST = "users/me/playlists";
public const string GET_PLAYLIST = "users/me/playlists/{playlistId}";
public const string UPDATE_PLAYLIST = "users/me/playlists/{playlistId}";
public const string DELETE_PLAYLIST = "users/me/playlists/{playlistId}";
public const string ADD_PLAYLIST_ENTRY = "users/me/playlists/{playlistId}/entries";
public const string ADD_PLAYLIST_ENTRIES = "users/me/playlists/{playlistId}/entries-batch";
public const string ADD_PLAYLIST_SCOPE_ENTRIES = "users/me/playlists/{playlistId}/entries-scope";
public const string REMOVE_PLAYLIST_ENTRY = "users/me/playlists/{playlistId}/entries/{playlistEntryId}";
public const string MOVE_PLAYLIST_ENTRY = "users/me/playlists/{playlistId}/entries/{playlistEntryId}/move";
}
}
@@ -0,0 +1,27 @@
namespace Lumina.Presentation.Web.Common.Routes;
/// <summary>
/// Class for the collection of routes defined in the Web application.
/// </summary>
public static partial class WebRoutes
{
/// <summary>
/// Routes for the playlist pages.
/// </summary>
public static class Playlists
{
public const string INDEX = "{culture}/playlists";
public const string GET_PLAYLISTS = "{culture}/playlists/api-get-playlists";
public const string CREATE_PLAYLIST = "{culture}/playlists/api-create-playlist";
public const string ADD = "{culture}/playlists/item";
public const string ITEM = "{culture}/playlists/item/{playlistId}";
public const string GET_PLAYLIST = "{culture}/playlists/item/{playlistId}/api-get-playlist";
public const string UPDATE_PLAYLIST = "{culture}/playlists/item/{playlistId}/api-update-playlist";
public const string DELETE_PLAYLIST = "{culture}/playlists/item/{playlistId}/api-delete-playlist";
public const string ADD_PLAYLIST_ENTRY = "{culture}/playlists/item/{playlistId}/entries/api-add-entry";
public const string ADD_PLAYLIST_ENTRIES = "{culture}/playlists/item/{playlistId}/api-add-entries";
public const string ADD_PLAYLIST_SCOPE_ENTRIES = "{culture}/playlists/item/{playlistId}/api-add-scope-entries";
public const string REMOVE_PLAYLIST_ENTRY = "{culture}/playlists/item/{playlistId}/entries/{playlistEntryId}/api-remove-entry";
public const string MOVE_PLAYLIST_ENTRY = "{culture}/playlists/item/{playlistId}/entries/{playlistEntryId}/api-move-entry";
}
}
@@ -0,0 +1,60 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using Lumina.Presentation.Web.Common.Api;
using Lumina.Presentation.Web.Common.DTO.Playlists;
using Lumina.Presentation.Web.Common.Requests.Playlists;
using Lumina.Presentation.Web.Common.Routes;
using Lumina.Presentation.Web.Core.Endpoints.Common;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using System;
using System.Threading;
using System.Threading.Tasks;
#endregion
namespace Lumina.Presentation.Web.Core.Endpoints.Playlists.AddPlaylistEntries;
/// <summary>
/// API endpoint for the <c>/{culture}/playlists/item/{playlistId}/api-add-entries</c> route.
/// </summary>
public class AddPlaylistEntriesEndpoint : BaseEndpoint<AddPlaylistEntriesRequest, IResult>
{
private readonly IApiHttpClient _apiHttpClient;
/// <summary>
/// Initializes a new instance of the <see cref="AddPlaylistEntriesEndpoint"/> class.
/// </summary>
/// <param name="apiHttpClient">Injected service for interactions with the API.</param>
public AddPlaylistEntriesEndpoint(IApiHttpClient apiHttpClient)
{
_apiHttpClient = apiHttpClient;
}
/// <summary>
/// Configures the endpoint.
/// </summary>
public override void Configure()
{
base.Configure();
Verbs(Http.POST);
Routes(WebRoutes.Playlists.ADD_PLAYLIST_ENTRIES);
DontAutoTag();
Options(options => options.WithTags("Playlists"));
EnableAntiforgery();
}
/// <summary>
/// Adds several tracks to a playlist of the current user, in order.
/// </summary>
/// <param name="request">The request containing the tracks to add.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
public override async Task<IResult> ExecuteAsync(AddPlaylistEntriesRequest request, CancellationToken cancellationToken)
{
// The playlist is identified by the route value, not by any id posted in the body.
string routePlaylistId = HttpContext.Request.RouteValues["playlistId"]?.ToString() ?? string.Empty;
string playlistId = Guid.TryParse(routePlaylistId, out Guid parsedPlaylistId) ? parsedPlaylistId.ToString() : Guid.Empty.ToString();
PlaylistEntriesAddedDto playlist = await _apiHttpClient
.PostAsync<PlaylistEntriesAddedDto, AddPlaylistEntriesRequest>(ApiRoutes.Playlists.ADD_PLAYLIST_ENTRIES.Replace("{playlistId}", playlistId), request, cancellationToken).ConfigureAwait(false);
return JsonSuccess(playlist);
}
}
@@ -0,0 +1,41 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using Lumina.Presentation.Web.Common.DTO.Common;
using Lumina.Presentation.Web.Common.DTO.Playlists;
using Lumina.Presentation.Web.Common.Requests.Playlists;
using System;
using System.Diagnostics.CodeAnalysis;
#endregion
namespace Lumina.Presentation.Web.Core.Endpoints.Playlists.AddPlaylistEntries;
/// <summary>
/// Class used for providing a textual description for the <see cref="AddPlaylistEntriesEndpoint"/> endpoint, for OpenAPI.
/// </summary>
[ExcludeFromCodeCoverage]
public class AddPlaylistEntriesEndpointSummary : Summary<AddPlaylistEntriesEndpoint, AddPlaylistEntriesRequest>
{
/// <summary>
/// Initializes a new instance of the <see cref="AddPlaylistEntriesEndpointSummary"/> class.
/// </summary>
public AddPlaylistEntriesEndpointSummary()
{
Summary = "Adds several tracks to a playlist of the current user.";
Description = "Proxies the request that adds several tracks, in order, to a playlist to the API server. The audio player uses it to add its current queue to a playlist. The number of added entries and the playlist activity time are returned.";
Params["playlistId"] = "The Id of the playlist to add the tracks to.";
ExampleRequest = new AddPlaylistEntriesRequest(
TrackIds:
[
Guid.Parse("9f0e1d2c-3b4a-4c6d-8e7f-9a0b1c2d3e4f"),
Guid.Parse("8e1f2a3b-4c5d-4e6f-8a9b-0c1d2e3f4a5b")
]
);
RequestParam(request => request.TrackIds, "The Ids of the tracks to add, in the order they must take. Required.");
Response(200, "The tracks were added and the number of added entries is returned.",
example: new SuccessResponse<PlaylistEntriesAddedDto>(true, default)
);
}
}
@@ -0,0 +1,60 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using Lumina.Presentation.Web.Common.Api;
using Lumina.Presentation.Web.Common.DTO.Playlists;
using Lumina.Presentation.Web.Common.Requests.Playlists;
using Lumina.Presentation.Web.Common.Routes;
using Lumina.Presentation.Web.Core.Endpoints.Common;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using System;
using System.Threading;
using System.Threading.Tasks;
#endregion
namespace Lumina.Presentation.Web.Core.Endpoints.Playlists.AddPlaylistEntry;
/// <summary>
/// API endpoint for the <c>/{culture}/playlists/item/{playlistId}/entries/api-add-entry</c> route.
/// </summary>
public class AddPlaylistEntryEndpoint : BaseEndpoint<AddPlaylistEntryRequest, IResult>
{
private readonly IApiHttpClient _apiHttpClient;
/// <summary>
/// Initializes a new instance of the <see cref="AddPlaylistEntryEndpoint"/> class.
/// </summary>
/// <param name="apiHttpClient">Injected service for interactions with the API.</param>
public AddPlaylistEntryEndpoint(IApiHttpClient apiHttpClient)
{
_apiHttpClient = apiHttpClient;
}
/// <summary>
/// Configures the endpoint.
/// </summary>
public override void Configure()
{
base.Configure();
Verbs(Http.POST);
Routes(WebRoutes.Playlists.ADD_PLAYLIST_ENTRY);
DontAutoTag();
Options(options => options.WithTags("Playlists"));
EnableAntiforgery();
}
/// <summary>
/// Adds a track to a playlist of the current user.
/// </summary>
/// <param name="request">The request containing the track to add.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
public override async Task<IResult> ExecuteAsync(AddPlaylistEntryRequest request, CancellationToken cancellationToken)
{
// The playlist is identified by the route value, not by any id posted in the body.
string routePlaylistId = HttpContext.Request.RouteValues["playlistId"]?.ToString() ?? string.Empty;
string playlistId = Guid.TryParse(routePlaylistId, out Guid parsedPlaylistId) ? parsedPlaylistId.ToString() : Guid.Empty.ToString();
PlaylistEntryAddedDto playlist = await _apiHttpClient
.PostAsync<PlaylistEntryAddedDto, AddPlaylistEntryRequest>(ApiRoutes.Playlists.ADD_PLAYLIST_ENTRY.Replace("{playlistId}", playlistId), request, cancellationToken).ConfigureAwait(false);
return JsonSuccess(playlist);
}
}
@@ -0,0 +1,37 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using Lumina.Presentation.Web.Common.DTO.Common;
using Lumina.Presentation.Web.Common.DTO.Playlists;
using Lumina.Presentation.Web.Common.Requests.Playlists;
using System;
using System.Diagnostics.CodeAnalysis;
#endregion
namespace Lumina.Presentation.Web.Core.Endpoints.Playlists.AddPlaylistEntry;
/// <summary>
/// Class used for providing a textual description for the <see cref="AddPlaylistEntryEndpoint"/> endpoint, for OpenAPI.
/// </summary>
[ExcludeFromCodeCoverage]
public class AddPlaylistEntryEndpointSummary : Summary<AddPlaylistEntryEndpoint, AddPlaylistEntryRequest>
{
/// <summary>
/// Initializes a new instance of the <see cref="AddPlaylistEntryEndpointSummary"/> class.
/// </summary>
public AddPlaylistEntryEndpointSummary()
{
Summary = "Adds a track to a playlist of the current user.";
Description = "Proxies the request that adds a track to a playlist to the API server. The added entry and the playlist activity time are returned.";
Params["playlistId"] = "The Id of the playlist to add the track to.";
ExampleRequest = new AddPlaylistEntryRequest(
TrackId: Guid.Parse("9f0e1d2c-3b4a-4c6d-8e7f-9a0b1c2d3e4f")
);
RequestParam(request => request.TrackId, "The Id of the track to add. Required.");
Response(200, "The track was added and the resulting entry is returned.",
example: new SuccessResponse<PlaylistEntryAddedDto>(true, default)
);
}
}
@@ -0,0 +1,60 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using Lumina.Presentation.Web.Common.Api;
using Lumina.Presentation.Web.Common.DTO.Playlists;
using Lumina.Presentation.Web.Common.Requests.Playlists;
using Lumina.Presentation.Web.Common.Routes;
using Lumina.Presentation.Web.Core.Endpoints.Common;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using System;
using System.Threading;
using System.Threading.Tasks;
#endregion
namespace Lumina.Presentation.Web.Core.Endpoints.Playlists.AddPlaylistScopeEntries;
/// <summary>
/// API endpoint for the <c>/{culture}/playlists/item/{playlistId}/api-add-scope-entries</c> route.
/// </summary>
public class AddPlaylistScopeEntriesEndpoint : BaseEndpoint<AddPlaylistScopeEntriesRequest, IResult>
{
private readonly IApiHttpClient _apiHttpClient;
/// <summary>
/// Initializes a new instance of the <see cref="AddPlaylistScopeEntriesEndpoint"/> class.
/// </summary>
/// <param name="apiHttpClient">Injected service for interactions with the API.</param>
public AddPlaylistScopeEntriesEndpoint(IApiHttpClient apiHttpClient)
{
_apiHttpClient = apiHttpClient;
}
/// <summary>
/// Configures the endpoint.
/// </summary>
public override void Configure()
{
base.Configure();
Verbs(Http.POST);
Routes(WebRoutes.Playlists.ADD_PLAYLIST_SCOPE_ENTRIES);
DontAutoTag();
Options(options => options.WithTags("Playlists"));
EnableAntiforgery();
}
/// <summary>
/// Adds every track of a music library, an artist or an album to a playlist of the current user.
/// </summary>
/// <param name="request">The request containing the scope whose tracks are appended.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
public override async Task<IResult> ExecuteAsync(AddPlaylistScopeEntriesRequest request, CancellationToken cancellationToken)
{
// The playlist is identified by the route value, not by any id posted in the body.
string routePlaylistId = HttpContext.Request.RouteValues["playlistId"]?.ToString() ?? string.Empty;
string playlistId = Guid.TryParse(routePlaylistId, out Guid parsedPlaylistId) ? parsedPlaylistId.ToString() : Guid.Empty.ToString();
PlaylistEntriesAddedDto result = await _apiHttpClient
.PostAsync<PlaylistEntriesAddedDto, AddPlaylistScopeEntriesRequest>(ApiRoutes.Playlists.ADD_PLAYLIST_SCOPE_ENTRIES.Replace("{playlistId}", playlistId), request, cancellationToken).ConfigureAwait(false);
return JsonSuccess(result);
}
}
@@ -0,0 +1,41 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using Lumina.Presentation.Web.Common.DTO.Common;
using Lumina.Presentation.Web.Common.DTO.Playlists;
using Lumina.Presentation.Web.Common.Requests.Playlists;
using System;
using System.Diagnostics.CodeAnalysis;
#endregion
namespace Lumina.Presentation.Web.Core.Endpoints.Playlists.AddPlaylistScopeEntries;
/// <summary>
/// Class used for providing a textual description for the <see cref="AddPlaylistScopeEntriesEndpoint"/> endpoint, for OpenAPI.
/// </summary>
[ExcludeFromCodeCoverage]
public class AddPlaylistScopeEntriesEndpointSummary : Summary<AddPlaylistScopeEntriesEndpoint, AddPlaylistScopeEntriesRequest>
{
/// <summary>
/// Initializes a new instance of the <see cref="AddPlaylistScopeEntriesEndpointSummary"/> class.
/// </summary>
public AddPlaylistScopeEntriesEndpointSummary()
{
Summary = "Adds every track of a library, artist or album to a playlist of the current user.";
Description = "Proxies the request that appends every track of a music library, an artist or an album to a playlist to the API server, in catalogue order. The server resolves the scope in one set-based statement. An empty scope appends nothing and reports a zero count.";
Params["playlistId"] = "The Id of the playlist to add the tracks to.";
ExampleRequest = new AddPlaylistScopeEntriesRequest(
LibraryId: Guid.Parse("3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a"),
ArtistId: Guid.Parse("d7c41e6a-9f2b-4b1c-9a3e-7f6e5d4c3b2a"),
AlbumId: Guid.Parse("e8d52f7b-0a3c-4c2d-ab4f-8a7b6c5d4e3f")
);
RequestParam(request => request.LibraryId, "The Id of the music library the scope belongs to. Required.");
RequestParam(request => request.ArtistId, "The Id of the artist the scope is limited to. Optional.");
RequestParam(request => request.AlbumId, "The Id of the album the scope is limited to. Optional.");
Response(200, "The scope was appended to the playlist and the number of added entries is returned.",
example: new SuccessResponse<PlaylistEntriesAddedDto>(true, default)
);
}
}
@@ -0,0 +1,55 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using Lumina.Presentation.Web.Common.Api;
using Lumina.Presentation.Web.Common.DTO.Playlists;
using Lumina.Presentation.Web.Common.Requests.Playlists;
using Lumina.Presentation.Web.Common.Routes;
using Lumina.Presentation.Web.Core.Endpoints.Common;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using System.Threading;
using System.Threading.Tasks;
#endregion
namespace Lumina.Presentation.Web.Core.Endpoints.Playlists.CreatePlaylist;
/// <summary>
/// API endpoint for the <c>/{culture}/playlists/api-create-playlist</c> route.
/// </summary>
public class CreatePlaylistEndpoint : BaseEndpoint<CreatePlaylistRequest, IResult>
{
private readonly IApiHttpClient _apiHttpClient;
/// <summary>
/// Initializes a new instance of the <see cref="CreatePlaylistEndpoint"/> class.
/// </summary>
/// <param name="apiHttpClient">Injected service for interactions with the API.</param>
public CreatePlaylistEndpoint(IApiHttpClient apiHttpClient)
{
_apiHttpClient = apiHttpClient;
}
/// <summary>
/// Configures the endpoint.
/// </summary>
public override void Configure()
{
base.Configure();
Verbs(Http.POST);
Routes(WebRoutes.Playlists.CREATE_PLAYLIST);
DontAutoTag();
Options(options => options.WithTags("Playlists"));
EnableAntiforgery();
}
/// <summary>
/// Creates a playlist of the current user.
/// </summary>
/// <param name="request">The request containing the details of the playlist to create.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
public override async Task<IResult> ExecuteAsync(CreatePlaylistRequest request, CancellationToken cancellationToken)
{
PlaylistDto playlist = await _apiHttpClient.PostAsync<PlaylistDto, CreatePlaylistRequest>(ApiRoutes.Playlists.CREATE_PLAYLIST, request, cancellationToken).ConfigureAwait(false);
return JsonSuccess(playlist);
}
}
@@ -0,0 +1,39 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using Lumina.Presentation.Web.Common.DTO.Common;
using Lumina.Presentation.Web.Common.DTO.Playlists;
using Lumina.Presentation.Web.Common.Enums.Playlists;
using Lumina.Presentation.Web.Common.Requests.Playlists;
using System.Diagnostics.CodeAnalysis;
#endregion
namespace Lumina.Presentation.Web.Core.Endpoints.Playlists.CreatePlaylist;
/// <summary>
/// Class used for providing a textual description for the <see cref="CreatePlaylistEndpoint"/> endpoint, for OpenAPI.
/// </summary>
[ExcludeFromCodeCoverage]
public class CreatePlaylistEndpointSummary : Summary<CreatePlaylistEndpoint, CreatePlaylistRequest>
{
/// <summary>
/// Initializes a new instance of the <see cref="CreatePlaylistEndpointSummary"/> class.
/// </summary>
public CreatePlaylistEndpointSummary()
{
Summary = "Creates a playlist of the current user.";
Description = "Proxies the request that creates a playlist of the current user to the API server. The new playlist starts empty.";
ExampleRequest = new CreatePlaylistRequest(
Name: "Evening listening",
Description: "Quiet tracks for the end of the day.",
Type: PlaylistType.Music
);
RequestParam(request => request.Name, "The name of the playlist. Required, maximum 255 characters.");
RequestParam(request => request.Description, "The description of the playlist. Optional, maximum 2000 characters.");
RequestParam(request => request.Type, "The kind of media the playlist holds. Required. Only Music is currently supported.");
Response(200, "The playlist was created and is returned.",
example: new SuccessResponse<PlaylistDto>(true, default)
);
}
}
@@ -0,0 +1,57 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using Lumina.Presentation.Web.Common.Api;
using Lumina.Presentation.Web.Common.Routes;
using Lumina.Presentation.Web.Core.Endpoints.Common;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using System;
using System.Threading;
using System.Threading.Tasks;
#endregion
namespace Lumina.Presentation.Web.Core.Endpoints.Playlists.DeletePlaylist;
/// <summary>
/// API endpoint for the <c>/{culture}/playlists/item/{playlistId}/api-delete-playlist</c> route.
/// </summary>
public class DeletePlaylistEndpoint : BaseEndpoint<FastEndpoints.EmptyRequest, IResult>
{
private readonly IApiHttpClient _apiHttpClient;
/// <summary>
/// Initializes a new instance of the <see cref="DeletePlaylistEndpoint"/> class.
/// </summary>
/// <param name="apiHttpClient">Injected service for interactions with the API.</param>
public DeletePlaylistEndpoint(IApiHttpClient apiHttpClient)
{
_apiHttpClient = apiHttpClient;
}
/// <summary>
/// Configures the endpoint.
/// </summary>
public override void Configure()
{
base.Configure();
Verbs(Http.DELETE);
Routes(WebRoutes.Playlists.DELETE_PLAYLIST);
DontAutoTag();
Options(options => options.WithTags("Playlists"));
EnableAntiforgery();
}
/// <summary>
/// Deletes a playlist of the current user.
/// </summary>
/// <param name="request">The request object.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
public override async Task<IResult> ExecuteAsync(FastEndpoints.EmptyRequest request, CancellationToken cancellationToken)
{
// The route value is normalized to a Guid before it is substituted into the upstream URL, so that a crafted value can never escape its URL segment.
string routePlaylistId = HttpContext.Request.RouteValues["playlistId"]?.ToString() ?? string.Empty;
string playlistId = Guid.TryParse(routePlaylistId, out Guid parsedPlaylistId) ? parsedPlaylistId.ToString() : Guid.Empty.ToString();
await _apiHttpClient.DeleteAsync(ApiRoutes.Playlists.DELETE_PLAYLIST.Replace("{playlistId}", playlistId), cancellationToken).ConfigureAwait(false);
return JsonSuccess();
}
}
@@ -0,0 +1,29 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using Lumina.Presentation.Web.Common.DTO.Common;
using System.Diagnostics.CodeAnalysis;
#endregion
namespace Lumina.Presentation.Web.Core.Endpoints.Playlists.DeletePlaylist;
/// <summary>
/// Class used for providing a textual description for the <see cref="DeletePlaylistEndpoint"/> endpoint, for OpenAPI.
/// </summary>
[ExcludeFromCodeCoverage]
public class DeletePlaylistEndpointSummary : Summary<DeletePlaylistEndpoint>
{
/// <summary>
/// Initializes a new instance of the <see cref="DeletePlaylistEndpointSummary"/> class.
/// </summary>
public DeletePlaylistEndpointSummary()
{
Summary = "Deletes a playlist of the current user.";
Description = "Proxies the request that deletes a playlist and its entries to the API server. The tracks the playlist referenced are not deleted.";
Params["playlistId"] = "The Id of the playlist to delete.";
Response(200, "The playlist was deleted.",
example: new SuccessResponse(true)
);
}
}
@@ -0,0 +1,69 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using Lumina.Presentation.Web.Common.Api;
using Lumina.Presentation.Web.Common.DTO.Playlists;
using Lumina.Presentation.Web.Common.Requests.Playlists;
using Lumina.Presentation.Web.Common.Routes;
using Lumina.Presentation.Web.Core.Endpoints.Common;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using System;
using System.Threading;
using System.Threading.Tasks;
#endregion
namespace Lumina.Presentation.Web.Core.Endpoints.Playlists.GetPlaylist;
/// <summary>
/// API endpoint for the <c>/{culture}/playlists/item/{playlistId}/api-get-playlist</c> route.
/// </summary>
public class GetPlaylistEndpoint : BaseEndpoint<GetPlaylistRequest, IResult>
{
private const int DEFAULT_ENTRY_WINDOW_SIZE = 200;
private const int MAXIMUM_ENTRY_WINDOW_SIZE = 1000;
private readonly IApiHttpClient _apiHttpClient;
/// <summary>
/// Initializes a new instance of the <see cref="GetPlaylistEndpoint"/> class.
/// </summary>
/// <param name="apiHttpClient">Injected service for interactions with the API.</param>
public GetPlaylistEndpoint(IApiHttpClient apiHttpClient)
{
_apiHttpClient = apiHttpClient;
}
/// <summary>
/// Configures the endpoint.
/// </summary>
public override void Configure()
{
base.Configure();
Verbs(Http.GET);
Routes(WebRoutes.Playlists.GET_PLAYLIST);
DontAutoTag();
Options(options => options.WithTags("Playlists"));
}
/// <summary>
/// Retrieves a window of the entries of a playlist of the current user.
/// </summary>
/// <param name="request">The request object.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
public override async Task<IResult> ExecuteAsync(GetPlaylistRequest request, CancellationToken cancellationToken)
{
// The playlist belongs to the authenticated user, so no intermediary may store it, and the response varies by the sign in cookie.
HttpContext.Response.Headers["Cache-Control"] = "private, no-store";
HttpContext.Response.Headers["Vary"] = "Cookie";
// The route value is normalized to a Guid before it is substituted into the upstream URL, so that a crafted value can never escape its URL segment.
string routePlaylistId = HttpContext.Request.RouteValues["playlistId"]?.ToString() ?? string.Empty;
string playlistId = Guid.TryParse(routePlaylistId, out Guid parsedPlaylistId) ? parsedPlaylistId.ToString() : Guid.Empty.ToString();
int offset = request.Offset ?? 0;
// The web tier enforces the same response-window bound before forwarding, so a crafted value cannot make this proxy buffer an
// unbounded playlist response even if it never reaches the API validator.
int limit = Math.Clamp(request.Limit ?? DEFAULT_ENTRY_WINDOW_SIZE, 1, MAXIMUM_ENTRY_WINDOW_SIZE);
string url = ApiRoutes.Playlists.GET_PLAYLIST.Replace("{playlistId}", playlistId) + $"?offset={offset}&limit={limit}";
PlaylistDto playlist = await _apiHttpClient.GetAsync<PlaylistDto>(url, cancellationToken).ConfigureAwait(false);
return JsonSuccess(playlist);
}
}
@@ -0,0 +1,38 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using Lumina.Presentation.Web.Common.DTO.Common;
using Lumina.Presentation.Web.Common.DTO.Playlists;
using Lumina.Presentation.Web.Common.Requests.Playlists;
using System.Diagnostics.CodeAnalysis;
#endregion
namespace Lumina.Presentation.Web.Core.Endpoints.Playlists.GetPlaylist;
/// <summary>
/// Class used for providing a textual description for the <see cref="GetPlaylistEndpoint"/> endpoint, for OpenAPI.
/// </summary>
[ExcludeFromCodeCoverage]
public class GetPlaylistEndpointSummary : Summary<GetPlaylistEndpoint, GetPlaylistRequest>
{
/// <summary>
/// Initializes a new instance of the <see cref="GetPlaylistEndpointSummary"/> class.
/// </summary>
public GetPlaylistEndpointSummary()
{
Summary = "Gets a playlist of the current user.";
Description = "Proxies the request that gets a playlist and a window of its ordered entries to the API server.";
Params["playlistId"] = "The Id of the playlist to get.";
ExampleRequest = new GetPlaylistRequest(
Offset: 0,
Limit: 200
);
RequestParam(request => request.Offset, "The zero based position of the first entry to return. Optional; defaults to 0.");
RequestParam(request => request.Limit, "The maximum number of entries to return, from 1 to 1000. Optional; defaults to 200.");
Response(200, "The playlist and its ordered entries are returned.",
example: new SuccessResponse<PlaylistDto>(true, default)
);
}
}
@@ -0,0 +1,55 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using Lumina.Presentation.Web.Common.Api;
using Lumina.Presentation.Web.Common.DTO.Playlists;
using Lumina.Presentation.Web.Common.Routes;
using Lumina.Presentation.Web.Core.Endpoints.Common;
using Microsoft.AspNetCore.Http;
using System.Threading;
using System.Threading.Tasks;
#endregion
namespace Lumina.Presentation.Web.Core.Endpoints.Playlists.GetPlaylists;
/// <summary>
/// API endpoint for the <c>/{culture}/playlists/api-get-playlists</c> route.
/// </summary>
public class GetPlaylistsEndpoint : BaseEndpoint<EmptyRequest, IResult>
{
private readonly IApiHttpClient _apiHttpClient;
/// <summary>
/// Initializes a new instance of the <see cref="GetPlaylistsEndpoint"/> class.
/// </summary>
/// <param name="apiHttpClient">Injected service for interactions with the API.</param>
public GetPlaylistsEndpoint(IApiHttpClient apiHttpClient)
{
_apiHttpClient = apiHttpClient;
}
/// <summary>
/// Configures the endpoint.
/// </summary>
public override void Configure()
{
base.Configure();
Verbs(Http.GET);
Routes(WebRoutes.Playlists.GET_PLAYLISTS);
DontAutoTag();
Options(options => options.WithTags("Playlists"));
}
/// <summary>
/// Retrieves the playlists of the current user.
/// </summary>
/// <param name="request">The request object.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
public override async Task<IResult> ExecuteAsync(EmptyRequest request, CancellationToken cancellationToken)
{
// The playlists belong to the authenticated user, so no intermediary may store them, and the response varies by the sign in cookie.
HttpContext.Response.Headers["Cache-Control"] = "private, no-store";
HttpContext.Response.Headers["Vary"] = "Cookie";
PlaylistSummaryDto[] response = await _apiHttpClient.GetAsync<PlaylistSummaryDto[]>(ApiRoutes.Playlists.GET_PLAYLISTS, cancellationToken).ConfigureAwait(false);
return JsonSuccess(response);
}
}
@@ -0,0 +1,28 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using Lumina.Presentation.Web.Common.DTO.Common;
using Lumina.Presentation.Web.Common.DTO.Playlists;
using System.Diagnostics.CodeAnalysis;
#endregion
namespace Lumina.Presentation.Web.Core.Endpoints.Playlists.GetPlaylists;
/// <summary>
/// Class used for providing a textual description for the <see cref="GetPlaylistsEndpoint"/> endpoint, for OpenAPI.
/// </summary>
[ExcludeFromCodeCoverage]
public class GetPlaylistsEndpointSummary : Summary<GetPlaylistsEndpoint>
{
/// <summary>
/// Initializes a new instance of the <see cref="GetPlaylistsEndpointSummary"/> class.
/// </summary>
public GetPlaylistsEndpointSummary()
{
Summary = "Gets the playlists of the current user.";
Description = "Proxies the request that lists the playlists of the current user to the API server.";
Response(200, "The playlists of the current user are returned.",
example: new SuccessResponse<PlaylistSummaryDto[]>(true, default)
);
}
}
@@ -0,0 +1,100 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using Lumina.Presentation.Web.Common.Api;
using Lumina.Presentation.Web.Common.DTO.Playlists;
using Lumina.Presentation.Web.Common.DTO.Themes;
using Lumina.Presentation.Web.Common.Primitives;
using Lumina.Presentation.Web.Common.Routes;
using Lumina.Presentation.Web.Common.Services;
using Lumina.Presentation.Web.Core.Endpoints.Common;
using Lumina.Presentation.Web.Core.Themes;
using Microsoft.AspNetCore.Antiforgery;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Localization;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
#endregion
namespace Lumina.Presentation.Web.Core.Endpoints.Playlists.Index;
/// <summary>
/// API endpoint for the <c>/{culture}/playlists</c> route.
/// </summary>
public class PlaylistsIndexViewEndpoint : BaseEndpoint<EmptyRequest, IResult>
{
// The resource base name deliberately excludes the "Core.Resources" segment: the localization factory re-roots it with the configured ResourcesPath.
private const string VIEW_RESOURCE_BASE_NAME = "Lumina.Presentation.Web.Views.Playlists.Index";
private const string VIEW_RESOURCE_LOCATION = "Lumina.Presentation.Web";
// The page key mirrors the path of the Razor view under Core/Views, so that theme templates can override it at the page, section or default scope.
private const string VIEW_PAGE_KEY = "playlists/index";
private readonly IUrlService _urlService;
private readonly ThemePageRenderer _themePageRenderer;
private readonly IAntiforgery _antiforgery;
private readonly IStringLocalizer _localizer;
/// <summary>
/// Initializes a new instance of the <see cref="PlaylistsIndexViewEndpoint"/> class.
/// </summary>
/// <param name="urlService">Injected service for generating URLs from action and controller names, with localization.</param>
/// <param name="themePageRenderer">Injected service for rendering themed pages.</param>
/// <param name="antiforgery">Injected service for anti-forgery token handling.</param>
/// <param name="stringLocalizerFactory">Injected factory used to create the localizer of the view resources.</param>
public PlaylistsIndexViewEndpoint(IUrlService urlService, ThemePageRenderer themePageRenderer, IAntiforgery antiforgery, IStringLocalizerFactory stringLocalizerFactory)
{
_urlService = urlService;
_themePageRenderer = themePageRenderer;
_antiforgery = antiforgery;
_localizer = stringLocalizerFactory.Create(VIEW_RESOURCE_BASE_NAME, VIEW_RESOURCE_LOCATION);
}
/// <summary>
/// Configures the endpoint.
/// </summary>
public override void Configure()
{
base.Configure();
Verbs(Http.GET);
Routes(WebRoutes.Playlists.INDEX);
DontAutoTag();
Options(options => options.WithTags("Playlists"));
}
/// <summary>
/// Displays the playlists of the current user, rendered by the active theme with a fallback to the Razor view.
/// </summary>
/// <param name="request">The request object.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
public override async Task<IResult> ExecuteAsync(EmptyRequest request, CancellationToken cancellationToken)
{
// The page shows the playlists of the authenticated user, so no intermediary may store it, and the response varies by the sign in cookie.
HttpContext.Response.Headers["Cache-Control"] = "private, no-store";
HttpContext.Response.Headers["Vary"] = "Cookie";
// The page creates and deletes playlists, which submit through the form anti-forgery token, so a fresh token is issued for it.
AntiforgeryTokenSet antiforgeryTokens = _antiforgery.GetAndStoreTokens(HttpContext);
string title = _localizer["Title"].Value;
ThemePageDto pageModel = new()
{
PageKey = VIEW_PAGE_KEY,
Title = title,
Description = string.Empty,
PageData = new Dictionary<string, object?>
{
["getPlaylistsUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Playlists.GET_PLAYLISTS) ?? string.Empty,
["addUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Playlists.ADD) ?? string.Empty,
["itemUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Playlists.ITEM, new { playlistId = default(System.Guid) }) ?? string.Empty,
["deleteUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Playlists.DELETE_PLAYLIST, new { playlistId = default(System.Guid) }) ?? string.Empty,
["antiforgeryToken"] = antiforgeryTokens.RequestToken,
["strings"] = ThemePageDataFactory.CreateLocalizedStrings(_localizer)
}
};
Result<ThemePageRenderResultDto> sectionResult = await _themePageRenderer.RenderAsync(pageModel, requestedThemeId: null, cancellationToken).ConfigureAwait(false);
if (sectionResult.IsFailure)
return View("/Core/Views/Playlists/Index.cshtml", viewData: new Dictionary<string, object?> { ["Title"] = title });
return View("/Core/Views/Shared/_ThemedView.cshtml", new ThemeViewDto(sectionResult.Value.Content, sectionResult.Value.Script), new Dictionary<string, object?> { ["Title"] = title });
}
}
@@ -0,0 +1,24 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using System.Diagnostics.CodeAnalysis;
#endregion
namespace Lumina.Presentation.Web.Core.Endpoints.Playlists.Index;
/// <summary>
/// Class used for providing a textual description for the <see cref="PlaylistsIndexViewEndpoint"/> endpoint, for OpenAPI.
/// </summary>
[ExcludeFromCodeCoverage]
public class PlaylistsIndexViewEndpointSummary : Summary<PlaylistsIndexViewEndpoint>
{
/// <summary>
/// Initializes a new instance of the <see cref="PlaylistsIndexViewEndpointSummary"/> class.
/// </summary>
public PlaylistsIndexViewEndpointSummary()
{
Summary = "Renders the playlists page.";
Description = "Renders the page that lists and deletes the playlists of the current user.";
Response(200, "The playlists page is rendered.");
}
}
@@ -0,0 +1,126 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using Lumina.Presentation.Web.Common.DTO.Playlists;
using Lumina.Presentation.Web.Common.DTO.Themes;
using Lumina.Presentation.Web.Common.Enums.Playlists;
using Lumina.Presentation.Web.Common.Primitives;
using Lumina.Presentation.Web.Common.Routes;
using Lumina.Presentation.Web.Common.Services;
using Lumina.Presentation.Web.Core.Endpoints.Common;
using Lumina.Presentation.Web.Core.Themes;
using Microsoft.AspNetCore.Antiforgery;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Localization;
using System;
using System.Collections.Generic;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Threading;
using System.Threading.Tasks;
#endregion
namespace Lumina.Presentation.Web.Core.Endpoints.Playlists.Item;
/// <summary>
/// API endpoint for the <c>/{culture}/playlists/item</c> route.
/// </summary>
public class AddPlaylistViewEndpoint : BaseEndpoint<EmptyRequest, IResult>
{
// The resource base name deliberately excludes the "Core.Resources" segment: the localization factory re-roots it with the configured ResourcesPath.
private const string VIEW_RESOURCE_BASE_NAME = "Lumina.Presentation.Web.Views.Playlists.Item";
private const string VIEW_RESOURCE_LOCATION = "Lumina.Presentation.Web";
// The page key mirrors the path of the Razor view under Core/Views, so that theme templates can override it at the page, section or default scope.
private const string VIEW_PAGE_KEY = "playlists/item";
private static readonly JsonSerializerOptions s_camelCaseJsonOptions = new()
{
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
Converters = { new JsonStringEnumConverter() }
};
private readonly IUrlService _urlService;
private readonly ThemePageRenderer _themePageRenderer;
private readonly IAntiforgery _antiforgery;
private readonly IStringLocalizer _localizer;
/// <summary>
/// Initializes a new instance of the <see cref="AddPlaylistViewEndpoint"/> class.
/// </summary>
/// <param name="urlService">Injected service for generating URLs from action and controller names, with localization.</param>
/// <param name="themePageRenderer">Injected service for rendering themed pages.</param>
/// <param name="antiforgery">Injected service for anti-forgery token handling.</param>
/// <param name="stringLocalizerFactory">Injected factory used to create the localizer of the view resources.</param>
public AddPlaylistViewEndpoint(IUrlService urlService, ThemePageRenderer themePageRenderer, IAntiforgery antiforgery, IStringLocalizerFactory stringLocalizerFactory)
{
_urlService = urlService;
_themePageRenderer = themePageRenderer;
_antiforgery = antiforgery;
_localizer = stringLocalizerFactory.Create(VIEW_RESOURCE_BASE_NAME, VIEW_RESOURCE_LOCATION);
}
/// <summary>
/// Configures the endpoint.
/// </summary>
public override void Configure()
{
base.Configure();
Verbs(Http.GET);
Routes(WebRoutes.Playlists.ADD);
DontAutoTag();
Options(options => options.WithTags("Playlists"));
}
/// <summary>
/// Displays the page that creates a playlist of the current user, rendered by the active theme with a fallback to the Razor view.
/// </summary>
/// <param name="request">The request object.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
public override async Task<IResult> ExecuteAsync(EmptyRequest request, CancellationToken cancellationToken)
{
// The page creates a playlist of the authenticated user, so no intermediary may store it, and the response varies by the sign in cookie.
HttpContext.Response.Headers["Cache-Control"] = "private, no-store";
HttpContext.Response.Headers["Vary"] = "Cookie";
// The page submits through the form anti-forgery token, so a fresh token is issued for it.
AntiforgeryTokenSet antiforgeryTokens = _antiforgery.GetAndStoreTokens(HttpContext);
PlaylistDto playlist = new(
Id: Guid.Empty,
Name: string.Empty,
Description: null,
Type: PlaylistType.Music,
EntryCount: 0,
Entries: [],
CreatedOnUtc: default,
UpdatedOnUtc: null
);
string title = _localizer["CreatePlaylist"].Value;
ThemePageDto pageModel = new()
{
PageKey = VIEW_PAGE_KEY,
Title = title,
Description = string.Empty,
PageData = new Dictionary<string, object?>
{
["isNew"] = true,
["playlistId"] = playlist.Id.ToString(),
["playlistJson"] = JsonSerializer.Serialize(playlist, s_camelCaseJsonOptions),
["createPlaylistUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Playlists.CREATE_PLAYLIST) ?? string.Empty,
["itemUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Playlists.ITEM, new { playlistId = default(Guid) }) ?? string.Empty,
["getEnabledLibrariesUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.LibraryManagement.GET_ENABLED_LIBRARIES) ?? string.Empty,
["getArtistsUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Music.GET_ARTISTS) ?? string.Empty,
["getArtistAlbumsUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Music.GET_ARTIST_ALBUMS, new { artistId = default(Guid) }) ?? string.Empty,
["getAlbumTracksUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Music.GET_ALBUM_TRACKS, new { artistId = default(Guid), albumId = default(Guid) }) ?? string.Empty,
["indexUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Playlists.INDEX) ?? string.Empty,
["antiforgeryToken"] = antiforgeryTokens.RequestToken,
["strings"] = ThemePageDataFactory.CreateLocalizedStrings(_localizer)
}
};
Result<ThemePageRenderResultDto> sectionResult = await _themePageRenderer.RenderAsync(pageModel, requestedThemeId: null, cancellationToken).ConfigureAwait(false);
if (sectionResult.IsFailure)
return View("/Core/Views/Playlists/Item.cshtml", playlist, new Dictionary<string, object?> { ["Title"] = title, ["IsNew"] = true });
return View("/Core/Views/Shared/_ThemedView.cshtml", new ThemeViewDto(sectionResult.Value.Content, sectionResult.Value.Script), new Dictionary<string, object?> { ["Title"] = title, ["IsNew"] = true });
}
}
@@ -0,0 +1,24 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using System.Diagnostics.CodeAnalysis;
#endregion
namespace Lumina.Presentation.Web.Core.Endpoints.Playlists.Item;
/// <summary>
/// Class used for providing a textual description for the <see cref="AddPlaylistViewEndpoint"/> endpoint, for OpenAPI.
/// </summary>
[ExcludeFromCodeCoverage]
public class AddPlaylistViewEndpointSummary : Summary<AddPlaylistViewEndpoint>
{
/// <summary>
/// Initializes a new instance of the <see cref="AddPlaylistViewEndpointSummary"/> class.
/// </summary>
public AddPlaylistViewEndpointSummary()
{
Summary = "Renders the create playlist page.";
Description = "Renders the page that creates a playlist of the current user.";
Response(200, "The create playlist page is rendered.");
}
}
@@ -0,0 +1,135 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using Lumina.Presentation.Web.Common.Api;
using Lumina.Presentation.Web.Common.DTO.Playlists;
using Lumina.Presentation.Web.Common.DTO.Themes;
using Lumina.Presentation.Web.Common.Primitives;
using Lumina.Presentation.Web.Common.Routes;
using Lumina.Presentation.Web.Common.Services;
using Lumina.Presentation.Web.Core.Endpoints.Common;
using Lumina.Presentation.Web.Core.Themes;
using Microsoft.AspNetCore.Antiforgery;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Localization;
using System;
using System.Collections.Generic;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Threading;
using System.Threading.Tasks;
#endregion
namespace Lumina.Presentation.Web.Core.Endpoints.Playlists.Item;
/// <summary>
/// API endpoint for the <c>/{culture}/playlists/item/{playlistId}</c> route.
/// </summary>
public class PlaylistItemViewEndpoint : BaseEndpoint<EmptyRequest, IResult>
{
// The resource base name deliberately excludes the "Core.Resources" segment: the localization factory re-roots it with the configured ResourcesPath.
private const string VIEW_RESOURCE_BASE_NAME = "Lumina.Presentation.Web.Views.Playlists.Item";
private const string VIEW_RESOURCE_LOCATION = "Lumina.Presentation.Web";
// The page key mirrors the path of the Razor view under Core/Views, so that theme templates can override it at the page, section or default scope.
private const string VIEW_PAGE_KEY = "playlists/item";
// The page renders one window at a time; the client asks for the next window through getPlaylistUrl.
private const int ENTRY_WINDOW_SIZE = 200;
private static readonly JsonSerializerOptions s_camelCaseJsonOptions = new()
{
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
Converters = { new JsonStringEnumConverter() }
};
private readonly IApiHttpClient _apiHttpClient;
private readonly IUrlService _urlService;
private readonly ThemePageRenderer _themePageRenderer;
private readonly IAntiforgery _antiforgery;
private readonly IStringLocalizer _localizer;
/// <summary>
/// Initializes a new instance of the <see cref="PlaylistItemViewEndpoint"/> class.
/// </summary>
/// <param name="apiHttpClient">Injected service for interactions with the API.</param>
/// <param name="urlService">Injected service for generating URLs from action and controller names, with localization.</param>
/// <param name="themePageRenderer">Injected service for rendering themed pages.</param>
/// <param name="antiforgery">Injected service for anti-forgery token handling.</param>
/// <param name="stringLocalizerFactory">Injected factory used to create the localizer of the view resources.</param>
public PlaylistItemViewEndpoint(IApiHttpClient apiHttpClient, IUrlService urlService, ThemePageRenderer themePageRenderer, IAntiforgery antiforgery, IStringLocalizerFactory stringLocalizerFactory)
{
_apiHttpClient = apiHttpClient;
_urlService = urlService;
_themePageRenderer = themePageRenderer;
_antiforgery = antiforgery;
_localizer = stringLocalizerFactory.Create(VIEW_RESOURCE_BASE_NAME, VIEW_RESOURCE_LOCATION);
}
/// <summary>
/// Configures the endpoint.
/// </summary>
public override void Configure()
{
base.Configure();
Verbs(Http.GET);
Routes(WebRoutes.Playlists.ITEM);
DontAutoTag();
Options(options => options.WithTags("Playlists"));
}
/// <summary>
/// Displays a playlist of the current user, rendered by the active theme with a fallback to the Razor view.
/// </summary>
/// <param name="request">The request object.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
public override async Task<IResult> ExecuteAsync(EmptyRequest request, CancellationToken cancellationToken)
{
// The page shows a playlist of the authenticated user, so no intermediary may store it, and the response varies by the sign in cookie.
HttpContext.Response.Headers["Cache-Control"] = "private, no-store";
HttpContext.Response.Headers["Vary"] = "Cookie";
// The route value is normalized to a Guid before it is substituted into the upstream URL, so that a crafted value can never escape
// its URL segment, and an unparseable id is reported by the API as a missing playlist id.
string routePlaylistId = HttpContext.Request.RouteValues["playlistId"]?.ToString() ?? string.Empty;
string playlistId = Guid.TryParse(routePlaylistId, out Guid parsedPlaylistId) ? parsedPlaylistId.ToString() : Guid.Empty.ToString();
PlaylistDto playlist = await _apiHttpClient
.GetAsync<PlaylistDto>(
ApiRoutes.Playlists.GET_PLAYLIST.Replace("{playlistId}", playlistId) + $"?offset=0&limit={ENTRY_WINDOW_SIZE}",
cancellationToken).ConfigureAwait(false);
// The page edits, reorders and deletes the playlist, which submit through the form anti-forgery token, so a fresh token is issued for it.
AntiforgeryTokenSet antiforgeryTokens = _antiforgery.GetAndStoreTokens(HttpContext);
ThemePageDto pageModel = new()
{
PageKey = VIEW_PAGE_KEY,
Title = playlist.Name,
Description = playlist.Description ?? string.Empty,
PageData = new Dictionary<string, object?>
{
["isNew"] = false,
["playlistId"] = playlist.Id.ToString(),
["playlistJson"] = JsonSerializer.Serialize(playlist, s_camelCaseJsonOptions),
["entriesWindowSize"] = ENTRY_WINDOW_SIZE,
["createPlaylistUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Playlists.CREATE_PLAYLIST) ?? string.Empty,
["itemUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Playlists.ITEM, new { playlistId = default(Guid) }) ?? string.Empty,
["getPlaylistUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Playlists.GET_PLAYLIST, new { playlistId = playlist.Id }) ?? string.Empty,
["updatePlaylistUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Playlists.UPDATE_PLAYLIST, new { playlistId = playlist.Id }) ?? string.Empty,
["deletePlaylistUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Playlists.DELETE_PLAYLIST, new { playlistId = playlist.Id }) ?? string.Empty,
["addEntryUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Playlists.ADD_PLAYLIST_ENTRY, new { playlistId = playlist.Id }) ?? string.Empty,
["removeEntryUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Playlists.REMOVE_PLAYLIST_ENTRY, new { playlistId = playlist.Id, playlistEntryId = default(Guid) }) ?? string.Empty,
["moveEntryUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Playlists.MOVE_PLAYLIST_ENTRY, new { playlistId = playlist.Id, playlistEntryId = default(Guid) }) ?? string.Empty,
["getEnabledLibrariesUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.LibraryManagement.GET_ENABLED_LIBRARIES) ?? string.Empty,
["getArtistsUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Music.GET_ARTISTS) ?? string.Empty,
["getArtistAlbumsUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Music.GET_ARTIST_ALBUMS, new { artistId = default(Guid) }) ?? string.Empty,
["getAlbumTracksUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Music.GET_ALBUM_TRACKS, new { artistId = default(Guid), albumId = default(Guid) }) ?? string.Empty,
["indexUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Playlists.INDEX) ?? string.Empty,
["antiforgeryToken"] = antiforgeryTokens.RequestToken,
["strings"] = ThemePageDataFactory.CreateLocalizedStrings(_localizer)
}
};
Result<ThemePageRenderResultDto> sectionResult = await _themePageRenderer.RenderAsync(pageModel, requestedThemeId: null, cancellationToken).ConfigureAwait(false);
if (sectionResult.IsFailure)
return View("/Core/Views/Playlists/Item.cshtml", playlist, new Dictionary<string, object?> { ["Title"] = playlist.Name, ["IsNew"] = false });
return View("/Core/Views/Shared/_ThemedView.cshtml", new ThemeViewDto(sectionResult.Value.Content, sectionResult.Value.Script), new Dictionary<string, object?> { ["Title"] = playlist.Name, ["IsNew"] = false });
}
}
@@ -0,0 +1,26 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using System.Diagnostics.CodeAnalysis;
#endregion
namespace Lumina.Presentation.Web.Core.Endpoints.Playlists.Item;
/// <summary>
/// Class used for providing a textual description for the <see cref="PlaylistItemViewEndpoint"/> endpoint, for OpenAPI.
/// </summary>
[ExcludeFromCodeCoverage]
public class PlaylistItemViewEndpointSummary : Summary<PlaylistItemViewEndpoint>
{
/// <summary>
/// Initializes a new instance of the <see cref="PlaylistItemViewEndpointSummary"/> class.
/// </summary>
public PlaylistItemViewEndpointSummary()
{
Summary = "Renders a playlist page.";
Description = "Renders the page that edits, reorders, plays and deletes a playlist of the current user.";
Params["playlistId"] = "The Id of the playlist to display.";
Response(200, "The playlist page is rendered.");
}
}
@@ -0,0 +1,67 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using Lumina.Presentation.Web.Common.Api;
using Lumina.Presentation.Web.Common.DTO.Playlists;
using Lumina.Presentation.Web.Common.Requests.Playlists;
using Lumina.Presentation.Web.Common.Routes;
using Lumina.Presentation.Web.Core.Endpoints.Common;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using System;
using System.Threading;
using System.Threading.Tasks;
#endregion
namespace Lumina.Presentation.Web.Core.Endpoints.Playlists.MovePlaylistEntry;
/// <summary>
/// API endpoint for the <c>/{culture}/playlists/item/{playlistId}/entries/{playlistEntryId}/api-move-entry</c> route.
/// </summary>
public class MovePlaylistEntryEndpoint : BaseEndpoint<MovePlaylistEntryRequest, IResult>
{
private readonly IApiHttpClient _apiHttpClient;
/// <summary>
/// Initializes a new instance of the <see cref="MovePlaylistEntryEndpoint"/> class.
/// </summary>
/// <param name="apiHttpClient">Injected service for interactions with the API.</param>
public MovePlaylistEntryEndpoint(IApiHttpClient apiHttpClient)
{
_apiHttpClient = apiHttpClient;
}
/// <summary>
/// Configures the endpoint.
/// </summary>
public override void Configure()
{
base.Configure();
Verbs(Http.PUT);
Routes(WebRoutes.Playlists.MOVE_PLAYLIST_ENTRY);
DontAutoTag();
Options(options => options.WithTags("Playlists"));
EnableAntiforgery();
}
/// <summary>
/// Moves one entry of a playlist of the current user to a new position.
/// </summary>
/// <param name="request">The request containing the new position of the entry.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
public override async Task<IResult> ExecuteAsync(MovePlaylistEntryRequest request, CancellationToken cancellationToken)
{
// The playlist and the entry are identified by the route values, not by any id posted in the body.
string routePlaylistId = HttpContext.Request.RouteValues["playlistId"]?.ToString() ?? string.Empty;
string playlistId = Guid.TryParse(routePlaylistId, out Guid parsedPlaylistId) ? parsedPlaylistId.ToString() : Guid.Empty.ToString();
string routePlaylistEntryId = HttpContext.Request.RouteValues["playlistEntryId"]?.ToString() ?? string.Empty;
string playlistEntryId = Guid.TryParse(routePlaylistEntryId, out Guid parsedPlaylistEntryId) ? parsedPlaylistEntryId.ToString() : Guid.Empty.ToString();
PlaylistEntryMovedDto entry = await _apiHttpClient
.PutAsync<PlaylistEntryMovedDto, MovePlaylistEntryRequest>(
ApiRoutes.Playlists.MOVE_PLAYLIST_ENTRY
.Replace("{playlistId}", playlistId)
.Replace("{playlistEntryId}", playlistEntryId),
request,
cancellationToken).ConfigureAwait(false);
return JsonSuccess(entry);
}
}
@@ -0,0 +1,37 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using Lumina.Presentation.Web.Common.DTO.Common;
using Lumina.Presentation.Web.Common.DTO.Playlists;
using Lumina.Presentation.Web.Common.Requests.Playlists;
using System.Diagnostics.CodeAnalysis;
#endregion
namespace Lumina.Presentation.Web.Core.Endpoints.Playlists.MovePlaylistEntry;
/// <summary>
/// Class used for providing a textual description for the <see cref="MovePlaylistEntryEndpoint"/> endpoint, for OpenAPI.
/// </summary>
[ExcludeFromCodeCoverage]
public class MovePlaylistEntryEndpointSummary : Summary<MovePlaylistEntryEndpoint, MovePlaylistEntryRequest>
{
/// <summary>
/// Initializes a new instance of the <see cref="MovePlaylistEntryEndpointSummary"/> class.
/// </summary>
public MovePlaylistEntryEndpointSummary()
{
Summary = "Moves one entry of a playlist of the current user.";
Description = "Proxies the request that moves one entry of a playlist to a new position to the API server. The moved entry and its new position are returned.";
Params["playlistId"] = "The Id of the playlist whose entry is moved.";
Params["playlistEntryId"] = "The Id of the entry to move.";
ExampleRequest = new MovePlaylistEntryRequest(
TargetPosition: 3
);
RequestParam(request => request.TargetPosition, "The new zero based position of the entry. Required, zero or greater.");
Response(200, "The moved entry and its new position are returned.",
example: new SuccessResponse<PlaylistEntryMovedDto>(true, default)
);
}
}
@@ -0,0 +1,63 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using Lumina.Presentation.Web.Common.Api;
using Lumina.Presentation.Web.Common.Routes;
using Lumina.Presentation.Web.Core.Endpoints.Common;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using System;
using System.Threading;
using System.Threading.Tasks;
#endregion
namespace Lumina.Presentation.Web.Core.Endpoints.Playlists.RemovePlaylistEntry;
/// <summary>
/// API endpoint for the <c>/{culture}/playlists/item/{playlistId}/entries/{playlistEntryId}/api-remove-entry</c> route.
/// </summary>
public class RemovePlaylistEntryEndpoint : BaseEndpoint<EmptyRequest, IResult>
{
private readonly IApiHttpClient _apiHttpClient;
/// <summary>
/// Initializes a new instance of the <see cref="RemovePlaylistEntryEndpoint"/> class.
/// </summary>
/// <param name="apiHttpClient">Injected service for interactions with the API.</param>
public RemovePlaylistEntryEndpoint(IApiHttpClient apiHttpClient)
{
_apiHttpClient = apiHttpClient;
}
/// <summary>
/// Configures the endpoint.
/// </summary>
public override void Configure()
{
base.Configure();
Verbs(Http.DELETE);
Routes(WebRoutes.Playlists.REMOVE_PLAYLIST_ENTRY);
DontAutoTag();
Options(options => options.WithTags("Playlists"));
EnableAntiforgery();
}
/// <summary>
/// Removes an entry from a playlist of the current user.
/// </summary>
/// <param name="request">The request object.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
public override async Task<IResult> ExecuteAsync(EmptyRequest request, CancellationToken cancellationToken)
{
// The route values are normalized to Guids before they are substituted into the upstream URL, so that a crafted value can never escape its URL segment.
string routePlaylistId = HttpContext.Request.RouteValues["playlistId"]?.ToString() ?? string.Empty;
string playlistId = Guid.TryParse(routePlaylistId, out Guid parsedPlaylistId) ? parsedPlaylistId.ToString() : Guid.Empty.ToString();
string routePlaylistEntryId = HttpContext.Request.RouteValues["playlistEntryId"]?.ToString() ?? string.Empty;
string playlistEntryId = Guid.TryParse(routePlaylistEntryId, out Guid parsedPlaylistEntryId) ? parsedPlaylistEntryId.ToString() : Guid.Empty.ToString();
await _apiHttpClient.DeleteAsync(
ApiRoutes.Playlists.REMOVE_PLAYLIST_ENTRY
.Replace("{playlistId}", playlistId)
.Replace("{playlistEntryId}", playlistEntryId),
cancellationToken).ConfigureAwait(false);
return JsonSuccess();
}
}
@@ -0,0 +1,30 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using Lumina.Presentation.Web.Common.DTO.Common;
using System.Diagnostics.CodeAnalysis;
#endregion
namespace Lumina.Presentation.Web.Core.Endpoints.Playlists.RemovePlaylistEntry;
/// <summary>
/// Class used for providing a textual description for the <see cref="RemovePlaylistEntryEndpoint"/> endpoint, for OpenAPI.
/// </summary>
[ExcludeFromCodeCoverage]
public class RemovePlaylistEntryEndpointSummary : Summary<RemovePlaylistEntryEndpoint>
{
/// <summary>
/// Initializes a new instance of the <see cref="RemovePlaylistEntryEndpointSummary"/> class.
/// </summary>
public RemovePlaylistEntryEndpointSummary()
{
Summary = "Removes an entry from a playlist of the current user.";
Description = "Proxies the request that removes an entry from a playlist to the API server. The page removes the row from its current window without reading the playlist back.";
Params["playlistId"] = "The Id of the playlist the entry belongs to.";
Params["playlistEntryId"] = "The Id of the entry to remove.";
Response(200, "The entry was removed.",
example: new SuccessResponse(true)
);
}
}
@@ -0,0 +1,60 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using Lumina.Presentation.Web.Common.Api;
using Lumina.Presentation.Web.Common.DTO.Playlists;
using Lumina.Presentation.Web.Common.Requests.Playlists;
using Lumina.Presentation.Web.Common.Routes;
using Lumina.Presentation.Web.Core.Endpoints.Common;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using System;
using System.Threading;
using System.Threading.Tasks;
#endregion
namespace Lumina.Presentation.Web.Core.Endpoints.Playlists.UpdatePlaylist;
/// <summary>
/// API endpoint for the <c>/{culture}/playlists/item/{playlistId}/api-update-playlist</c> route.
/// </summary>
public class UpdatePlaylistEndpoint : BaseEndpoint<UpdatePlaylistRequest, IResult>
{
private readonly IApiHttpClient _apiHttpClient;
/// <summary>
/// Initializes a new instance of the <see cref="UpdatePlaylistEndpoint"/> class.
/// </summary>
/// <param name="apiHttpClient">Injected service for interactions with the API.</param>
public UpdatePlaylistEndpoint(IApiHttpClient apiHttpClient)
{
_apiHttpClient = apiHttpClient;
}
/// <summary>
/// Configures the endpoint.
/// </summary>
public override void Configure()
{
base.Configure();
Verbs(Http.PUT);
Routes(WebRoutes.Playlists.UPDATE_PLAYLIST);
DontAutoTag();
Options(options => options.WithTags("Playlists"));
EnableAntiforgery();
}
/// <summary>
/// Updates the details of a playlist of the current user.
/// </summary>
/// <param name="request">The request containing the new details of the playlist.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
public override async Task<IResult> ExecuteAsync(UpdatePlaylistRequest request, CancellationToken cancellationToken)
{
// The playlist is identified by the route value, not by any id posted in the body.
string routePlaylistId = HttpContext.Request.RouteValues["playlistId"]?.ToString() ?? string.Empty;
string playlistId = Guid.TryParse(routePlaylistId, out Guid parsedPlaylistId) ? parsedPlaylistId.ToString() : Guid.Empty.ToString();
PlaylistDetailsDto playlist = await _apiHttpClient
.PutAsync<PlaylistDetailsDto, UpdatePlaylistRequest>(ApiRoutes.Playlists.UPDATE_PLAYLIST.Replace("{playlistId}", playlistId), request, cancellationToken).ConfigureAwait(false);
return JsonSuccess(playlist);
}
}
@@ -0,0 +1,38 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using Lumina.Presentation.Web.Common.DTO.Common;
using Lumina.Presentation.Web.Common.DTO.Playlists;
using Lumina.Presentation.Web.Common.Requests.Playlists;
using System.Diagnostics.CodeAnalysis;
#endregion
namespace Lumina.Presentation.Web.Core.Endpoints.Playlists.UpdatePlaylist;
/// <summary>
/// Class used for providing a textual description for the <see cref="UpdatePlaylistEndpoint"/> endpoint, for OpenAPI.
/// </summary>
[ExcludeFromCodeCoverage]
public class UpdatePlaylistEndpointSummary : Summary<UpdatePlaylistEndpoint, UpdatePlaylistRequest>
{
/// <summary>
/// Initializes a new instance of the <see cref="UpdatePlaylistEndpointSummary"/> class.
/// </summary>
public UpdatePlaylistEndpointSummary()
{
Summary = "Updates the details of a playlist of the current user.";
Description = "Proxies the request that updates the name and description of a playlist to the API server. The ordered entries of the playlist are left untouched.";
Params["playlistId"] = "The Id of the playlist to update.";
ExampleRequest = new UpdatePlaylistRequest(
Name: "Evening listening",
Description: "Quiet tracks for the end of the day."
);
RequestParam(request => request.Name, "The name of the playlist. Required, maximum 255 characters.");
RequestParam(request => request.Description, "The description of the playlist. Optional, maximum 2000 characters.");
Response(200, "The updated playlist details are returned.",
example: new SuccessResponse<PlaylistDetailsDto>(true, default)
);
}
}
@@ -127,6 +127,9 @@
<value>تشغيل</value>
</data>
<data name="Actions" xml:space="preserve">
<value>الإجراءات</value>
<value>الإجراءات</value>
</data>
<data name="AddToPlaylist" xml:space="preserve">
<value>إضافة إلى قائمة التشغيل</value>
</data>
</root>
@@ -129,4 +129,7 @@
<data name="Actions" xml:space="preserve">
<value>Aktionen</value>
</data>
<data name="AddToPlaylist" xml:space="preserve">
<value>Zur Wiedergabeliste hinzufügen</value>
</data>
</root>
@@ -129,4 +129,7 @@
<data name="Actions" xml:space="preserve">
<value>Actions</value>
</data>
<data name="AddToPlaylist" xml:space="preserve">
<value>Add to playlist</value>
</data>
</root>
@@ -129,4 +129,7 @@
<data name="Actions" xml:space="preserve">
<value>Acciones</value>
</data>
<data name="AddToPlaylist" xml:space="preserve">
<value>Añadir a la lista de reproducción</value>
</data>
</root>
@@ -129,4 +129,7 @@
<data name="Actions" xml:space="preserve">
<value>Actions</value>
</data>
<data name="AddToPlaylist" xml:space="preserve">
<value>Ajouter à la liste de lecture</value>
</data>
</root>
@@ -129,4 +129,7 @@
<data name="Actions" xml:space="preserve">
<value>Azioni</value>
</data>
<data name="AddToPlaylist" xml:space="preserve">
<value>Aggiungi alla playlist</value>
</data>
</root>
@@ -127,6 +127,9 @@
<value>再生</value>
</data>
<data name="Actions" xml:space="preserve">
<value>操作</value>
<value>操作</value>
</data>
<data name="AddToPlaylist" xml:space="preserve">
<value>プレイリストに追加</value>
</data>
</root>
@@ -129,4 +129,7 @@
<data name="Actions" xml:space="preserve">
<value>Actions</value>
</data>
<data name="AddToPlaylist" xml:space="preserve">
<value>Add to playlist</value>
</data>
</root>
@@ -127,6 +127,9 @@
<value>Redare</value>
</data>
<data name="Actions" xml:space="preserve">
<value>Acțiuni</value>
<value>Acțiuni</value>
</data>
<data name="AddToPlaylist" xml:space="preserve">
<value>Adaugă în listă de redare</value>
</data>
</root>
@@ -127,6 +127,9 @@
<value>Відтворити</value>
</data>
<data name="Actions" xml:space="preserve">
<value>Дії</value>
<value>Дії</value>
</data>
<data name="AddToPlaylist" xml:space="preserve">
<value>Додати до списку відтворення</value>
</data>
</root>
@@ -127,6 +127,9 @@
<value>播放</value>
</data>
<data name="Actions" xml:space="preserve">
<value>操作</value>
<value>操作</value>
</data>
<data name="AddToPlaylist" xml:space="preserve">
<value>添加到播放列表</value>
</data>
</root>
@@ -1512,4 +1512,16 @@
<data name="PlayTrack" xml:space="preserve">
<value>تشغيل المقطع</value>
</data>
<data name="Actions" xml:space="preserve">
<value>الإجراءات</value>
</data>
<data name="AddToPlaylist" xml:space="preserve">
<value>إضافة إلى قائمة التشغيل</value>
</data>
<data name="AddToPlayQueue" xml:space="preserve">
<value>إضافة إلى قائمة الانتظار</value>
</data>
<data name="PlayAllFromHere" xml:space="preserve">
<value>تشغيل الكل من هنا</value>
</data>
</root>
@@ -1512,4 +1512,16 @@
<data name="PlayTrack" xml:space="preserve">
<value>Titel abspielen</value>
</data>
<data name="Actions" xml:space="preserve">
<value>Aktionen</value>
</data>
<data name="AddToPlaylist" xml:space="preserve">
<value>Zur Wiedergabeliste hinzufügen</value>
</data>
<data name="AddToPlayQueue" xml:space="preserve">
<value>Zur Warteschlange hinzufügen</value>
</data>
<data name="PlayAllFromHere" xml:space="preserve">
<value>Alles ab hier abspielen</value>
</data>
</root>
@@ -703,7 +703,7 @@
<value>Costa Rica</value>
</data>
<data name="Country.CI" xml:space="preserve">
<value>Côte d’Ivoire</value>
<value>Côte d’Ivoire</value>
</data>
<data name="Country.HR" xml:space="preserve">
<value>Croatia</value>
@@ -1030,7 +1030,7 @@
<value>San Marino</value>
</data>
<data name="Country.ST" xml:space="preserve">
<value>São Tomé &amp; Príncipe</value>
<value>São Tomé &amp; Príncipe</value>
</data>
<data name="Country.SA" xml:space="preserve">
<value>Saudi Arabia</value>
@@ -1117,7 +1117,7 @@
<value>Tunisia</value>
</data>
<data name="Country.TR" xml:space="preserve">
<value>Türkiye</value>
<value>Türkiye</value>
</data>
<data name="Country.TM" xml:space="preserve">
<value>Turkmenistan</value>
@@ -1512,4 +1512,16 @@
<data name="PlayTrack" xml:space="preserve">
<value>Play track</value>
</data>
<data name="Actions" xml:space="preserve">
<value>Actions</value>
</data>
<data name="AddToPlaylist" xml:space="preserve">
<value>Add to playlist</value>
</data>
<data name="AddToPlayQueue" xml:space="preserve">
<value>Add to play queue</value>
</data>
<data name="PlayAllFromHere" xml:space="preserve">
<value>Play all from here</value>
</data>
</root>
@@ -1512,4 +1512,16 @@
<data name="PlayTrack" xml:space="preserve">
<value>Reproducir la pista</value>
</data>
<data name="Actions" xml:space="preserve">
<value>Acciones</value>
</data>
<data name="AddToPlaylist" xml:space="preserve">
<value>Añadir a la lista de reproducción</value>
</data>
<data name="AddToPlayQueue" xml:space="preserve">
<value>Añadir a la cola de reproducción</value>
</data>
<data name="PlayAllFromHere" xml:space="preserve">
<value>Reproducir todo desde aquí</value>
</data>
</root>
@@ -1512,4 +1512,16 @@
<data name="PlayTrack" xml:space="preserve">
<value>Lire la piste</value>
</data>
<data name="Actions" xml:space="preserve">
<value>Actions</value>
</data>
<data name="AddToPlaylist" xml:space="preserve">
<value>Ajouter à la liste de lecture</value>
</data>
<data name="AddToPlayQueue" xml:space="preserve">
<value>Ajouter à la file d&#x27;attente</value>
</data>
<data name="PlayAllFromHere" xml:space="preserve">
<value>Lire tout à partir d&#x27;ici</value>
</data>
</root>
@@ -1512,4 +1512,16 @@
<data name="PlayTrack" xml:space="preserve">
<value>Riproduci il brano</value>
</data>
<data name="Actions" xml:space="preserve">
<value>Azioni</value>
</data>
<data name="AddToPlaylist" xml:space="preserve">
<value>Aggiungi alla playlist</value>
</data>
<data name="AddToPlayQueue" xml:space="preserve">
<value>Aggiungi alla coda di riproduzione</value>
</data>
<data name="PlayAllFromHere" xml:space="preserve">
<value>Riproduci tutto da qui</value>
</data>
</root>
@@ -1512,4 +1512,16 @@
<data name="PlayTrack" xml:space="preserve">
<value>トラックを再生</value>
</data>
<data name="Actions" xml:space="preserve">
<value>操作</value>
</data>
<data name="AddToPlaylist" xml:space="preserve">
<value>プレイリストに追加</value>
</data>
<data name="AddToPlayQueue" xml:space="preserve">
<value>再生キューに追加</value>
</data>
<data name="PlayAllFromHere" xml:space="preserve">
<value>ここからすべて再生</value>
</data>
</root>
@@ -703,7 +703,7 @@
<value>Costa Rica</value>
</data>
<data name="Country.CI" xml:space="preserve">
<value>Côte d’Ivoire</value>
<value>Côte d’Ivoire</value>
</data>
<data name="Country.HR" xml:space="preserve">
<value>Croatia</value>
@@ -1030,7 +1030,7 @@
<value>San Marino</value>
</data>
<data name="Country.ST" xml:space="preserve">
<value>São Tomé &amp; Príncipe</value>
<value>São Tomé &amp; Príncipe</value>
</data>
<data name="Country.SA" xml:space="preserve">
<value>Saudi Arabia</value>
@@ -1117,7 +1117,7 @@
<value>Tunisia</value>
</data>
<data name="Country.TR" xml:space="preserve">
<value>Türkiye</value>
<value>Türkiye</value>
</data>
<data name="Country.TM" xml:space="preserve">
<value>Turkmenistan</value>
@@ -1512,4 +1512,16 @@
<data name="PlayTrack" xml:space="preserve">
<value>Play track</value>
</data>
<data name="Actions" xml:space="preserve">
<value>Actions</value>
</data>
<data name="AddToPlaylist" xml:space="preserve">
<value>Add to playlist</value>
</data>
<data name="AddToPlayQueue" xml:space="preserve">
<value>Add to play queue</value>
</data>
<data name="PlayAllFromHere" xml:space="preserve">
<value>Play all from here</value>
</data>
</root>
@@ -1512,4 +1512,16 @@
<data name="PlayTrack" xml:space="preserve">
<value>Redă piesa</value>
</data>
<data name="Actions" xml:space="preserve">
<value>Acțiuni</value>
</data>
<data name="AddToPlaylist" xml:space="preserve">
<value>Adaugă în listă de redare</value>
</data>
<data name="AddToPlayQueue" xml:space="preserve">
<value>Adaugă la coada de redare</value>
</data>
<data name="PlayAllFromHere" xml:space="preserve">
<value>Redă tot de aici</value>
</data>
</root>
@@ -1512,4 +1512,16 @@
<data name="PlayTrack" xml:space="preserve">
<value>Відтворити трек</value>
</data>
<data name="Actions" xml:space="preserve">
<value>Дії</value>
</data>
<data name="AddToPlaylist" xml:space="preserve">
<value>Додати до списку відтворення</value>
</data>
<data name="AddToPlayQueue" xml:space="preserve">
<value>Додати до черги відтворення</value>
</data>
<data name="PlayAllFromHere" xml:space="preserve">
<value>Відтворити все звідси</value>
</data>
</root>
@@ -1512,4 +1512,16 @@
<data name="PlayTrack" xml:space="preserve">
<value>播放曲目</value>
</data>
<data name="Actions" xml:space="preserve">
<value>操作</value>
</data>
<data name="AddToPlaylist" xml:space="preserve">
<value>添加到播放列表</value>
</data>
<data name="AddToPlayQueue" xml:space="preserve">
<value>添加到播放队列</value>
</data>
<data name="PlayAllFromHere" xml:space="preserve">
<value>从这里开始播放全部</value>
</data>
</root>
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<root>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
@@ -64,6 +64,9 @@
<value>تشغيل</value>
</data>
<data name="Actions" xml:space="preserve">
<value>الإجراءات</value>
<value>الإجراءات</value>
</data>
<data name="AddToPlaylist" xml:space="preserve">
<value>إضافة إلى قائمة التشغيل</value>
</data>
</root>
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<root>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
@@ -66,4 +66,7 @@
<data name="Actions" xml:space="preserve">
<value>Aktionen</value>
</data>
<data name="AddToPlaylist" xml:space="preserve">
<value>Zur Wiedergabeliste hinzufügen</value>
</data>
</root>
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<root>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
@@ -66,4 +66,7 @@
<data name="Actions" xml:space="preserve">
<value>Actions</value>
</data>
<data name="AddToPlaylist" xml:space="preserve">
<value>Add to playlist</value>
</data>
</root>
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<root>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
@@ -66,4 +66,7 @@
<data name="Actions" xml:space="preserve">
<value>Acciones</value>
</data>
<data name="AddToPlaylist" xml:space="preserve">
<value>Añadir a la lista de reproducción</value>
</data>
</root>
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<root>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
@@ -66,4 +66,7 @@
<data name="Actions" xml:space="preserve">
<value>Actions</value>
</data>
<data name="AddToPlaylist" xml:space="preserve">
<value>Ajouter à la liste de lecture</value>
</data>
</root>
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<root>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
@@ -66,4 +66,7 @@
<data name="Actions" xml:space="preserve">
<value>Azioni</value>
</data>
<data name="AddToPlaylist" xml:space="preserve">
<value>Aggiungi alla playlist</value>
</data>
</root>
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<root>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
@@ -64,6 +64,9 @@
<value>再生</value>
</data>
<data name="Actions" xml:space="preserve">
<value>操作</value>
<value>操作</value>
</data>
<data name="AddToPlaylist" xml:space="preserve">
<value>プレイリストに追加</value>
</data>
</root>
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<root>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
@@ -66,4 +66,7 @@
<data name="Actions" xml:space="preserve">
<value>Actions</value>
</data>
<data name="AddToPlaylist" xml:space="preserve">
<value>Add to playlist</value>
</data>
</root>
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<root>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
@@ -64,6 +64,9 @@
<value>Redare</value>
</data>
<data name="Actions" xml:space="preserve">
<value>Acțiuni</value>
<value>Acțiuni</value>
</data>
<data name="AddToPlaylist" xml:space="preserve">
<value>Adaugă în listă de redare</value>
</data>
</root>
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<root>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
@@ -64,6 +64,9 @@
<value>Відтворити</value>
</data>
<data name="Actions" xml:space="preserve">
<value>Дії</value>
<value>Дії</value>
</data>
<data name="AddToPlaylist" xml:space="preserve">
<value>Додати до списку відтворення</value>
</data>
</root>
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<root>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
@@ -64,6 +64,9 @@
<value>播放</value>
</data>
<data name="Actions" xml:space="preserve">
<value>操作</value>
<value>操作</value>
</data>
<data name="AddToPlaylist" xml:space="preserve">
<value>添加到播放列表</value>
</data>
</root>
@@ -1092,4 +1092,7 @@
<data name="Shuffle" xml:space="preserve">
<value>تشغيل عشوائي</value>
</data>
<data name="AddToPlaylist" xml:space="preserve">
<value>إضافة إلى قائمة التشغيل</value>
</data>
</root>
@@ -1092,4 +1092,7 @@
<data name="Shuffle" xml:space="preserve">
<value>Zufällige Wiedergabe</value>
</data>
<data name="AddToPlaylist" xml:space="preserve">
<value>Zur Wiedergabeliste hinzufügen</value>
</data>
</root>
@@ -445,7 +445,7 @@
<value>Costa Rica</value>
</data>
<data name="Country.CI" xml:space="preserve">
<value>Côte d’Ivoire</value>
<value>Côte d’Ivoire</value>
</data>
<data name="Country.HR" xml:space="preserve">
<value>Croatia</value>
@@ -772,7 +772,7 @@
<value>San Marino</value>
</data>
<data name="Country.ST" xml:space="preserve">
<value>São Tomé &amp; Príncipe</value>
<value>São Tomé &amp; Príncipe</value>
</data>
<data name="Country.SA" xml:space="preserve">
<value>Saudi Arabia</value>
@@ -859,7 +859,7 @@
<value>Tunisia</value>
</data>
<data name="Country.TR" xml:space="preserve">
<value>Türkiye</value>
<value>Türkiye</value>
</data>
<data name="Country.TM" xml:space="preserve">
<value>Turkmenistan</value>
@@ -1092,4 +1092,7 @@
<data name="Shuffle" xml:space="preserve">
<value>Shuffle</value>
</data>
<data name="AddToPlaylist" xml:space="preserve">
<value>Add to playlist</value>
</data>
</root>
@@ -1092,4 +1092,7 @@
<data name="Shuffle" xml:space="preserve">
<value>Aleatorio</value>
</data>
<data name="AddToPlaylist" xml:space="preserve">
<value>Añadir a la lista de reproducción</value>
</data>
</root>
@@ -1092,4 +1092,7 @@
<data name="Shuffle" xml:space="preserve">
<value>Lecture aléatoire</value>
</data>
<data name="AddToPlaylist" xml:space="preserve">
<value>Ajouter à la liste de lecture</value>
</data>
</root>
@@ -1092,4 +1092,7 @@
<data name="Shuffle" xml:space="preserve">
<value>Riproduzione casuale</value>
</data>
<data name="AddToPlaylist" xml:space="preserve">
<value>Aggiungi alla playlist</value>
</data>
</root>
@@ -1092,4 +1092,7 @@
<data name="Shuffle" xml:space="preserve">
<value>シャッフル</value>
</data>
<data name="AddToPlaylist" xml:space="preserve">
<value>プレイリストに追加</value>
</data>
</root>
@@ -445,7 +445,7 @@
<value>Costa Rica</value>
</data>
<data name="Country.CI" xml:space="preserve">
<value>Côte d’Ivoire</value>
<value>Côte d’Ivoire</value>
</data>
<data name="Country.HR" xml:space="preserve">
<value>Croatia</value>
@@ -772,7 +772,7 @@
<value>San Marino</value>
</data>
<data name="Country.ST" xml:space="preserve">
<value>São Tomé &amp; Príncipe</value>
<value>São Tomé &amp; Príncipe</value>
</data>
<data name="Country.SA" xml:space="preserve">
<value>Saudi Arabia</value>
@@ -859,7 +859,7 @@
<value>Tunisia</value>
</data>
<data name="Country.TR" xml:space="preserve">
<value>Türkiye</value>
<value>Türkiye</value>
</data>
<data name="Country.TM" xml:space="preserve">
<value>Turkmenistan</value>
@@ -1092,4 +1092,7 @@
<data name="Shuffle" xml:space="preserve">
<value>Shuffle</value>
</data>
<data name="AddToPlaylist" xml:space="preserve">
<value>Add to playlist</value>
</data>
</root>
@@ -1092,4 +1092,7 @@
<data name="Shuffle" xml:space="preserve">
<value>Aleatoriu</value>
</data>
<data name="AddToPlaylist" xml:space="preserve">
<value>Adaugă în listă de redare</value>
</data>
</root>
@@ -1092,4 +1092,7 @@
<data name="Shuffle" xml:space="preserve">
<value>Перемішати</value>
</data>
<data name="AddToPlaylist" xml:space="preserve">
<value>Додати до списку відтворення</value>
</data>
</root>
@@ -1092,4 +1092,7 @@
<data name="Shuffle" xml:space="preserve">
<value>随机播放</value>
</data>
<data name="AddToPlaylist" xml:space="preserve">
<value>添加到播放列表</value>
</data>
</root>
@@ -655,7 +655,7 @@
<value>Switzerland</value>
</data>
<data name="Country.CI" xml:space="preserve">
<value>Côte d’Ivoire</value>
<value>Côte d’Ivoire</value>
</data>
<data name="Country.CL" xml:space="preserve">
<value>Chile</value>
@@ -1048,7 +1048,7 @@
<value>South Sudan</value>
</data>
<data name="Country.ST" xml:space="preserve">
<value>São Tomé &amp; Príncipe</value>
<value>São Tomé &amp; Príncipe</value>
</data>
<data name="Country.SV" xml:space="preserve">
<value>El Salvador</value>
@@ -1084,7 +1084,7 @@
<value>Tonga</value>
</data>
<data name="Country.TR" xml:space="preserve">
<value>Türkiye</value>
<value>Türkiye</value>
</data>
<data name="Country.TT" xml:space="preserve">
<value>Trinidad &amp; Tobago</value>
@@ -655,7 +655,7 @@
<value>Switzerland</value>
</data>
<data name="Country.CI" xml:space="preserve">
<value>Côte d’Ivoire</value>
<value>Côte d’Ivoire</value>
</data>
<data name="Country.CL" xml:space="preserve">
<value>Chile</value>
@@ -1048,7 +1048,7 @@
<value>South Sudan</value>
</data>
<data name="Country.ST" xml:space="preserve">
<value>São Tomé &amp; Príncipe</value>
<value>São Tomé &amp; Príncipe</value>
</data>
<data name="Country.SV" xml:space="preserve">
<value>El Salvador</value>
@@ -1084,7 +1084,7 @@
<value>Tonga</value>
</data>
<data name="Country.TR" xml:space="preserve">
<value>Türkiye</value>
<value>Türkiye</value>
</data>
<data name="Country.TT" xml:space="preserve">
<value>Trinidad &amp; Tobago</value>
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Title" xml:space="preserve">
<value>قوائم التشغيل</value>
</data>
<data name="Name" xml:space="preserve">
<value>الاسم</value>
</data>
<data name="Description" xml:space="preserve">
<value>الوصف</value>
</data>
<data name="Create" xml:space="preserve">
<value>إنشاء</value>
</data>
<data name="NoPlaylists" xml:space="preserve">
<value>ليست لديك أي قوائم تشغيل بعد.</value>
</data>
<data name="Tracks" xml:space="preserve">
<value>مقاطع</value>
</data>
<data name="Delete" xml:space="preserve">
<value>حذف</value>
</data>
<data name="DeleteConfirm" xml:space="preserve">
<value>هل تريد حذف قائمة التشغيل هذه؟ لا يمكن التراجع عن هذا الإجراء.</value>
</data>
<data name="DeleteFailed" xml:space="preserve">
<value>تعذر حذف قائمة التشغيل.</value>
</data>
<data name="CreateFailed" xml:space="preserve">
<value>تعذر إنشاء قائمة التشغيل.</value>
</data>
<data name="PlaylistNameRequired" xml:space="preserve">
<value>تحتاج قائمة التشغيل إلى اسم.</value>
</data>
<data name="Items" xml:space="preserve">
<value>عناصر</value>
</data>
</root>
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Title" xml:space="preserve">
<value>Wiedergabelisten</value>
</data>
<data name="Name" xml:space="preserve">
<value>Name</value>
</data>
<data name="Description" xml:space="preserve">
<value>Beschreibung</value>
</data>
<data name="Create" xml:space="preserve">
<value>Erstellen</value>
</data>
<data name="NoPlaylists" xml:space="preserve">
<value>Du hast noch keine Wiedergabelisten.</value>
</data>
<data name="Tracks" xml:space="preserve">
<value>Titel</value>
</data>
<data name="Delete" xml:space="preserve">
<value>Löschen</value>
</data>
<data name="DeleteConfirm" xml:space="preserve">
<value>Diese Wiedergabeliste löschen? Das kann nicht rückgängig gemacht werden.</value>
</data>
<data name="DeleteFailed" xml:space="preserve">
<value>Die Wiedergabeliste konnte nicht gelöscht werden.</value>
</data>
<data name="CreateFailed" xml:space="preserve">
<value>Die Wiedergabeliste konnte nicht erstellt werden.</value>
</data>
<data name="PlaylistNameRequired" xml:space="preserve">
<value>Eine Wiedergabeliste braucht einen Namen.</value>
</data>
<data name="Items" xml:space="preserve">
<value>Einträge</value>
</data>
</root>
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Title" xml:space="preserve">
<value>Playlists</value>
</data>
<data name="Name" xml:space="preserve">
<value>Name</value>
</data>
<data name="Description" xml:space="preserve">
<value>Description</value>
</data>
<data name="Create" xml:space="preserve">
<value>Create</value>
</data>
<data name="NoPlaylists" xml:space="preserve">
<value>You have no playlists yet.</value>
</data>
<data name="Tracks" xml:space="preserve">
<value>tracks</value>
</data>
<data name="Delete" xml:space="preserve">
<value>Delete</value>
</data>
<data name="DeleteConfirm" xml:space="preserve">
<value>Delete this playlist? This cannot be undone.</value>
</data>
<data name="DeleteFailed" xml:space="preserve">
<value>The playlist could not be deleted.</value>
</data>
<data name="CreateFailed" xml:space="preserve">
<value>The playlist could not be created.</value>
</data>
<data name="PlaylistNameRequired" xml:space="preserve">
<value>A playlist needs a name.</value>
</data>
<data name="Items" xml:space="preserve">
<value>items</value>
</data>
</root>
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Title" xml:space="preserve">
<value>Listas de reproducción</value>
</data>
<data name="Name" xml:space="preserve">
<value>Nombre</value>
</data>
<data name="Description" xml:space="preserve">
<value>Descripción</value>
</data>
<data name="Create" xml:space="preserve">
<value>Crear</value>
</data>
<data name="NoPlaylists" xml:space="preserve">
<value>Todavía no tienes listas de reproducción.</value>
</data>
<data name="Tracks" xml:space="preserve">
<value>pistas</value>
</data>
<data name="Delete" xml:space="preserve">
<value>Eliminar</value>
</data>
<data name="DeleteConfirm" xml:space="preserve">
<value>¿Eliminar esta lista de reproducción? No se puede deshacer.</value>
</data>
<data name="DeleteFailed" xml:space="preserve">
<value>No se pudo eliminar la lista de reproducción.</value>
</data>
<data name="CreateFailed" xml:space="preserve">
<value>No se pudo crear la lista de reproducción.</value>
</data>
<data name="PlaylistNameRequired" xml:space="preserve">
<value>Una lista de reproducción necesita un nombre.</value>
</data>
<data name="Items" xml:space="preserve">
<value>elementos</value>
</data>
</root>
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Title" xml:space="preserve">
<value>Listes de lecture</value>
</data>
<data name="Name" xml:space="preserve">
<value>Nom</value>
</data>
<data name="Description" xml:space="preserve">
<value>Description</value>
</data>
<data name="Create" xml:space="preserve">
<value>Créer</value>
</data>
<data name="NoPlaylists" xml:space="preserve">
<value>Vous n&apos;avez encore aucune liste de lecture.</value>
</data>
<data name="Tracks" xml:space="preserve">
<value>pistes</value>
</data>
<data name="Delete" xml:space="preserve">
<value>Supprimer</value>
</data>
<data name="DeleteConfirm" xml:space="preserve">
<value>Supprimer cette liste de lecture ? Cette action est irréversible.</value>
</data>
<data name="DeleteFailed" xml:space="preserve">
<value>La liste de lecture n&apos;a pas pu être supprimée.</value>
</data>
<data name="CreateFailed" xml:space="preserve">
<value>La liste de lecture n&apos;a pas pu être créée.</value>
</data>
<data name="PlaylistNameRequired" xml:space="preserve">
<value>Une liste de lecture doit avoir un nom.</value>
</data>
<data name="Items" xml:space="preserve">
<value>éléments</value>
</data>
</root>
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Title" xml:space="preserve">
<value>Playlist</value>
</data>
<data name="Name" xml:space="preserve">
<value>Nome</value>
</data>
<data name="Description" xml:space="preserve">
<value>Descrizione</value>
</data>
<data name="Create" xml:space="preserve">
<value>Crea</value>
</data>
<data name="NoPlaylists" xml:space="preserve">
<value>Non hai ancora playlist.</value>
</data>
<data name="Tracks" xml:space="preserve">
<value>brani</value>
</data>
<data name="Delete" xml:space="preserve">
<value>Elimina</value>
</data>
<data name="DeleteConfirm" xml:space="preserve">
<value>Eliminare questa playlist? L&apos;operazione non può essere annullata.</value>
</data>
<data name="DeleteFailed" xml:space="preserve">
<value>Non è stato possibile eliminare la playlist.</value>
</data>
<data name="CreateFailed" xml:space="preserve">
<value>Non è stato possibile creare la playlist.</value>
</data>
<data name="PlaylistNameRequired" xml:space="preserve">
<value>Una playlist deve avere un nome.</value>
</data>
<data name="Items" xml:space="preserve">
<value>elementi</value>
</data>
</root>
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Title" xml:space="preserve">
<value>プレイリスト</value>
</data>
<data name="Name" xml:space="preserve">
<value>名前</value>
</data>
<data name="Description" xml:space="preserve">
<value>説明</value>
</data>
<data name="Create" xml:space="preserve">
<value>作成</value>
</data>
<data name="NoPlaylists" xml:space="preserve">
<value>プレイリストはまだありません。</value>
</data>
<data name="Tracks" xml:space="preserve">
<value>曲</value>
</data>
<data name="Delete" xml:space="preserve">
<value>削除</value>
</data>
<data name="DeleteConfirm" xml:space="preserve">
<value>このプレイリストを削除しますか?この操作は元に戻せません。</value>
</data>
<data name="DeleteFailed" xml:space="preserve">
<value>プレイリストを削除できませんでした。</value>
</data>
<data name="CreateFailed" xml:space="preserve">
<value>プレイリストを作成できませんでした。</value>
</data>
<data name="PlaylistNameRequired" xml:space="preserve">
<value>プレイリストには名前が必要です。</value>
</data>
<data name="Items" xml:space="preserve">
<value>件</value>
</data>
</root>
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Title" xml:space="preserve">
<value>Playlists</value>
</data>
<data name="Name" xml:space="preserve">
<value>Name</value>
</data>
<data name="Description" xml:space="preserve">
<value>Description</value>
</data>
<data name="Create" xml:space="preserve">
<value>Create</value>
</data>
<data name="NoPlaylists" xml:space="preserve">
<value>You have no playlists yet.</value>
</data>
<data name="Tracks" xml:space="preserve">
<value>tracks</value>
</data>
<data name="Delete" xml:space="preserve">
<value>Delete</value>
</data>
<data name="DeleteConfirm" xml:space="preserve">
<value>Delete this playlist? This cannot be undone.</value>
</data>
<data name="DeleteFailed" xml:space="preserve">
<value>The playlist could not be deleted.</value>
</data>
<data name="CreateFailed" xml:space="preserve">
<value>The playlist could not be created.</value>
</data>
<data name="PlaylistNameRequired" xml:space="preserve">
<value>A playlist needs a name.</value>
</data>
<data name="Items" xml:space="preserve">
<value>items</value>
</data>
</root>
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Title" xml:space="preserve">
<value>Liste de redare</value>
</data>
<data name="Name" xml:space="preserve">
<value>Nume</value>
</data>
<data name="Description" xml:space="preserve">
<value>Descriere</value>
</data>
<data name="Create" xml:space="preserve">
<value>Creează</value>
</data>
<data name="NoPlaylists" xml:space="preserve">
<value>Nu ai încă liste de redare.</value>
</data>
<data name="Tracks" xml:space="preserve">
<value>piese</value>
</data>
<data name="Delete" xml:space="preserve">
<value>Șterge</value>
</data>
<data name="DeleteConfirm" xml:space="preserve">
<value>Ștergi această listă de redare? Această acțiune nu poate fi anulată.</value>
</data>
<data name="DeleteFailed" xml:space="preserve">
<value>Lista de redare nu a putut fi ștearsă.</value>
</data>
<data name="CreateFailed" xml:space="preserve">
<value>Lista de redare nu a putut fi creată.</value>
</data>
<data name="PlaylistNameRequired" xml:space="preserve">
<value>O listă de redare are nevoie de un nume.</value>
</data>
<data name="Items" xml:space="preserve">
<value>elemente</value>
</data>
</root>
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Title" xml:space="preserve">
<value>Списки відтворення</value>
</data>
<data name="Name" xml:space="preserve">
<value>Назва</value>
</data>
<data name="Description" xml:space="preserve">
<value>Опис</value>
</data>
<data name="Create" xml:space="preserve">
<value>Створити</value>
</data>
<data name="NoPlaylists" xml:space="preserve">
<value>У вас ще немає списків відтворення.</value>
</data>
<data name="Tracks" xml:space="preserve">
<value>треків</value>
</data>
<data name="Delete" xml:space="preserve">
<value>Видалити</value>
</data>
<data name="DeleteConfirm" xml:space="preserve">
<value>Видалити цей список відтворення? Цю дію неможливо скасувати.</value>
</data>
<data name="DeleteFailed" xml:space="preserve">
<value>Не вдалося видалити список відтворення.</value>
</data>
<data name="CreateFailed" xml:space="preserve">
<value>Не вдалося створити список відтворення.</value>
</data>
<data name="PlaylistNameRequired" xml:space="preserve">
<value>Список відтворення повинен мати назву.</value>
</data>
<data name="Items" xml:space="preserve">
<value>елементів</value>
</data>
</root>
Loaded 100 of 296 files, more files were not shown because too many files have changed in this diff. Show more