mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 16:11:10 +00:00
Adds the music play statistics endpoints and moves the Web statistics page under the library
This commit is contained in:
1 parent
dfd979ec1e
commit
a61fbf407c
69 files changed
+3407
-7
No files matched your search
+22
@@ -0,0 +1,22 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary.PlayHistory;
|
||||
|
||||
/// <summary>
|
||||
/// Data transfer object for the listening statistics of the current user.
|
||||
/// </summary>
|
||||
/// <param name="TotalListeningDurationInSeconds">The total duration the user listened to, over every recorded play, in seconds.</param>
|
||||
/// <param name="TotalPlayCount">The number of recorded plays that count as plays. An in-progress play counts once it reaches the threshold, so this total can exceed the completed and stopped plays together.</param>
|
||||
/// <param name="CompletedPlayCount">The number of recorded plays that completed.</param>
|
||||
/// <param name="StoppedPlayCount">The number of recorded plays that stopped before the track completed and count as plays.</param>
|
||||
/// <param name="CompletionRate">The fraction of the plays that count as plays that completed, between 0 and 1, or 0 when there is no counted play.</param>
|
||||
[DebuggerDisplay("TotalPlayCount: {TotalPlayCount}; CompletedPlayCount: {CompletedPlayCount}")]
|
||||
public sealed record MusicPlayStatisticsDto(
|
||||
double TotalListeningDurationInSeconds,
|
||||
int TotalPlayCount,
|
||||
int CompletedPlayCount,
|
||||
int StoppedPlayCount,
|
||||
double CompletionRate
|
||||
);
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary.PlayHistory;
|
||||
|
||||
/// <summary>
|
||||
/// Data transfer object for a track of the listening statistics of the current user, together with its aggregated play counts.
|
||||
/// </summary>
|
||||
/// <param name="TrackId">The Id of the track.</param>
|
||||
/// <param name="LibraryId">The Id of the media library that contains the track.</param>
|
||||
/// <param name="AlbumId">The Id of the album that contains the track.</param>
|
||||
/// <param name="ArtistId">The Id of the artist that produced the track.</param>
|
||||
/// <param name="Title">The title of the track, if it still exists and the user can access its library.</param>
|
||||
/// <param name="AlbumTitle">The title of the album that contains the track, if it still exists and the user can access its library.</param>
|
||||
/// <param name="ArtistName">The name of the artist that produced the track, if it still exists and the user can access its library.</param>
|
||||
/// <param name="CoverPath">The path of the cover art of the album, if available.</param>
|
||||
/// <param name="LastPlayedOnUtc">The date and time of the last recorded activity of the track's most recent play.</param>
|
||||
/// <param name="PlayCount">The number of plays of the track that count as plays.</param>
|
||||
/// <param name="CompletedPlayCount">The number of plays of the track that completed.</param>
|
||||
/// <param name="ListenedDurationInSeconds">The duration the user listened to the track, over all of its counted plays, in seconds.</param>
|
||||
[DebuggerDisplay("TrackId: {TrackId}; PlayCount: {PlayCount}")]
|
||||
public sealed record PlayedTrackDto(
|
||||
Guid TrackId,
|
||||
Guid LibraryId,
|
||||
Guid AlbumId,
|
||||
Guid ArtistId,
|
||||
string? Title,
|
||||
string? AlbumTitle,
|
||||
string? ArtistName,
|
||||
string? CoverPath,
|
||||
DateTime LastPlayedOnUtc,
|
||||
int PlayCount,
|
||||
int CompletedPlayCount,
|
||||
double ListenedDurationInSeconds
|
||||
);
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.PlayHistory;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a request for getting a page of the most played tracks of the current user.
|
||||
/// </summary>
|
||||
/// <param name="CurrentPage">The one based page of tracks to return. Optional. Defaults to 1.</param>
|
||||
/// <param name="PerPage">The number of tracks per page. Optional. Defaults to 10.</param>
|
||||
[DebuggerDisplay("CurrentPage: {CurrentPage}; PerPage: {PerPage}")]
|
||||
public record GetMostPlayedRequest(
|
||||
int? CurrentPage,
|
||||
int? PerPage
|
||||
);
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.PlayHistory;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a request for getting a page of the recently played tracks of the current user.
|
||||
/// </summary>
|
||||
/// <param name="CurrentPage">The one based page of tracks to return. Optional. Defaults to 1.</param>
|
||||
/// <param name="PerPage">The number of tracks per page. Optional. Defaults to 10.</param>
|
||||
[DebuggerDisplay("CurrentPage: {CurrentPage}; PerPage: {PerPage}")]
|
||||
public record GetRecentlyPlayedRequest(
|
||||
int? CurrentPage,
|
||||
int? PerPage
|
||||
);
|
||||
@@ -0,0 +1,17 @@
|
||||
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 music play statistics endpoints of the remote API.
|
||||
/// </summary>
|
||||
public static class PlayStatistics
|
||||
{
|
||||
public const string GET_RECENTLY_PLAYED = "users/me/music-play-history/recently-played";
|
||||
public const string GET_MOST_PLAYED = "users/me/music-play-history/most-played";
|
||||
public const string GET_MUSIC_PLAY_STATISTICS = "users/me/music-play-history/statistics";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
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 library statistics pages.
|
||||
/// </summary>
|
||||
public static class LibraryStatistics
|
||||
{
|
||||
public const string INDEX = "{culture}/library/statistics";
|
||||
public const string GET_RECENTLY_PLAYED = "{culture}/library/statistics/api-get-recently-played";
|
||||
public const string GET_MOST_PLAYED = "{culture}/library/statistics/api-get-most-played";
|
||||
public const string GET_MUSIC_PLAY_STATISTICS = "{culture}/library/statistics/api-get-music-play-statistics";
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user