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";
}
}