Adds the music library browsing and editing pages to the web client.

This commit is contained in:
BinaryAlley committed 2026-10-13 13:27:28 +03:00
1 parent c7aab63552
commit 5a2c6c2bd8
215 files changed
+60042 -3

No files matched your search

+1
View File
@@ -108,6 +108,7 @@ Several icons used in this project were adapted from icons sourced from [svgrepo
- [`error.svg`](https://www.svgrepo.com/svg/486408/error-filled) (MIT License)
- [`trigger.svg`](https://www.svgrepo.com/svg/489497/lightning-1) (Public Domain License)
- [`stop.svg`](https://www.svgrepo.com/svg/521862/stop) (CC Attribution License)
- [`music-placeholder.svg`](https://www.svgrepo.com/svg/446269/music) (CC Attribution License)
**I greatly appreciate the creators and contributors for providing these assets.**
+10 -3
View File
@@ -62,13 +62,20 @@ A book opens only through an enabled reader for its format. The EPUB and PDF rea
## Browsing your music
Opening a music library shows a page with the library title, a search box, an item count, a grid of artist cards, and pagination. Search filters the artists by name. Each artist is a card; selecting it opens the artist's page, and the card's actions menu offers **View details** and **Delete**.
Opening a music library shows a page with the library title, a search box, a sort toggle, a count of items, a grid of artist cards, an alphabetical picker down the side, and pagination at the bottom.
The artist page is also where you edit the artist. It holds the artist's general information, areas, aliases, contributors and ratings, and it lists the artist's albums as cards, each leading to its own album page. The album page holds the album's information and its tracks, and the track page holds the track's details. Deleting an artist, album or track removes it from Lumina's catalogue; your files are not touched.
- **Search** filters the artists by name; press Enter or use the search button.
- **Sort** toggles between ascending and descending order.
- **The alpha picker** jumps to names starting with a chosen character. It offers All, then the number and symbol keys, then A to Z. You can also press a letter key to filter, and press Escape to clear the filter.
- **Pagination** splits the list into pages when you have it enabled, with previous and next buttons and a page indicator. When it is off, the whole list is shown and the count is the total.
Each artist is a card; selecting it opens the artist's page, and the card's actions menu offers **View details** and **Delete**.
The artist page is also where you edit the artist. It lists the artist's albums as cards, each leading to its own album page, followed by the artist's general information, contributors, ratings, genres, tags, aliases, areas and identifiers. The album page holds the album's information and its tracks, and the track page holds the track's details. The album page also shows the artwork Lumina stored for the album as a strip of thumbnails beside the main image, and selecting a thumbnail displays that image in place of the cover. Deleting an artist, album or track removes it from Lumina's catalogue; your files are not touched.
## Editing what is catalogued
Both book and music pages double as editors for the items that were scanned in. A book's details page groups its fields into general and release information, language and original language, genres, tags, identifiers, ISBNs, contributors and ratings, and lets you replace its cover. An artist's page groups its fields into general information, areas, aliases, contributors and ratings. Album and track pages follow the same shape for their own fields. Saving sends the changes back to the server, and a confirmation or an error is shown in the corner of the screen.
Both book and music pages double as editors for the items that were scanned in. A book's details page groups its fields into general and release information, language and original language, genres, tags, identifiers, ISBNs, contributors and ratings, and lets you replace its cover. An artist's page lists the artist's albums first, then groups its fields into general information, contributors, ratings, genres, tags, aliases, areas and identifiers, and lets you replace the artist's cover. An album page groups its fields into general information, contributors, ratings, genres, tags, release types, release information, language and original language, and identifiers, and lets you replace the album's cover. A track page groups its fields into general information, contributors, ratings, genres, tags, moods, release information, language and original language, work, ISRCs, identifiers and audio properties. Saving sends the changes back to the server, and a confirmation or an error is shown in the corner of the screen.
Changes you make here live in Lumina's catalogue.
@@ -0,0 +1,19 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Presentation.Web.Common.DTO.Common;
using Lumina.Presentation.Web.Common.Enums.AudioLibrary;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.DTO.AudioLibrary;
/// <summary>
/// Data transfer object for the rating of an audio media element.
/// </summary>
[DebuggerDisplay("Value: {Value}, MaxValue: {MaxValue}")]
public class AudioRatingDto : RatingDto
{
/// <summary>
/// Gets or sets the source of the audio rating (e.g., a specific website or platform).
/// </summary>
public AudioRatingSource? Source { get; set; }
}
@@ -0,0 +1,17 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
/// <summary>
/// Data transfer object for an ISRC (International Standard Recording Code) of a track.
/// </summary>
[DebuggerDisplay("Value: {Value}")]
public class IsrcDto
{
/// <summary>
/// Gets or sets the value of the ISRC.
/// </summary>
public string? Value { get; set; }
}
@@ -0,0 +1,118 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
using Lumina.Presentation.Web.Common.DTO.Common;
using Lumina.Presentation.Web.Common.DTO.MediaContributors;
using Lumina.Presentation.Web.Common.Enums.AudioLibrary;
using System;
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
/// <summary>
/// Data transfer object carrying the full details of an album, as stored in the media library.
/// </summary>
[DebuggerDisplay("Title: {Metadata?.Title}")]
public class MusicAlbumDto
{
/// <summary>
/// Gets or sets the Id of the album.
/// </summary>
public Guid Id { get; set; }
/// <summary>
/// Gets or sets the Id of the artist the album belongs to.
/// </summary>
public Guid ArtistId { get; set; }
/// <summary>
/// Gets or sets the Id of the media library this album belongs to.
/// </summary>
public Guid LibraryId { get; set; }
/// <summary>
/// Gets or sets the path of the image representing the album, if available.
/// </summary>
public string? CoverPath { get; set; }
/// <summary>
/// Gets or sets the stored artwork of the album, in display order, so that all of its pieces can be presented, not just the cover.
/// </summary>
public List<MediaArtworkDto>? Artwork { get; set; }
/// <summary>
/// Gets or sets the album metadata of the album.
/// </summary>
public MusicAlbumMetadataDto? Metadata { get; set; }
/// <summary>
/// Gets or sets the physical or digital medium of the album, if applicable.
/// </summary>
public MusicMediaFormat? MediaFormat { get; set; }
/// <summary>
/// Gets or sets the outermost physical packaging of the album, if applicable.
/// </summary>
public MusicReleasePackaging? Packaging { get; set; }
/// <summary>
/// Gets or sets the barcode of the album, if applicable.
/// </summary>
public string? Barcode { get; set; }
/// <summary>
/// Gets or sets the catalog numbers of the album, if applicable.
/// </summary>
public List<string>? CatalogNumbers { get; set; }
/// <summary>
/// Gets or sets the name of the label that issued the album, if applicable.
/// </summary>
public string? Label { get; set; }
/// <summary>
/// Gets or sets the ASIN (Amazon Standard Identification Number) of the album, if applicable.
/// </summary>
public string? ASIN { get; set; }
/// <summary>
/// Gets or sets the MusicBrainz identifier of the release, if applicable.
/// </summary>
public Guid? MusicBrainzReleaseId { get; set; }
/// <summary>
/// Gets or sets the MusicBrainz identifier of the release group, if applicable.
/// </summary>
public Guid? MusicBrainzReleaseGroupId { get; set; }
/// <summary>
/// Gets or sets the MusicBrainz identifier of the release artist, if applicable.
/// </summary>
public Guid? MusicBrainzReleaseArtistId { get; set; }
/// <summary>
/// Gets or sets the date and time when the album was created.
/// </summary>
public DateTime CreatedOnUtc { get; set; }
/// <summary>
/// Gets or sets the optional date and time when the album was updated.
/// </summary>
public DateTime? UpdatedOnUtc { get; set; }
/// <summary>
/// Gets or sets the list of references to the media contributors that performed on the album, each with the role they played.
/// </summary>
public List<MediaContributorReferenceDto>? Contributors { get; set; }
/// <summary>
/// Gets or sets the list of ratings for this album.
/// </summary>
public List<AudioRatingDto>? Ratings { get; set; }
/// <summary>
/// Gets or sets the list of tracks of the album.
/// </summary>
public List<MusicTrackDto>? Tracks { get; set; }
}
@@ -0,0 +1,45 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Presentation.Web.Common.Enums.AudioLibrary;
using System;
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
/// <summary>
/// Data transfer object for a lightweight album element, containing only the properties needed by the client for card-style navigation.
/// </summary>
[DebuggerDisplay("Title: {Title}")]
public class MusicAlbumLiteDto
{
/// <summary>
/// Gets or sets the Id of the album.
/// </summary>
public Guid Id { get; set; }
/// <summary>
/// Gets or sets the title of the album.
/// </summary>
public string Title { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the number of tracks of the release.
/// </summary>
public int TotalTracks { get; set; }
/// <summary>
/// Gets or sets the path of the image representing the album, if available.
/// </summary>
public string? CoverPath { get; set; }
/// <summary>
/// Gets or sets the release year of the album (the re-release year, if available, or the original release year), if known.
/// </summary>
public int? ReleaseYear { get; set; }
/// <summary>
/// Gets or sets the set of types of the release.
/// </summary>
public List<MusicReleaseType>? ReleaseTypes { get; set; }
}
@@ -0,0 +1,90 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Presentation.Web.Common.DTO.Common;
using Lumina.Presentation.Web.Common.Enums.AudioLibrary;
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
/// <summary>
/// Data transfer object for the metadata of an album.
/// </summary>
[DebuggerDisplay("Title: {Title}")]
public class MusicAlbumMetadataDto
{
/// <summary>
/// Gets or sets the title of the album.
/// </summary>
public string? Title { get; set; }
/// <summary>
/// Gets or sets the original title of the album, if different from the current title.
/// </summary>
public string? OriginalTitle { get; set; }
/// <summary>
/// Gets or sets a brief description or summary of the album.
/// </summary>
public string? Description { get; set; }
/// <summary>
/// Gets or sets the disambiguation comment of the album, used to distinguish albums with the same title.
/// </summary>
public string? Disambiguation { get; set; }
/// <summary>
/// Gets or sets the release information, including release date and other relevant details.
/// </summary>
public ReleaseInfoDto? ReleaseInfo { get; set; }
/// <summary>
/// Gets or sets the language of the album.
/// </summary>
public LanguageInfoDto? Language { get; set; }
/// <summary>
/// Gets or sets the original language of the album, if it has been translated.
/// </summary>
public LanguageInfoDto? OriginalLanguage { get; set; }
/// <summary>
/// Gets or sets the list of tags that further describe or categorize the album.
/// </summary>
public List<TagDto>? Tags { get; set; }
/// <summary>
/// Gets or sets the list of genres associated with the album.
/// </summary>
public List<GenreDto>? Genres { get; set; }
/// <summary>
/// Gets or sets the script used by the language of the release of the album.
/// </summary>
public string? Script { get; set; }
/// <summary>
/// Gets or sets the set of types of the release.
/// </summary>
public List<MusicReleaseType>? ReleaseTypes { get; set; }
/// <summary>
/// Gets or sets the status of the release.
/// </summary>
public MusicReleaseStatus? ReleaseStatus { get; set; }
/// <summary>
/// Gets or sets the number of discs of the release.
/// </summary>
public int? TotalDiscs { get; set; }
/// <summary>
/// Gets or sets the number of tracks of the release.
/// </summary>
public int? TotalTracks { get; set; }
/// <summary>
/// Gets or sets the title of the specific release (edition) the album files match, if different from the release group title.
/// </summary>
public string? ReleaseTitle { get; set; }
}
@@ -0,0 +1,43 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
/// <summary>
/// Data transfer object for a MusicBrainz area, the geographic area a music artist is associated with.
/// </summary>
[DebuggerDisplay("Name: {Name}")]
public class MusicAreaDto
{
/// <summary>
/// Gets or sets the MusicBrainz identifier of the area.
/// </summary>
public Guid? MusicBrainzAreaId { get; set; }
/// <summary>
/// Gets or sets the name of the area.
/// </summary>
public string? Name { get; set; }
/// <summary>
/// Gets or sets the sort name of the area, if applicable.
/// </summary>
public string? SortName { get; set; }
/// <summary>
/// Gets or sets the disambiguation comment of the area, if applicable.
/// </summary>
public string? Disambiguation { get; set; }
/// <summary>
/// Gets or sets the MusicBrainz type of the area, if applicable.
/// </summary>
public string? Type { get; set; }
/// <summary>
/// Gets or sets the ISO 3166 code of the area, if applicable.
/// </summary>
public string? Iso3166Code { get; set; }
}
@@ -0,0 +1,53 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
/// <summary>
/// Data transfer object for an alternative name of a music artist.
/// </summary>
[DebuggerDisplay("Name: {Name}")]
public class MusicArtistAliasDto
{
/// <summary>
/// Gets or sets the name of the alias.
/// </summary>
public string? Name { get; set; }
/// <summary>
/// Gets or sets the sort name of the alias, if applicable.
/// </summary>
public string? SortName { get; set; }
/// <summary>
/// Gets or sets the type of the alias, if applicable.
/// </summary>
public string? Type { get; set; }
/// <summary>
/// Gets or sets the locale the alias is used in, if applicable.
/// </summary>
public string? Locale { get; set; }
/// <summary>
/// Gets or sets whether this is the primary alias of the artist.
/// </summary>
public bool IsPrimary { get; set; }
/// <summary>
/// Gets or sets the date the alias began being used, if applicable.
/// </summary>
public DateOnly? BeginDate { get; set; }
/// <summary>
/// Gets or sets the date the alias stopped being used, if applicable.
/// </summary>
public DateOnly? EndDate { get; set; }
/// <summary>
/// Gets or sets whether the alias is no longer used.
/// </summary>
public bool IsEnded { get; set; }
}
@@ -0,0 +1,81 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
using Lumina.Presentation.Web.Common.DTO.MediaContributors;
using System;
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
/// <summary>
/// Data transfer object carrying the full details of a music artist, as stored in the media library.
/// </summary>
[DebuggerDisplay("Name: {Metadata?.Name}")]
public class MusicArtistDto
{
/// <summary>
/// Gets or sets the Id of the artist.
/// </summary>
public Guid Id { get; set; }
/// <summary>
/// Gets or sets the Id of the media library this artist belongs to.
/// </summary>
public Guid LibraryId { get; set; }
/// <summary>
/// Gets or sets the path of the image representing the artist, if available.
/// </summary>
public string? CoverPath { get; set; }
/// <summary>
/// Gets or sets the metadata of the artist.
/// </summary>
public MusicArtistMetadataDto? Metadata { get; set; }
/// <summary>
/// Gets or sets the website of the artist, if applicable.
/// </summary>
public string? Website { get; set; }
/// <summary>
/// Gets or sets the MusicBrainz identifier of the artist, if applicable.
/// </summary>
public Guid? MusicBrainzArtistId { get; set; }
/// <summary>
/// Gets or sets the list of IPI (Interested Party Information) codes of the artist.
/// </summary>
public List<string>? Ipis { get; set; }
/// <summary>
/// Gets or sets the list of ISNI (International Standard Name Identifier) codes of the artist.
/// </summary>
public List<string>? Isnis { get; set; }
/// <summary>
/// Gets or sets the date and time when the artist was created.
/// </summary>
public DateTime CreatedOnUtc { get; set; }
/// <summary>
/// Gets or sets the optional date and time when the artist was updated.
/// </summary>
public DateTime? UpdatedOnUtc { get; set; }
/// <summary>
/// Gets or sets the list of references to the media contributors that make up the artist, each with the role they played.
/// </summary>
public List<MediaContributorReferenceDto>? Contributors { get; set; }
/// <summary>
/// Gets or sets the list of ratings for this artist.
/// </summary>
public List<AudioRatingDto>? Ratings { get; set; }
/// <summary>
/// Gets or sets the list of albums of the artist, each with its own list of tracks.
/// </summary>
public List<MusicAlbumDto>? Albums { get; set; }
}
@@ -0,0 +1,28 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
/// <summary>
/// Data transfer object for a lightweight music artist element, containing only the properties needed by the client for card-style navigation.
/// </summary>
[DebuggerDisplay("Name: {Name}")]
public class MusicArtistLiteDto
{
/// <summary>
/// Gets or sets the Id of the artist.
/// </summary>
public Guid Id { get; set; }
/// <summary>
/// Gets or sets the name of the artist.
/// </summary>
public string Name { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the path of the image representing the artist, if available.
/// </summary>
public string? CoverPath { get; set; }
}
@@ -0,0 +1,91 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Presentation.Web.Common.DTO.Common;
using Lumina.Presentation.Web.Common.Enums.AudioLibrary;
using System;
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
/// <summary>
/// Data transfer object for the metadata of a music artist.
/// </summary>
[DebuggerDisplay("Name: {Name}")]
public class MusicArtistMetadataDto
{
/// <summary>
/// Gets or sets the name of the artist.
/// </summary>
public string? Name { get; set; }
/// <summary>
/// Gets or sets the sort name of the artist, a variant of the name used when sorting artists, if applicable.
/// </summary>
public string? SortName { get; set; }
/// <summary>
/// Gets or sets the disambiguation comment of the artist, used to distinguish artists with the same name, if applicable.
/// </summary>
public string? Disambiguation { get; set; }
/// <summary>
/// Gets or sets the type of the artist, if applicable.
/// </summary>
public MusicArtistType? Type { get; set; }
/// <summary>
/// Gets or sets the gender of the artist, applicable only to artists that are persons or characters, if applicable.
/// </summary>
public MusicArtistGender? Gender { get; set; }
/// <summary>
/// Gets or sets the ISO 3166-1 alpha-2 code of the country the artist is associated with, if applicable.
/// </summary>
public string? Country { get; set; }
/// <summary>
/// Gets or sets the area the artist is primarily identified with, if applicable.
/// </summary>
public MusicAreaDto? Area { get; set; }
/// <summary>
/// Gets or sets the area the artist began in, if applicable.
/// </summary>
public MusicAreaDto? BeginArea { get; set; }
/// <summary>
/// Gets or sets the area the artist ended in, if applicable.
/// </summary>
public MusicAreaDto? EndArea { get; set; }
/// <summary>
/// Gets or sets the date the artist started existing, if applicable.
/// </summary>
public DateOnly? LifeSpanBegin { get; set; }
/// <summary>
/// Gets or sets the date the artist stopped existing, if applicable.
/// </summary>
public DateOnly? LifeSpanEnd { get; set; }
/// <summary>
/// Gets or sets whether the artist no longer exists.
/// </summary>
public bool IsEnded { get; set; }
/// <summary>
/// Gets or sets the list of genres associated with the artist.
/// </summary>
public List<GenreDto>? Genres { get; set; }
/// <summary>
/// Gets or sets the list of tags that further describe or categorize the artist.
/// </summary>
public List<TagDto>? Tags { get; set; }
/// <summary>
/// Gets or sets the list of alternative names of the artist.
/// </summary>
public List<MusicArtistAliasDto>? Aliases { get; set; }
}
@@ -0,0 +1,113 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
using Lumina.Presentation.Web.Common.DTO.Common;
using Lumina.Presentation.Web.Common.DTO.MediaContributors;
using Lumina.Presentation.Web.Common.Enums.AudioLibrary;
using System;
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
/// <summary>
/// Data transfer object carrying the full details of a track, as stored in the media library.
/// </summary>
[DebuggerDisplay("Title: {Metadata?.Title}")]
public class MusicTrackDto
{
/// <summary>
/// Gets or sets the Id of the track.
/// </summary>
public Guid Id { get; set; }
/// <summary>
/// Gets or sets the Id of the album the track belongs to.
/// </summary>
public Guid AlbumId { get; set; }
/// <summary>
/// Gets or sets the Id of the media library this track belongs to.
/// </summary>
public Guid LibraryId { get; set; }
/// <summary>
/// Gets or sets the file system path of the track.
/// </summary>
public string Path { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the audio metadata of the track.
/// </summary>
public MusicTrackMetadataDto? Metadata { get; set; }
/// <summary>
/// Gets or sets the number of the track on its disc.
/// </summary>
public int TrackNumber { get; set; }
/// <summary>
/// Gets or sets the number of the disc the track belongs to, if applicable.
/// </summary>
public int? DiscNumber { get; set; }
/// <summary>
/// Gets or sets the script used by the language of the track, if applicable.
/// </summary>
public string? Script { get; set; }
/// <summary>
/// Gets or sets the musical key of the track, if applicable.
/// </summary>
public MusicKey? Key { get; set; }
/// <summary>
/// Gets or sets the tempo of the track in beats per minute, if applicable.
/// </summary>
public int? Bpm { get; set; }
/// <summary>
/// Gets or sets the work the track is a recording of, if applicable.
/// </summary>
public MusicWorkDto? Work { get; set; }
/// <summary>
/// Gets or sets the MusicBrainz identifier of the recording, if applicable.
/// </summary>
public Guid? MusicBrainzRecordingId { get; set; }
/// <summary>
/// Gets or sets the MusicBrainz identifier of the track, if applicable.
/// </summary>
public Guid? MusicBrainzTrackId { get; set; }
/// <summary>
/// Gets or sets the date and time when the track was created.
/// </summary>
public DateTime CreatedOnUtc { get; set; }
/// <summary>
/// Gets or sets the optional date and time when the track was updated.
/// </summary>
public DateTime? UpdatedOnUtc { get; set; }
/// <summary>
/// Gets or sets the list of moods of the track.
/// </summary>
public List<MoodDto>? Moods { get; set; }
/// <summary>
/// Gets or sets the list of ISRC (International Standard Recording Code) of the track.
/// </summary>
public List<IsrcDto>? Isrcs { get; set; }
/// <summary>
/// Gets or sets the list of references to the media contributors that performed on the track, each with the role they played.
/// </summary>
public List<MediaContributorReferenceDto>? Contributors { get; set; }
/// <summary>
/// Gets or sets the list of ratings for this track.
/// </summary>
public List<AudioRatingDto>? Ratings { get; set; }
}
@@ -0,0 +1,38 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
/// <summary>
/// Data transfer object for a lightweight track element, containing only the properties needed by the client to display the tracks of an album.
/// </summary>
[DebuggerDisplay("Title: {Title}")]
public class MusicTrackLiteDto
{
/// <summary>
/// Gets or sets the Id of the track.
/// </summary>
public Guid Id { get; set; }
/// <summary>
/// Gets or sets the title of the track.
/// </summary>
public string Title { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the number of the track on its disc.
/// </summary>
public int TrackNumber { get; set; }
/// <summary>
/// Gets or sets the number of the disc the track belongs to, if applicable.
/// </summary>
public int? DiscNumber { get; set; }
/// <summary>
/// Gets or sets the duration of the track in seconds.
/// </summary>
public int DurationInSeconds { get; set; }
}
@@ -0,0 +1,119 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Presentation.Web.Common.DTO.Common;
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
/// <summary>
/// Data transfer object for the audio metadata of a track.
/// </summary>
[DebuggerDisplay("Title: {Title}")]
public class MusicTrackMetadataDto
{
/// <summary>
/// Gets or sets the title of the track.
/// </summary>
public string? Title { get; set; }
/// <summary>
/// Gets or sets the original title of the track, if different from the current title.
/// </summary>
public string? OriginalTitle { get; set; }
/// <summary>
/// Gets or sets a brief description or summary of the track.
/// </summary>
public string? Description { get; set; }
/// <summary>
/// Gets or sets the disambiguation comment of the track, used to distinguish tracks with the same title.
/// </summary>
public string? Disambiguation { get; set; }
/// <summary>
/// Gets or sets the release information, including release date and other relevant details.
/// </summary>
public ReleaseInfoDto? ReleaseInfo { get; set; }
/// <summary>
/// Gets or sets the language of the track.
/// </summary>
public LanguageInfoDto? Language { get; set; }
/// <summary>
/// Gets or sets the original language of the track, if it has been translated.
/// </summary>
public LanguageInfoDto? OriginalLanguage { get; set; }
/// <summary>
/// Gets or sets the list of tags that further describe or categorize the track.
/// </summary>
public List<TagDto>? Tags { get; set; }
/// <summary>
/// Gets or sets the list of genres associated with the track.
/// </summary>
public List<GenreDto>? Genres { get; set; }
/// <summary>
/// Gets or sets whether the recording of the track is a video recording.
/// </summary>
public bool IsVideo { get; set; }
/// <summary>
/// Gets or sets the duration of the audio of the track in seconds.
/// </summary>
public int? DurationInSeconds { get; set; }
/// <summary>
/// Gets or sets the sample rate of the audio of the track in Hz.
/// </summary>
public int? SampleRate { get; set; }
/// <summary>
/// Gets or sets the number of audio channels of the track.
/// </summary>
public int? Channels { get; set; }
/// <summary>
/// Gets or sets the bit depth of the audio of the track.
/// </summary>
public int? BitDepth { get; set; }
/// <summary>
/// Gets or sets the audio codec used by the track.
/// </summary>
public string? AudioCodec { get; set; }
/// <summary>
/// Gets or sets the bitrate of the audio of the track in kbps.
/// </summary>
public int? Bitrate { get; set; }
/// <summary>
/// Gets or sets the AcoustID fingerprint identifier of the audio file of the track.
/// </summary>
public string? AcoustId { get; set; }
/// <summary>
/// Gets or sets the ReplayGain track gain of the track in decibels.
/// </summary>
public decimal? ReplayGainTrackGain { get; set; }
/// <summary>
/// Gets or sets the ReplayGain track peak of the track.
/// </summary>
public decimal? ReplayGainTrackPeak { get; set; }
/// <summary>
/// Gets or sets the ReplayGain album gain of the track in decibels.
/// </summary>
public decimal? ReplayGainAlbumGain { get; set; }
/// <summary>
/// Gets or sets the ReplayGain album peak of the track.
/// </summary>
public decimal? ReplayGainAlbumPeak { get; set; }
}
@@ -0,0 +1,40 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Presentation.Web.Common.DTO.Common;
using System;
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
/// <summary>
/// Data transfer object for a MusicBrainz work, the musical composition a track is a recording of.
/// </summary>
[DebuggerDisplay("Title: {Title}")]
public class MusicWorkDto
{
/// <summary>
/// Gets or sets the MusicBrainz identifier of the work.
/// </summary>
public Guid? MusicBrainzWorkId { get; set; }
/// <summary>
/// Gets or sets the title of the work.
/// </summary>
public string? Title { get; set; }
/// <summary>
/// Gets or sets the MusicBrainz type of the work, if applicable.
/// </summary>
public string? Type { get; set; }
/// <summary>
/// Gets or sets the list of languages of the work.
/// </summary>
public List<LanguageInfoDto>? Languages { get; set; }
/// <summary>
/// Gets or sets the list of ISWC (International Standard Musical Work Code) of the work.
/// </summary>
public List<string>? Iswcs { get; set; }
}
@@ -0,0 +1,38 @@
#region ========================================================================= USING =====================================================================================
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
/// <summary>
/// Data transfer object for a paginated collection of lightweight album elements, together with pagination metadata.
/// </summary>
[DebuggerDisplay("CurrentPage: {CurrentPage}; Count: {Count}")]
public class PaginatedMusicAlbumLiteDto
{
/// <summary>
/// Gets or sets the collection of lightweight album elements associated with this instance.
/// </summary>
public IReadOnlyList<MusicAlbumLiteDto> Data { get; set; } = [];
/// <summary>
/// Gets or sets the current page number in a paginated collection.
/// </summary>
public int CurrentPage { get; set; }
/// <summary>
/// Gets or sets the number of items to include per page in paginated results.
/// </summary>
public int PerPage { get; set; }
/// <summary>
/// Gets or sets the total number of elements available in the paginated result set.
/// </summary>
public int Count { get; set; }
/// <summary>
/// Gets or sets the total number of pages based on elements available in the result set and per page.
/// </summary>
public int NumberOfPages { get; set; }
}
@@ -0,0 +1,38 @@
#region ========================================================================= USING =====================================================================================
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
/// <summary>
/// Data transfer object for a paginated collection of lightweight music artist elements, together with pagination metadata.
/// </summary>
[DebuggerDisplay("CurrentPage: {CurrentPage}; Count: {Count}")]
public class PaginatedMusicArtistLiteDto
{
/// <summary>
/// Gets or sets the collection of lightweight music artist elements associated with this instance.
/// </summary>
public IReadOnlyList<MusicArtistLiteDto> Data { get; set; } = [];
/// <summary>
/// Gets or sets the current page number in a paginated collection.
/// </summary>
public int CurrentPage { get; set; }
/// <summary>
/// Gets or sets the number of items to include per page in paginated results.
/// </summary>
public int PerPage { get; set; }
/// <summary>
/// Gets or sets the total number of elements available in the paginated result set.
/// </summary>
public int Count { get; set; }
/// <summary>
/// Gets or sets the total number of pages based on elements available in the result set and per page.
/// </summary>
public int NumberOfPages { get; set; }
}
@@ -0,0 +1,38 @@
#region ========================================================================= USING =====================================================================================
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
/// <summary>
/// Data transfer object for a paginated collection of lightweight track elements, together with pagination metadata.
/// </summary>
[DebuggerDisplay("CurrentPage: {CurrentPage}; Count: {Count}")]
public class PaginatedMusicTrackLiteDto
{
/// <summary>
/// Gets or sets the collection of lightweight track elements associated with this instance.
/// </summary>
public IReadOnlyList<MusicTrackLiteDto> Data { get; set; } = [];
/// <summary>
/// Gets or sets the current page number in a paginated collection.
/// </summary>
public int CurrentPage { get; set; }
/// <summary>
/// Gets or sets the number of items to include per page in paginated results.
/// </summary>
public int PerPage { get; set; }
/// <summary>
/// Gets or sets the total number of elements available in the paginated result set.
/// </summary>
public int Count { get; set; }
/// <summary>
/// Gets or sets the total number of pages based on elements available in the result set and per page.
/// </summary>
public int NumberOfPages { get; set; }
}
@@ -0,0 +1,17 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
/// <summary>
/// Data transfer object for the response of an update music cover operation.
/// </summary>
[DebuggerDisplay("CoverPath: {CoverPath}")]
public class UpdateMusicCoverDto
{
/// <summary>
/// Gets or sets the relative path of the stored cover image.
/// </summary>
public string? CoverPath { get; set; }
}
@@ -0,0 +1,28 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Presentation.Web.Common.Enums.MediaLibrary;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.DTO.Common;
/// <summary>
/// Data transfer object for a stored piece of artwork of a media item.
/// </summary>
[DebuggerDisplay("Type: {Type}, Ordinal: {Ordinal}, Path: {Path}")]
public class MediaArtworkDto
{
/// <summary>
/// Gets or sets the type of the artwork, like the cover or the back of the media item.
/// </summary>
public ArtworkType Type { get; set; }
/// <summary>
/// Gets or sets the ordinal of the artwork within its type, so that multiple artworks of the same type can be ordered.
/// </summary>
public int Ordinal { get; set; }
/// <summary>
/// Gets or sets the relative path of the stored artwork file.
/// </summary>
public string Path { get; set; } = string.Empty;
}
@@ -0,0 +1,17 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.DTO.Common;
/// <summary>
/// Data transfer object for a mood of a media element.
/// </summary>
[DebuggerDisplay("Name: {Name}")]
public class MoodDto
{
/// <summary>
/// Gets or sets the name of the mood.
/// </summary>
public string? Name { get; set; }
}
@@ -0,0 +1,24 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Presentation.Web.Common.Enums.MediaContributors;
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.DTO.MediaContributors;
/// <summary>
/// Data transfer object for the reference to a media contributor in a media item, carrying the role the contributor played.
/// </summary>
[DebuggerDisplay("{ContributorId} - {Role}")]
public class MediaContributorReferenceDto
{
/// <summary>
/// Gets or sets the unique identifier of the media contributor.
/// </summary>
public Guid ContributorId { get; set; }
/// <summary>
/// Gets or sets the role the contributor played.
/// </summary>
public MediaContributorRole? Role { get; set; }
}
@@ -0,0 +1,32 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Enums.AudioLibrary;
/// <summary>
/// Enumeration for the gender of a music artist, applicable only to artists that are persons or characters.
/// </summary>
[DebuggerDisplay("{ToString()}")]
public enum MusicArtistGender
{
/// <summary>
/// The artist identifies as male.
/// </summary>
Male,
/// <summary>
/// The artist identifies as female.
/// </summary>
Female,
/// <summary>
/// The artist identifies with a gender other than male or female.
/// </summary>
Other,
/// <summary>
/// The gender of the artist is not applicable, or is deliberately not stated.
/// </summary>
NotApplicable
}
@@ -0,0 +1,42 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Enums.AudioLibrary;
/// <summary>
/// Enumeration for the type of a music artist, describing whether the artist is an individual, an ensemble, or something else.
/// </summary>
[DebuggerDisplay("{ToString()}")]
public enum MusicArtistType
{
/// <summary>
/// The artist is an individual person.
/// </summary>
Person,
/// <summary>
/// The artist is a group of people that may or may not have a distinctive name.
/// </summary>
Group,
/// <summary>
/// The artist is an orchestra, a large instrumental ensemble.
/// </summary>
Orchestra,
/// <summary>
/// The artist is a choir or chorus, a large vocal ensemble.
/// </summary>
Choir,
/// <summary>
/// The artist is an individual fictional character.
/// </summary>
Character,
/// <summary>
/// The type of the artist does not fit into any of the known categories.
/// </summary>
Other
}
@@ -0,0 +1,132 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Enums.AudioLibrary;
/// <summary>
/// Enumeration for the musical key of a track, describing the pitch and the major or minor mode of the key.
/// </summary>
[DebuggerDisplay("{ToString()}")]
public enum MusicKey
{
/// <summary>
/// The musical key of C major.
/// </summary>
CMajor,
/// <summary>
/// The musical key of C sharp major.
/// </summary>
CSharpMajor,
/// <summary>
/// The musical key of D major.
/// </summary>
DMajor,
/// <summary>
/// The musical key of D sharp major.
/// </summary>
DSharpMajor,
/// <summary>
/// The musical key of E major.
/// </summary>
EMajor,
/// <summary>
/// The musical key of F major.
/// </summary>
FMajor,
/// <summary>
/// The musical key of F sharp major.
/// </summary>
FSharpMajor,
/// <summary>
/// The musical key of G major.
/// </summary>
GMajor,
/// <summary>
/// The musical key of G sharp major.
/// </summary>
GSharpMajor,
/// <summary>
/// The musical key of A major.
/// </summary>
AMajor,
/// <summary>
/// The musical key of A sharp major.
/// </summary>
ASharpMajor,
/// <summary>
/// The musical key of B major.
/// </summary>
BMajor,
/// <summary>
/// The musical key of C minor.
/// </summary>
CMinor,
/// <summary>
/// The musical key of C sharp minor.
/// </summary>
CSharpMinor,
/// <summary>
/// The musical key of D minor.
/// </summary>
DMinor,
/// <summary>
/// The musical key of D sharp minor.
/// </summary>
DSharpMinor,
/// <summary>
/// The musical key of E minor.
/// </summary>
EMinor,
/// <summary>
/// The musical key of F minor.
/// </summary>
FMinor,
/// <summary>
/// The musical key of F sharp minor.
/// </summary>
FSharpMinor,
/// <summary>
/// The musical key of G minor.
/// </summary>
GMinor,
/// <summary>
/// The musical key of G sharp minor.
/// </summary>
GSharpMinor,
/// <summary>
/// The musical key of A minor.
/// </summary>
AMinor,
/// <summary>
/// The musical key of A sharp minor.
/// </summary>
ASharpMinor,
/// <summary>
/// The musical key of B minor.
/// </summary>
BMinor
}
@@ -0,0 +1,577 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Enums.AudioLibrary;
/// <summary>
/// Enumeration for the physical or digital medium of a music release.
/// </summary>
[DebuggerDisplay("{ToString()}")]
public enum MusicMediaFormat
{
/// <summary>
/// The release was distributed on a 10 inch acetate disc.
/// </summary>
Inch10Acetate,
/// <summary>
/// The release was distributed on a 10 inch shellac disc.
/// </summary>
Inch10Shellac,
/// <summary>
/// The release was distributed on a 10 inch vinyl record.
/// </summary>
Inch10Vinyl,
/// <summary>
/// The release was distributed on a 12 inch acetate disc.
/// </summary>
Inch12Acetate,
/// <summary>
/// The release was distributed on a 12 inch LaserDisc.
/// </summary>
Inch12LaserDisc,
/// <summary>
/// The release was distributed on a 12 inch shellac disc.
/// </summary>
Inch12Shellac,
/// <summary>
/// The release was distributed on a 12 inch vinyl record.
/// </summary>
Inch12Vinyl,
/// <summary>
/// The release was distributed on a 3 inch vinyl record.
/// </summary>
Inch3Vinyl,
/// <summary>
/// The release was distributed on a 3.5 inch floppy disk.
/// </summary>
Inch3_5FloppyDisk,
/// <summary>
/// The release was distributed on a 5.25 inch floppy disk.
/// </summary>
Inch5_25FloppyDisk,
/// <summary>
/// The release was distributed on a 7 inch acetate disc.
/// </summary>
Inch7Acetate,
/// <summary>
/// The release was distributed on a 7 inch flexi disc.
/// </summary>
Inch7FlexiDisc,
/// <summary>
/// The release was distributed on a 7 inch shellac disc.
/// </summary>
Inch7Shellac,
/// <summary>
/// The release was distributed on a 7 inch vinyl record.
/// </summary>
Inch7Vinyl,
/// <summary>
/// The release was distributed on an 8 inch LaserDisc.
/// </summary>
Inch8LaserDisc,
/// <summary>
/// The release was distributed on an 8-track cartridge.
/// </summary>
EightTrackCartridge,
/// <summary>
/// The release was distributed on an 8 cm compact disc.
/// </summary>
Cm8CD,
/// <summary>
/// The release was distributed on an 8 cm compact disc with graphics.
/// </summary>
Cm8CDPlusG,
/// <summary>
/// The release was distributed on an 8 cm recordable compact disc.
/// </summary>
Cm8CDMinusR,
/// <summary>
/// The release was distributed on an acetate disc.
/// </summary>
Acetate,
/// <summary>
/// The release was distributed on a Betacam SP videotape.
/// </summary>
BetacamSP,
/// <summary>
/// The release was distributed on a Betamax videocassette.
/// </summary>
Betamax,
/// <summary>
/// The release was distributed on a Blu-ray disc.
/// </summary>
BluRay,
/// <summary>
/// The release was distributed on a recordable Blu-ray disc.
/// </summary>
BluRayMinusR,
/// <summary>
/// The release was distributed on a Blu-spec compact disc.
/// </summary>
BluSpecCD,
/// <summary>
/// The release was distributed on a cartridge.
/// </summary>
Cartridge,
/// <summary>
/// The release was distributed on a compact cassette.
/// </summary>
Cassette,
/// <summary>
/// The release was distributed on a compact disc.
/// </summary>
CD,
/// <summary>
/// The release was distributed on a compact disc with graphics.
/// </summary>
CDPlusG,
/// <summary>
/// The release was distributed on a CD-i (compact disc interactive).
/// </summary>
CDMinusi,
/// <summary>
/// The release was distributed on a recordable compact disc.
/// </summary>
CDMinusR,
/// <summary>
/// The release was distributed on a CD Video.
/// </summary>
CDV,
/// <summary>
/// The release was distributed on a Capacitance Electronic Disc.
/// </summary>
CED,
/// <summary>
/// The release was distributed on a copy-controlled compact disc.
/// </summary>
CopyControlCD,
/// <summary>
/// The release was distributed on a Digital Audio Tape.
/// </summary>
DAT,
/// <summary>
/// The release was distributed on a compact disc used for data storage.
/// </summary>
DataCD,
/// <summary>
/// The release was distributed on a DVD used for data storage.
/// </summary>
DataDVD,
/// <summary>
/// The release was distributed on a recordable DVD used for data storage.
/// </summary>
DataDVDMinusR,
/// <summary>
/// The release was distributed on a DataPlay disc.
/// </summary>
DataPlay,
/// <summary>
/// The release was distributed on a Digital Compact Cassette.
/// </summary>
DCC,
/// <summary>
/// The release was distributed as a digital download or stream.
/// </summary>
DigitalMedia,
/// <summary>
/// The release was distributed on a download card.
/// </summary>
DownloadCard,
/// <summary>
/// The release was distributed on a DTS-compatible compact disc.
/// </summary>
DTSCD,
/// <summary>
/// The release was distributed on a DualDisc.
/// </summary>
DualDisc,
/// <summary>
/// The release was distributed on the CD side of a DualDisc.
/// </summary>
DualDiscCDSide,
/// <summary>
/// The release was distributed on the DVD side of a DualDisc.
/// </summary>
DualDiscDVDSide,
/// <summary>
/// The release was distributed on the DVD-audio side of a DualDisc.
/// </summary>
DualDiscDVDAudioSide,
/// <summary>
/// The release was distributed on the DVD-video side of a DualDisc.
/// </summary>
DualDiscDVDVideoSide,
/// <summary>
/// The release was distributed on a DVD.
/// </summary>
DVD,
/// <summary>
/// The release was distributed on a DVD-Audio.
/// </summary>
DVDAudio,
/// <summary>
/// The release was distributed on a recordable DVD used for video.
/// </summary>
DVDMinusRVideo,
/// <summary>
/// The release was distributed on a DVD-Video.
/// </summary>
DVDVideo,
/// <summary>
/// The release was distributed on a DVD+.
/// </summary>
DVDPlus,
/// <summary>
/// The release was distributed on the CD side of a DVD+.
/// </summary>
DVDPlusCDSide,
/// <summary>
/// The release was distributed on the DVD-audio side of a DVD+.
/// </summary>
DVDPlusDVDAudioSide,
/// <summary>
/// The release was distributed on the DVD-video side of a DVD+.
/// </summary>
DVDPlusDVDVideoSide,
/// <summary>
/// The release was distributed on an Edison Diamond Disc.
/// </summary>
EdisonDiamondDisc,
/// <summary>
/// The release was distributed on an enhanced compact disc.
/// </summary>
EnhancedCD,
/// <summary>
/// The release was distributed on a flexi disc.
/// </summary>
FlexiDisc,
/// <summary>
/// The release was distributed on a floppy disk.
/// </summary>
FloppyDisk,
/// <summary>
/// The release was distributed on an HD DVD.
/// </summary>
HDDVD,
/// <summary>
/// The release was distributed on a High Definition Compatible Digital compact disc.
/// </summary>
HDCD,
/// <summary>
/// The release was distributed on a HiPac.
/// </summary>
HiPac,
/// <summary>
/// The release was distributed on a High Quality compact disc.
/// </summary>
HQCD,
/// <summary>
/// The release was distributed on a hybrid Super Audio CD.
/// </summary>
HybridSACD,
/// <summary>
/// The release was distributed on the CD layer of a hybrid Super Audio CD.
/// </summary>
HybridSACDCDLayer,
/// <summary>
/// The release was distributed on the SACD layer of a hybrid Super Audio CD.
/// </summary>
HybridSACDSACDLayer,
/// <summary>
/// The release was distributed on the stereo SACD layer of a hybrid Super Audio CD.
/// </summary>
HybridSACDSACDLayer2Channels,
/// <summary>
/// The release was distributed on the multichannel SACD layer of a hybrid Super Audio CD.
/// </summary>
HybridSACDSACDLayerMultichannel,
/// <summary>
/// The release was distributed on a KiT album.
/// </summary>
KiTAlbum,
/// <summary>
/// The release was distributed on a LaserDisc.
/// </summary>
LaserDisc,
/// <summary>
/// The release was distributed on a microcassette.
/// </summary>
Microcassette,
/// <summary>
/// The release was distributed on a microSD card.
/// </summary>
MicroSD,
/// <summary>
/// The release was distributed on a MiniDisc.
/// </summary>
MiniDisc,
/// <summary>
/// The release was distributed on a mini DVD.
/// </summary>
MiniDVD,
/// <summary>
/// The release was distributed on a mini DVD-Audio.
/// </summary>
MiniDVDAudio,
/// <summary>
/// The release was distributed on a mini DVD-Video.
/// </summary>
MiniDVDVideo,
/// <summary>
/// The release was distributed on a MiniMax compact disc.
/// </summary>
MinimaxCD,
/// <summary>
/// The release was distributed on a MiniMax DVD.
/// </summary>
MinimaxDVD,
/// <summary>
/// The release was distributed on a MiniMax DVD-Audio.
/// </summary>
MinimaxDVDAudio,
/// <summary>
/// The release was distributed on a MiniMax DVD-Video.
/// </summary>
MinimaxDVDVideo,
/// <summary>
/// The release was distributed on a mixed-mode compact disc.
/// </summary>
MixedModeCD,
/// <summary>
/// The medium of the release does not fall into any of the known categories.
/// </summary>
Other,
/// <summary>
/// The release was distributed on a Pathe disc.
/// </summary>
PatheDisc,
/// <summary>
/// The release was distributed on a phonograph record.
/// </summary>
PhonographRecord,
/// <summary>
/// The release was distributed on a piano roll.
/// </summary>
PianoRoll,
/// <summary>
/// The release was distributed on a Playbutton.
/// </summary>
Playbutton,
/// <summary>
/// The release was distributed on a PlayTape.
/// </summary>
PlayTape,
/// <summary>
/// The release was distributed on a reel-to-reel tape.
/// </summary>
ReelToReel,
/// <summary>
/// The release was distributed on a read-only memory cartridge.
/// </summary>
ROMCartridge,
/// <summary>
/// The release was distributed on a Super Audio CD.
/// </summary>
SACD,
/// <summary>
/// The release was distributed on a stereo Super Audio CD.
/// </summary>
SACD2Channels,
/// <summary>
/// The release was distributed on a multichannel Super Audio CD.
/// </summary>
SACDMultichannel,
/// <summary>
/// The release was distributed on an SD card.
/// </summary>
SDCard,
/// <summary>
/// The release was distributed on a shellac disc.
/// </summary>
Shellac,
/// <summary>
/// The release was distributed on a Super High Material compact disc.
/// </summary>
SHMCD,
/// <summary>
/// The release was distributed on a Super High Material Super Audio CD.
/// </summary>
SHMSACD,
/// <summary>
/// The release was distributed on a multichannel Super High Material Super Audio CD.
/// </summary>
SHMSACDMultichannel,
/// <summary>
/// The release was distributed on a slotMusic card.
/// </summary>
SlotMusic,
/// <summary>
/// The release was distributed on a Super Video CD.
/// </summary>
SVCD,
/// <summary>
/// The release was distributed on a Tefifon cartridge.
/// </summary>
Tefifon,
/// <summary>
/// The release was distributed on a Universal Media Disc.
/// </summary>
UMD,
/// <summary>
/// The release was distributed on a USB flash drive.
/// </summary>
USBFlashDrive,
/// <summary>
/// The release was distributed on a Video CD.
/// </summary>
VCD,
/// <summary>
/// The release was distributed on a Video High Density disc.
/// </summary>
VHD,
/// <summary>
/// The release was distributed on a VHS videocassette.
/// </summary>
VHS,
/// <summary>
/// The release was distributed on a vinyl record.
/// </summary>
Vinyl,
/// <summary>
/// The release was distributed on a VinylDisc.
/// </summary>
VinylDisc,
/// <summary>
/// The release was distributed on the CD side of a VinylDisc.
/// </summary>
VinylDiscCDSide,
/// <summary>
/// The release was distributed on the DVD side of a VinylDisc.
/// </summary>
VinylDiscDVDSide,
/// <summary>
/// The release was distributed on the vinyl side of a VinylDisc.
/// </summary>
VinylDiscVinylSide,
/// <summary>
/// The release was distributed on a wax cylinder.
/// </summary>
WaxCylinder,
/// <summary>
/// The release was distributed on a Zip disk.
/// </summary>
ZipDisk
}
@@ -0,0 +1,132 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Enums.AudioLibrary;
/// <summary>
/// Enumeration for the outermost physical packaging of a music release.
/// </summary>
[DebuggerDisplay("{ToString()}")]
public enum MusicReleasePackaging
{
/// <summary>
/// The release is a book with a sleeve containing a medium, usually a compact disc.
/// </summary>
Book,
/// <summary>
/// The release is a box with a lid or an opening that contains the medium and other packaging, like posters and a booklet.
/// </summary>
Box,
/// <summary>
/// The release is a sleeve made of paper, paperboard, or cardboard.
/// </summary>
CardboardPaperSleeve,
/// <summary>
/// The release is a regular plastic case for a cassette.
/// </summary>
CassetteCase,
/// <summary>
/// The release is a minimalistic plastic case where the back and the front are kept together by a small hinge.
/// </summary>
ClamshellCase,
/// <summary>
/// The release is a bounded booklet, usually in hardcover, with a sleeve bound to its spine that houses a compact disc.
/// </summary>
Digibook,
/// <summary>
/// The release is a folded cardboard compact disc packaging that has a small pocket on one side for the disc.
/// </summary>
Digifile,
/// <summary>
/// The release is a folded case, typically made of coated paperboard, with one or more plastic trays glued into it.
/// </summary>
Digipak,
/// <summary>
/// The release is a pouch-like package with an internal mechanism that pushes the contents out when the lid flap is opened.
/// </summary>
DiscboxSlider,
/// <summary>
/// The release is a double-sided, double-width jewel case normally holding two to four compact discs.
/// </summary>
Fatbox,
/// <summary>
/// The release is a cardboard sleeve that folds in halves, thirds, or more, and can hold multiple records, compact discs, booklets, or posters.
/// </summary>
GatefoldCover,
/// <summary>
/// The release is the traditional compact disc case, made of hard, brittle plastic.
/// </summary>
JewelCase,
/// <summary>
/// The release is the traditional DVD case, made of soft plastic with a thin transparent cover protecting the artwork.
/// </summary>
KeepCase,
/// <summary>
/// The release is a large cardboard box, often used to sell compact discs in North America so that they would fit vinyl racks.
/// </summary>
Longbox,
/// <summary>
/// The release is an often decorated metal tin containing one or more compact discs.
/// </summary>
MetalTin,
/// <summary>
/// The release is a sleeve made entirely of plastic that holds the medium and the other parts of the album.
/// </summary>
PlasticSleeve,
/// <summary>
/// The release is a box with openings at its two ends that contains a tray holding the medium.
/// </summary>
Slidepack,
/// <summary>
/// The release is a thinner jewel case, commonly used for compact disc singles.
/// </summary>
SlimJewelCase,
/// <summary>
/// The release is a four or five-sided box that surrounds a second inner package such as a jewel case.
/// </summary>
Slipcase,
/// <summary>
/// The release is a digipak-like case held together with a snapping plastic closure.
/// </summary>
SnapCase,
/// <summary>
/// The release is a cardboard jacket, commonly used for 8cm compact disc singles in Japan.
/// </summary>
SnapPack,
/// <summary>
/// The release is a case similar to the regular jewel case, but with rounded corners and a latch closing mechanism.
/// </summary>
SuperJewelBox,
/// <summary>
/// The packaging of the release does not fit into any of the known categories.
/// </summary>
Other,
/// <summary>
/// The release has no packaging at all, which is common for digital media.
/// </summary>
None
}
@@ -0,0 +1,47 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Enums.AudioLibrary;
/// <summary>
/// Enumeration for the status of a music release, describing the officiality of the release.
/// </summary>
[DebuggerDisplay("{ToString()}")]
public enum MusicReleaseStatus
{
/// <summary>
/// The release was distributed without the authorization of the artist or label.
/// </summary>
Bootleg,
/// <summary>
/// The release was announced but never distributed.
/// </summary>
Cancelled,
/// <summary>
/// The release was expunged from the catalog of the artist or label.
/// </summary>
Expunged,
/// <summary>
/// The release was released through official channels.
/// </summary>
Official,
/// <summary>
/// The release was distributed for promotional purposes only.
/// </summary>
Promotion,
/// <summary>
/// The release is a pseudo-release, not an actual release by the artist.
/// </summary>
PseudoRelease,
/// <summary>
/// The release was distributed but later withdrawn from circulation.
/// </summary>
Withdrawn
}
@@ -0,0 +1,97 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Enums.AudioLibrary;
/// <summary>
/// Enumeration for the type of a music release, describing the format of the release in terms of its content.
/// </summary>
[DebuggerDisplay("{ToString()}")]
public enum MusicReleaseType
{
/// <summary>
/// A release consisting of a collection of tracks.
/// </summary>
Album,
/// <summary>
/// A release that was aired as a broadcast.
/// </summary>
Broadcast,
/// <summary>
/// A release that is longer than a single but shorter than an album.
/// </summary>
Ep,
/// <summary>
/// The type of the release does not fall into any of the known categories.
/// </summary>
Other,
/// <summary>
/// A release consisting of a small number of tracks.
/// </summary>
Single,
/// <summary>
/// A release containing a dramatized audio performance.
/// </summary>
AudioDrama,
/// <summary>
/// A release containing a recording of a book being read aloud.
/// </summary>
AudioBook,
/// <summary>
/// A release that gathers tracks from various sources or artists.
/// </summary>
Compilation,
/// <summary>
/// A release containing a continuous mix of tracks by a DJ.
/// </summary>
DjMix,
/// <summary>
/// A release of demo recordings, typically distributed before the official release.
/// </summary>
Demo,
/// <summary>
/// A release containing an audio recording made outside of a studio.
/// </summary>
FieldRecording,
/// <summary>
/// A release containing a recorded interview.
/// </summary>
Interview,
/// <summary>
/// A release recorded during a live performance.
/// </summary>
Live,
/// <summary>
/// A release containing a compilation of tracks, typically distributed outside of official channels.
/// </summary>
Mixtape,
/// <summary>
/// A release containing modified or reinterpreted versions of original recordings.
/// </summary>
Remix,
/// <summary>
/// A release containing music written for a motion picture or television program.
/// </summary>
Soundtrack,
/// <summary>
/// A release containing spoken word content.
/// </summary>
SpokenWord
}
@@ -0,0 +1,92 @@
namespace Lumina.Presentation.Web.Common.Enums.MediaLibrary;
/// <summary>
/// Enumeration for the type of artwork of a media library item.
/// </summary>
public enum ArtworkType
{
/// <summary>
/// The main artwork of the media library item, like the cover of a book.
/// </summary>
Cover,
/// <summary>
/// The front of the artwork of the media library item, when it is stored separately from the cover.
/// </summary>
Front,
/// <summary>
/// The back of the artwork of the media library item.
/// </summary>
Back,
/// <summary>
/// A page of the booklet of the media library item.
/// </summary>
Booklet,
/// <summary>
/// The artwork printed on the medium of the media library item, like a disc label.
/// </summary>
Medium,
/// <summary>
/// The artwork printed on the tray of the media library item.
/// </summary>
Tray,
/// <summary>
/// The artwork printed on the spine of the media library item.
/// </summary>
Spine,
/// <summary>
/// The obi strip of the media library item.
/// </summary>
Obi,
/// <summary>
/// The sticker of the media library item.
/// </summary>
Sticker,
/// <summary>
/// The poster of the media library item.
/// </summary>
Poster,
/// <summary>
/// The liner notes of the media library item.
/// </summary>
Liner,
/// <summary>
/// A watermark carried by the artwork of the media library item.
/// </summary>
Watermark,
/// <summary>
/// The backdrop, or fanart, of the media library item.
/// </summary>
Backdrop,
/// <summary>
/// The banner of the media library item.
/// </summary>
Banner,
/// <summary>
/// The logo of the media library item.
/// </summary>
Logo,
/// <summary>
/// The thumbnail of the media library item.
/// </summary>
Thumb,
/// <summary>
/// Any other artwork of the media library item.
/// </summary>
Other,
}
@@ -0,0 +1,21 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Albums;
/// <summary>
/// Represents a request to get the lightweight details of the albums of a music artist.
/// </summary>
/// <param name="ArtistId">The unique identifier of the artist whose albums are retrieved, taken from the route. Required.</param>
/// <param name="LibraryId">The unique identifier of the media library the artist belongs to. Required.</param>
/// <param name="CurrentPage">The page of results to retrieve. Optional.</param>
/// <param name="PerPage">The maximum number of albums to retrieve per page. Optional.</param>
[DebuggerDisplay("ArtistId: {ArtistId}")]
public record GetArtistAlbumsLiteRequest(
string ArtistId,
Guid LibraryId,
int? CurrentPage,
int? PerPage
);
@@ -0,0 +1,19 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Albums;
/// <summary>
/// Represents a request for displaying the details of an album of a music artist.
/// </summary>
/// <param name="ArtistId">The unique identifier of the artist the album belongs to, taken from the route. Required.</param>
/// <param name="AlbumId">The unique identifier of the album whose details are displayed, taken from the route. Required.</param>
/// <param name="LibraryId">The Id of the media library the album belongs to. Required.</param>
[DebuggerDisplay("AlbumId: {AlbumId}")]
public record GetMusicAlbumViewRequest(
string ArtistId,
string AlbumId,
Guid LibraryId
);
@@ -0,0 +1,42 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Presentation.Web.Common.DTO.AudioLibrary;
using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
using Lumina.Presentation.Web.Common.DTO.MediaContributors;
using Lumina.Presentation.Web.Common.Enums.AudioLibrary;
using System;
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Albums;
/// <summary>
/// Represents a request to update an existing album of a music artist.
/// </summary>
/// <param name="Metadata">The album metadata of the album. Required.</param>
/// <param name="MediaFormat">The physical or digital medium of the album. Optional.</param>
/// <param name="Packaging">The outermost physical packaging of the album. Optional.</param>
/// <param name="Barcode">The barcode of the album. Optional.</param>
/// <param name="CatalogNumbers">The catalog numbers of the album. Optional.</param>
/// <param name="Label">The name of the label that issued the album. Optional.</param>
/// <param name="ASIN">The ASIN (Amazon Standard Identification Number) of the album. Optional.</param>
/// <param name="MusicBrainzReleaseId">The MusicBrainz identifier of the release. Optional.</param>
/// <param name="MusicBrainzReleaseGroupId">The MusicBrainz identifier of the release group. Optional.</param>
/// <param name="MusicBrainzReleaseArtistId">The MusicBrainz identifier of the release artist. Optional.</param>
/// <param name="Contributors">The list of media contributors that performed on the album. Required.</param>
/// <param name="Ratings">The list of ratings for this album. Required.</param>
[DebuggerDisplay("Title: {Metadata?.Title}")]
public record UpdateMusicAlbumRequest(
MusicAlbumMetadataDto? Metadata,
MusicMediaFormat? MediaFormat,
MusicReleasePackaging? Packaging,
string? Barcode,
List<string>? CatalogNumbers,
string? Label,
string? ASIN,
Guid? MusicBrainzReleaseId,
Guid? MusicBrainzReleaseGroupId,
Guid? MusicBrainzReleaseArtistId,
List<MediaContributorReferenceDto>? Contributors,
List<AudioRatingDto>? Ratings
);
@@ -0,0 +1,17 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists;
/// <summary>
/// Represents a request for displaying the details of a music artist.
/// </summary>
/// <param name="ArtistId">The unique identifier of the artist whose details are displayed, taken from the route. Required.</param>
/// <param name="LibraryId">The Id of the media library the artist belongs to. Required.</param>
[DebuggerDisplay("ArtistId: {ArtistId}")]
public record GetMusicArtistViewRequest(
string ArtistId,
Guid LibraryId
);
@@ -0,0 +1,34 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Presentation.Web.Common.Enums.Common;
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists;
/// <summary>
/// Represents a request to get the lightweight details of the artists of a media library.
/// </summary>
/// <param name="LibraryId">The unique identifier of the media library whose artists are retrieved. Required.</param>
/// <param name="CurrentPage">The page of results to retrieve. Optional.</param>
/// <param name="PerPage">The maximum number of artists to retrieve per page. Optional.</param>
/// <param name="SearchTerm">The search term used to filter the artists by name. Optional.</param>
/// <param name="FilterAlphaKey">
/// The alpha key used to filter the results by the first character of their name, for the alpha picker. Optional.
/// Can be <see langword="null"/> to disable alpha filtering, a single ASCII letter (case-insensitive) to filter by that letter,
/// "#" to filter by names whose first character is a digit, or "*" to filter by names whose first character is neither a letter nor a digit.
/// </param>
/// <param name="ShouldIgnoreThePrefixForAlphaPicker">Whether the leading "The " prefix of a name is ignored when computing the alpha key, or not. Optional.</param>
/// <param name="SortBy">The name of the field by which to sort the results. Optional.</param>
/// <param name="SortOrder">The direction in which to sort the results. Optional.</param>
[DebuggerDisplay("LibraryId: {LibraryId}")]
public record GetMusicArtistsLiteRequest(
Guid LibraryId,
int? CurrentPage,
int? PerPage,
string? SearchTerm,
string? FilterAlphaKey,
bool ShouldIgnoreThePrefixForAlphaPicker,
string? SortBy,
SortOrder? SortOrder
);
@@ -0,0 +1,15 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists;
/// <summary>
/// Represents a request for displaying the music artists browsing view.
/// </summary>
/// <param name="LibraryId">The unique identifier of the media library whose artists are browsed. Optional.</param>
[DebuggerDisplay("LibraryId: {LibraryId}")]
public record GetMusicArtistsViewRequest(
Guid? LibraryId
);
@@ -0,0 +1,46 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Presentation.Web.Common.DTO.AudioLibrary;
using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
using Lumina.Presentation.Web.Common.DTO.MediaContributors;
using Lumina.Presentation.Web.Common.Enums.AudioLibrary;
using System;
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists;
/// <summary>
/// Represents a request to update an album of an artist, together with the tracks of the album, within an artist update.
/// </summary>
/// <param name="AlbumId">The Id of the album, when the album already exists. Optional.</param>
/// <param name="Metadata">The album metadata of the album. Required.</param>
/// <param name="MediaFormat">The physical or digital medium of the album. Optional.</param>
/// <param name="Packaging">The outermost physical packaging of the album. Optional.</param>
/// <param name="Barcode">The barcode of the album. Optional.</param>
/// <param name="CatalogNumbers">The catalog numbers of the album. Optional.</param>
/// <param name="Label">The name of the label that issued the album. Optional.</param>
/// <param name="ASIN">The ASIN (Amazon Standard Identification Number) of the album. Optional.</param>
/// <param name="MusicBrainzReleaseId">The MusicBrainz identifier of the release. Optional.</param>
/// <param name="MusicBrainzReleaseGroupId">The MusicBrainz identifier of the release group. Optional.</param>
/// <param name="MusicBrainzReleaseArtistId">The MusicBrainz identifier of the release artist. Optional.</param>
/// <param name="Contributors">The list of media contributors that performed on the album. Required.</param>
/// <param name="Ratings">The list of ratings for this album. Required.</param>
/// <param name="Tracks">The list of tracks of the album, each with the Id of the track when the track already exists. Required.</param>
[DebuggerDisplay("Title: {Metadata?.Title}")]
public record UpdateMusicArtistAlbumRequest(
Guid? AlbumId,
MusicAlbumMetadataDto? Metadata,
MusicMediaFormat? MediaFormat,
MusicReleasePackaging? Packaging,
string? Barcode,
List<string>? CatalogNumbers,
string? Label,
string? ASIN,
Guid? MusicBrainzReleaseId,
Guid? MusicBrainzReleaseGroupId,
Guid? MusicBrainzReleaseArtistId,
List<MediaContributorReferenceDto>? Contributors,
List<AudioRatingDto>? Ratings,
List<UpdateMusicArtistTrackRequest>? Tracks
);
@@ -0,0 +1,33 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Presentation.Web.Common.DTO.AudioLibrary;
using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
using Lumina.Presentation.Web.Common.DTO.MediaContributors;
using System;
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists;
/// <summary>
/// Represents a request to update a music artist, together with the albums of the artist and the tracks of those albums.
/// </summary>
/// <param name="Metadata">The metadata of the artist. Required.</param>
/// <param name="Website">The website of the artist. Optional.</param>
/// <param name="MusicBrainzArtistId">The MusicBrainz identifier of the artist. Optional.</param>
/// <param name="Ipis">The list of IPI (Interested Party Information) codes of the artist. Optional.</param>
/// <param name="Isnis">The list of ISNI (International Standard Name Identifier) codes of the artist. Optional.</param>
/// <param name="Contributors">The list of media contributors that make up the artist. Required.</param>
/// <param name="Ratings">The list of ratings for the artist. Required.</param>
/// <param name="Albums">The list of albums of the artist, each with its own list of tracks. Required.</param>
[DebuggerDisplay("Name: {Metadata?.Name}")]
public record UpdateMusicArtistRequest(
MusicArtistMetadataDto? Metadata,
string? Website,
Guid? MusicBrainzArtistId,
List<string>? Ipis,
List<string>? Isnis,
List<MediaContributorReferenceDto>? Contributors,
List<AudioRatingDto>? Ratings,
List<UpdateMusicArtistAlbumRequest>? Albums
);
@@ -0,0 +1,49 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Presentation.Web.Common.DTO.AudioLibrary;
using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
using Lumina.Presentation.Web.Common.DTO.Common;
using Lumina.Presentation.Web.Common.DTO.MediaContributors;
using Lumina.Presentation.Web.Common.Enums.AudioLibrary;
using System;
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists;
/// <summary>
/// Represents a request to update a track of an album of an artist, within an artist update.
/// </summary>
/// <param name="TrackId">The Id of the track, when the track already exists. Optional.</param>
/// <param name="Path">The file system path of the track. Required.</param>
/// <param name="Metadata">The audio metadata of the track. Required.</param>
/// <param name="TrackNumber">The number of the track on its disc. Required.</param>
/// <param name="DiscNumber">The number of the disc the track belongs to. Optional.</param>
/// <param name="Script">The script used by the language of the track. Optional.</param>
/// <param name="Key">The musical key of the track. Optional.</param>
/// <param name="Bpm">The tempo of the track in beats per minute. Optional.</param>
/// <param name="Work">The work the track is a recording of. Optional.</param>
/// <param name="MusicBrainzRecordingId">The MusicBrainz identifier of the recording. Optional.</param>
/// <param name="MusicBrainzTrackId">The MusicBrainz identifier of the track. Optional.</param>
/// <param name="Moods">The list of moods of the track. Optional.</param>
/// <param name="Isrcs">The list of ISRC (International Standard Recording Code) of the track. Optional.</param>
/// <param name="Contributors">The list of media contributors that performed on the track. Required.</param>
/// <param name="Ratings">The list of ratings for this track. Required.</param>
[DebuggerDisplay("Title: {Metadata?.Title}")]
public record UpdateMusicArtistTrackRequest(
Guid? TrackId,
string? Path,
MusicTrackMetadataDto? Metadata,
int? TrackNumber,
int? DiscNumber,
string? Script,
MusicKey? Key,
int? Bpm,
MusicWorkDto? Work,
Guid? MusicBrainzRecordingId,
Guid? MusicBrainzTrackId,
List<MoodDto>? Moods,
List<IsrcDto>? Isrcs,
List<MediaContributorReferenceDto>? Contributors,
List<AudioRatingDto>? Ratings
);
@@ -0,0 +1,23 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Tracks;
/// <summary>
/// Represents a request to get the lightweight details of the tracks of an album.
/// </summary>
/// <param name="ArtistId">The unique identifier of the artist the album belongs to, taken from the route. Required.</param>
/// <param name="AlbumId">The unique identifier of the album whose tracks are retrieved, taken from the route. Required.</param>
/// <param name="LibraryId">The unique identifier of the media library the album belongs to. Required.</param>
/// <param name="CurrentPage">The page of results to retrieve. Optional.</param>
/// <param name="PerPage">The maximum number of tracks to retrieve per page. Optional.</param>
[DebuggerDisplay("AlbumId: {AlbumId}")]
public record GetAlbumTracksLiteRequest(
string ArtistId,
string AlbumId,
Guid LibraryId,
int? CurrentPage,
int? PerPage
);
@@ -0,0 +1,21 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Tracks;
/// <summary>
/// Represents a request for displaying the details of a track of an album of a music artist.
/// </summary>
/// <param name="ArtistId">The unique identifier of the artist the album belongs to, taken from the route. Required.</param>
/// <param name="AlbumId">The unique identifier of the album the track belongs to, taken from the route. Required.</param>
/// <param name="TrackId">The unique identifier of the track whose details are displayed, taken from the route. Required.</param>
/// <param name="LibraryId">The Id of the media library the track belongs to. Required.</param>
[DebuggerDisplay("TrackId: {TrackId}")]
public record GetMusicTrackViewRequest(
string ArtistId,
string AlbumId,
string TrackId,
Guid LibraryId
);
@@ -0,0 +1,47 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Presentation.Web.Common.DTO.AudioLibrary;
using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
using Lumina.Presentation.Web.Common.DTO.Common;
using Lumina.Presentation.Web.Common.DTO.MediaContributors;
using Lumina.Presentation.Web.Common.Enums.AudioLibrary;
using System;
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Tracks;
/// <summary>
/// Represents a request to update an existing track of an album of a music artist.
/// </summary>
/// <param name="Path">The file system path of the track. Required.</param>
/// <param name="Metadata">The audio metadata of the track. Required.</param>
/// <param name="TrackNumber">The number of the track on its disc. Required.</param>
/// <param name="DiscNumber">The number of the disc the track belongs to. Optional.</param>
/// <param name="Script">The script used by the language of the track. Optional.</param>
/// <param name="Key">The musical key of the track. Optional.</param>
/// <param name="Bpm">The tempo of the track in beats per minute. Optional.</param>
/// <param name="Work">The work the track is a recording of. Optional.</param>
/// <param name="MusicBrainzRecordingId">The MusicBrainz identifier of the recording. Optional.</param>
/// <param name="MusicBrainzTrackId">The MusicBrainz identifier of the track. Optional.</param>
/// <param name="Moods">The list of moods of the track. Optional.</param>
/// <param name="Isrcs">The list of ISRC (International Standard Recording Code) of the track. Optional.</param>
/// <param name="Contributors">The list of media contributors that performed on the track. Required.</param>
/// <param name="Ratings">The list of ratings for this track. Required.</param>
[DebuggerDisplay("Title: {Metadata?.Title}")]
public record UpdateMusicTrackRequest(
string? Path,
MusicTrackMetadataDto? Metadata,
int? TrackNumber,
int? DiscNumber,
string? Script,
MusicKey? Key,
int? Bpm,
MusicWorkDto? Work,
Guid? MusicBrainzRecordingId,
Guid? MusicBrainzTrackId,
List<MoodDto>? Moods,
List<IsrcDto>? Isrcs,
List<MediaContributorReferenceDto>? Contributors,
List<AudioRatingDto>? Ratings
);
@@ -0,0 +1,28 @@
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 library endpoints of the remote API.
/// </summary>
public static class Music
{
public const string GET_ARTISTS_LITE = "libraries/{libraryId}/artists/lite";
public const string GET_ARTIST = "libraries/{libraryId}/artists/{artistId}";
public const string UPDATE_ARTIST = "libraries/{libraryId}/artists/{artistId}";
public const string UPDATE_ARTIST_COVER = "libraries/{libraryId}/artists/{artistId}/cover";
public const string DELETE_ARTIST = "libraries/{libraryId}/artists/{artistId}";
public const string GET_ARTIST_ALBUMS_LITE = "libraries/{libraryId}/artists/{artistId}/albums/lite";
public const string GET_ALBUM = "libraries/{libraryId}/artists/{artistId}/albums/{albumId}";
public const string UPDATE_ALBUM = "libraries/{libraryId}/artists/{artistId}/albums/{albumId}";
public const string UPDATE_ALBUM_COVER = "libraries/{libraryId}/artists/{artistId}/albums/{albumId}/cover";
public const string DELETE_ALBUM = "libraries/{libraryId}/artists/{artistId}/albums/{albumId}";
public const string GET_ALBUM_TRACKS_LITE = "libraries/{libraryId}/artists/{artistId}/albums/{albumId}/tracks/lite";
public const string GET_TRACK = "libraries/{libraryId}/artists/{artistId}/albums/{albumId}/tracks/{trackId}";
public const string UPDATE_TRACK = "libraries/{libraryId}/artists/{artistId}/albums/{albumId}/tracks/{trackId}";
public const string DELETE_TRACK = "libraries/{libraryId}/artists/{artistId}/albums/{albumId}/tracks/{trackId}";
}
}
@@ -0,0 +1,32 @@
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 music library pages.
/// </summary>
public static class Music
{
public const string ARTISTS_INDEX = "{culture}/library/audio-library/music-library/artists";
public const string GET_ARTISTS = "{culture}/library/audio-library/music-library/artists/api-get-artists";
public const string ARTIST = "{culture}/library/audio-library/music-library/artists/{artistId}";
public const string GET_ARTIST = "{culture}/library/audio-library/music-library/artists/{artistId}/api-get-artist";
public const string SAVE_ARTIST = "{culture}/library/audio-library/music-library/artists/{artistId}/api-save-artist";
public const string UPDATE_ARTIST_COVER = "{culture}/library/audio-library/music-library/artists/{artistId}/api-update-cover";
public const string DELETE_ARTIST = "{culture}/library/audio-library/music-library/artists/{artistId}/api-delete-artist";
public const string GET_ARTIST_ALBUMS = "{culture}/library/audio-library/music-library/artists/{artistId}/albums/api-get-albums";
public const string ALBUM = "{culture}/library/audio-library/music-library/artists/{artistId}/albums/{albumId}";
public const string GET_ALBUM = "{culture}/library/audio-library/music-library/artists/{artistId}/albums/{albumId}/api-get-album";
public const string SAVE_ALBUM = "{culture}/library/audio-library/music-library/artists/{artistId}/albums/{albumId}/api-save-album";
public const string UPDATE_ALBUM_COVER = "{culture}/library/audio-library/music-library/artists/{artistId}/albums/{albumId}/api-update-cover";
public const string DELETE_ALBUM = "{culture}/library/audio-library/music-library/artists/{artistId}/albums/{albumId}/api-delete-album";
public const string GET_ALBUM_TRACKS = "{culture}/library/audio-library/music-library/artists/{artistId}/albums/{albumId}/tracks/api-get-tracks";
public const string TRACK = "{culture}/library/audio-library/music-library/artists/{artistId}/albums/{albumId}/tracks/{trackId}";
public const string GET_TRACK = "{culture}/library/audio-library/music-library/artists/{artistId}/albums/{albumId}/tracks/{trackId}/api-get-track";
public const string SAVE_TRACK = "{culture}/library/audio-library/music-library/artists/{artistId}/albums/{albumId}/tracks/{trackId}/api-save-track";
public const string DELETE_TRACK = "{culture}/library/audio-library/music-library/artists/{artistId}/albums/{albumId}/tracks/{trackId}/api-delete-track";
}
}
@@ -0,0 +1,64 @@
#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.Library.AudioLibrary.MusicLibrary.Albums.DeleteMusicAlbum;
/// <summary>
/// API endpoint for the <c>/{culture}/library/audio-library/music-library/artists/{artistId}/albums/{albumId}/api-delete-album</c> route.
/// </summary>
public class DeleteMusicAlbumEndpoint : BaseEndpoint<EmptyRequest, IResult>
{
private readonly IApiHttpClient _apiHttpClient;
/// <summary>
/// Initializes a new instance of the <see cref="DeleteMusicAlbumEndpoint"/> class.
/// </summary>
/// <param name="apiHttpClient">Injected service for interactions with the API.</param>
public DeleteMusicAlbumEndpoint(IApiHttpClient apiHttpClient)
{
_apiHttpClient = apiHttpClient;
}
/// <summary>
/// Configures the endpoint.
/// </summary>
public override void Configure()
{
base.Configure();
Verbs(Http.DELETE);
Routes(WebRoutes.Music.DELETE_ALBUM);
DontAutoTag();
Options(options => options.WithTags("Music"));
EnableAntiforgery();
}
/// <summary>
/// Deletes the music album identified by the route.
/// </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 album is identified by the {artistId} and {albumId} route values; all ids are normalized to Guids before they are 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 id.
string routeArtistId = HttpContext.Request.RouteValues["artistId"]?.ToString() ?? string.Empty;
string artistId = Guid.TryParse(routeArtistId, out Guid parsedArtistId) ? parsedArtistId.ToString() : Guid.Empty.ToString();
string routeAlbumId = HttpContext.Request.RouteValues["albumId"]?.ToString() ?? string.Empty;
string albumId = Guid.TryParse(routeAlbumId, out Guid parsedAlbumId) ? parsedAlbumId.ToString() : Guid.Empty.ToString();
string queryLibraryId = HttpContext.Request.Query["libraryId"].ToString();
string libraryId = Guid.TryParse(queryLibraryId, out Guid parsedLibraryId) ? parsedLibraryId.ToString() : Guid.Empty.ToString();
await _apiHttpClient.DeleteAsync(ApiRoutes.Music.DELETE_ALBUM.Replace("{libraryId}", libraryId).Replace("{artistId}", artistId).Replace("{albumId}", albumId), cancellationToken).ConfigureAwait(false);
return JsonSuccess();
}
}
@@ -0,0 +1,24 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using System.Diagnostics.CodeAnalysis;
#endregion
namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.DeleteMusicAlbum;
/// <summary>
/// Class used for providing a textual description for the <see cref="DeleteMusicAlbumEndpoint"/> endpoint, for OpenAPI.
/// </summary>
[ExcludeFromCodeCoverage]
public class DeleteMusicAlbumEndpointSummary : Summary<DeleteMusicAlbumEndpoint>
{
/// <summary>
/// Initializes a new instance of the <see cref="DeleteMusicAlbumEndpointSummary"/> class.
/// </summary>
public DeleteMusicAlbumEndpointSummary()
{
Summary = "Deletes a music album.";
Description = "Deletes the music album identified by the route, together with its tracks.";
Response(200, "The music album was deleted.");
}
}
@@ -0,0 +1,133 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using Lumina.Presentation.Web.Common.Api;
using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
using Lumina.Presentation.Web.Common.DTO.Themes;
using Lumina.Presentation.Web.Common.Primitives;
using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Albums;
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.Library.AudioLibrary.MusicLibrary.Albums.EditMusicAlbum;
/// <summary>
/// API endpoint for the <c>/{culture}/library/audio-library/music-library/artists/{artistId}/albums/{albumId}</c> route.
/// </summary>
public class EditMusicAlbumViewEndpoint : BaseEndpoint<GetMusicAlbumViewRequest, 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.Library.AudioLibrary.MusicLibrary.Albums.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 = "library/audio-library/music-library/albums/item";
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="EditMusicAlbumViewEndpoint"/> 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 EditMusicAlbumViewEndpoint(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.Music.ALBUM);
DontAutoTag();
Options(options => options.WithTags("Music"));
}
/// <summary>
/// Displays the music album details and editing view, rendered by the active theme with a fallback to the Razor view.
/// </summary>
/// <param name="request">The request containing the Id of the album to view.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
public override async Task<IResult> ExecuteAsync(GetMusicAlbumViewRequest request, CancellationToken cancellationToken)
{
// The view needs the full details of the album to show its current values, so they are fetched from the API up front; the route
// values are normalized to Guids before they are substituted into the upstream URL, so that a crafted route value can never escape
// its URL segment, and an unparseable id is reported by the API as a missing album id.
request = request with { ArtistId = Guid.TryParse(request.ArtistId, out Guid artistId) ? artistId.ToString() : Guid.Empty.ToString() };
request = request with { AlbumId = Guid.TryParse(request.AlbumId, out Guid albumId) ? albumId.ToString() : Guid.Empty.ToString() };
MusicAlbumDto album = await _apiHttpClient.GetAsync<MusicAlbumDto>(ApiRoutes.Music.GET_ALBUM.Replace("{libraryId}", request.LibraryId.ToString()).Replace("{artistId}", request.ArtistId).Replace("{albumId}", request.AlbumId), cancellationToken).ConfigureAwait(false);
string title = album.Metadata?.Title ?? string.Empty;
// The themed view is a regular page that submits its own requests, so a fresh anti-forgery token must be issued for it.
AntiforgeryTokenSet antiforgeryTokens = _antiforgery.GetAndStoreTokens(HttpContext);
ThemePageDto pageModel = new()
{
PageKey = VIEW_PAGE_KEY,
Title = title,
Description = string.Empty,
PageData = new Dictionary<string, object?>
{
["artistId"] = album.ArtistId.ToString(),
["albumId"] = album.Id.ToString(),
["libraryId"] = album.LibraryId.ToString(),
["antiforgeryToken"] = antiforgeryTokens.RequestToken,
["saveUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Music.SAVE_ALBUM, new { artistId = default(Guid), albumId = default(Guid) }) ?? string.Empty,
["deleteUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Music.DELETE_ALBUM, new { artistId = default(Guid), albumId = default(Guid) }) ?? string.Empty,
["tracksUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Music.GET_ALBUM_TRACKS, new { artistId = default(Guid), albumId = default(Guid) }) ?? string.Empty,
["trackUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Music.TRACK, new { artistId = default(Guid), albumId = default(Guid), trackId = default(Guid) }) ?? string.Empty,
["coverUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Music.UPDATE_ALBUM_COVER, new { artistId = default(Guid), albumId = default(Guid) }) ?? string.Empty,
["backUrl"] = (_urlService.GetAbsoluteUrl(WebRoutes.Music.ARTIST, new { artistId = album.ArtistId }) ?? string.Empty) + "?libraryId=" + album.LibraryId,
["albumJson"] = JsonSerializer.Serialize(album, s_camelCaseJsonOptions),
["strings"] = ThemePageDataFactory.CreateLocalizedStrings(_localizer),
["stringsJson"] = JsonSerializer.Serialize(ThemePageDataFactory.CreateLocalizedStrings(_localizer), s_camelCaseJsonOptions)
}
};
Result<ThemePageRenderResultDto> sectionResult = await _themePageRenderer.RenderAsync(pageModel, requestedThemeId: null, cancellationToken).ConfigureAwait(false);
if (sectionResult.IsFailure)
{
Dictionary<string, object?> viewData = new()
{
["Title"] = title
};
return View("/Core/Views/Library/AudioLibrary/MusicLibrary/Albums/Item.cshtml", album, viewData);
}
return View(
"/Core/Views/Shared/_ThemedView.cshtml",
new ThemeViewDto(sectionResult.Value.Content, sectionResult.Value.Script),
new Dictionary<string, object?> { ["Title"] = title });
}
}
@@ -0,0 +1,29 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Albums;
using System.Diagnostics.CodeAnalysis;
#endregion
namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.EditMusicAlbum;
/// <summary>
/// Class used for providing a textual description for the <see cref="EditMusicAlbumViewEndpoint"/> endpoint, for OpenAPI.
/// </summary>
[ExcludeFromCodeCoverage]
public class EditMusicAlbumViewEndpointSummary : Summary<EditMusicAlbumViewEndpoint, GetMusicAlbumViewRequest>
{
/// <summary>
/// Initializes a new instance of the <see cref="EditMusicAlbumViewEndpointSummary"/> class.
/// </summary>
public EditMusicAlbumViewEndpointSummary()
{
Summary = "Renders the music album details and editing view.";
Description = "Renders the view for displaying and editing the music album identified by the route.";
RequestParam(r => r.ArtistId, "The unique identifier of the artist the album belongs to. Required.");
RequestParam(r => r.AlbumId, "The unique identifier of the album to display. Required.");
RequestParam(r => r.LibraryId, "The unique identifier of the media library the album belongs to. Required.");
Response(200, "The view for displaying and editing the music album is rendered.");
}
}
@@ -0,0 +1,77 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using Lumina.Presentation.Web.Common.Api;
using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Albums;
using Lumina.Presentation.Web.Common.Routes;
using Lumina.Presentation.Web.Core.Endpoints.Common;
using Microsoft.AspNetCore.Http;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
#endregion
namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.GetArtistAlbums;
/// <summary>
/// API endpoint for the <c>/{culture}/library/audio-library/music-library/artists/{artistId}/albums/api-get-albums</c> route.
/// </summary>
public class GetArtistAlbumsEndpoint : BaseEndpoint<GetArtistAlbumsLiteRequest, IResult>
{
private readonly IApiHttpClient _apiHttpClient;
/// <summary>
/// Initializes a new instance of the <see cref="GetArtistAlbumsEndpoint"/> class.
/// </summary>
/// <param name="apiHttpClient">Injected service for interactions with the API.</param>
public GetArtistAlbumsEndpoint(IApiHttpClient apiHttpClient)
{
_apiHttpClient = apiHttpClient;
}
/// <summary>
/// Configures the endpoint.
/// </summary>
public override void Configure()
{
base.Configure();
Verbs(Http.GET);
Routes(WebRoutes.Music.GET_ARTIST_ALBUMS);
DontAutoTag();
Options(options => options.WithTags("Music"));
}
/// <summary>
/// Retrieves the lightweight details of the albums of a music artist.
/// </summary>
/// <param name="request">The request containing the parameters used to retrieve the albums.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
public override async Task<IResult> ExecuteAsync(GetArtistAlbumsLiteRequest request, CancellationToken cancellationToken)
{
PaginatedMusicAlbumLiteDto response = await _apiHttpClient.GetAsync<PaginatedMusicAlbumLiteDto>(BuildItemsEndpoint(request), cancellationToken).ConfigureAwait(false);
return JsonSuccess(response);
}
/// <summary>
/// Builds the API endpoint used to retrieve the lightweight details of the albums of a music artist.
/// </summary>
/// <param name="query">The request containing the parameters used to retrieve the albums.</param>
/// <returns>The API endpoint to which the retrieval request is sent.</returns>
private static string BuildItemsEndpoint(GetArtistAlbumsLiteRequest query)
{
// The route value is normalized to a Guid before it is substituted into the upstream URL, so that a crafted route value can never
// escape its URL segment, and an unparseable id is reported by the API as a missing artist id.
string artistId = Guid.TryParse(query.ArtistId, out Guid parsedArtistId) ? parsedArtistId.ToString() : Guid.Empty.ToString();
StringBuilder endpoint = new(ApiRoutes.Music.GET_ARTIST_ALBUMS_LITE.Replace("{libraryId}", query.LibraryId.ToString()).Replace("{artistId}", artistId));
List<string> parameters = [];
if (query.CurrentPage is not null)
parameters.Add($"currentPage={query.CurrentPage}");
if (query.PerPage is not null)
parameters.Add($"perPage={query.PerPage}");
if (parameters.Count > 0)
endpoint.Append('?').Append(string.Join('&', parameters));
return endpoint.ToString();
}
}
@@ -0,0 +1,38 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Albums;
using System;
using System.Diagnostics.CodeAnalysis;
#endregion
namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.GetArtistAlbums;
/// <summary>
/// Class used for providing a textual description for the <see cref="GetArtistAlbumsEndpoint"/> endpoint, for OpenAPI.
/// </summary>
[ExcludeFromCodeCoverage]
public class GetArtistAlbumsEndpointSummary : Summary<GetArtistAlbumsEndpoint, GetArtistAlbumsLiteRequest>
{
/// <summary>
/// Initializes a new instance of the <see cref="GetArtistAlbumsEndpointSummary"/> class.
/// </summary>
public GetArtistAlbumsEndpointSummary()
{
Summary = "Retrieves the lightweight details of the albums of a music artist.";
Description = "Retrieves the lightweight read models of the albums of the music artist identified by the route.";
RequestParam(r => r.ArtistId, "The unique identifier of the artist whose albums are retrieved. Required.");
RequestParam(r => r.LibraryId, "The Id of the media library the artist belongs to. Required.");
RequestParam(r => r.CurrentPage, "The page of results to retrieve. Optional.");
RequestParam(r => r.PerPage, "The maximum number of albums to retrieve per page. Optional.");
ExampleRequest = new GetArtistAlbumsLiteRequest(
ArtistId: Guid.NewGuid().ToString(),
LibraryId: Guid.NewGuid(),
CurrentPage: 1,
PerPage: 10
);
Response(200, "The lightweight details of the albums of the music artist are retrieved.");
}
}
@@ -0,0 +1,60 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using Lumina.Presentation.Web.Common.Api;
using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Albums;
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.Library.AudioLibrary.MusicLibrary.Albums.GetMusicAlbum;
/// <summary>
/// API endpoint for the <c>/{culture}/library/audio-library/music-library/artists/{artistId}/albums/{albumId}/api-get-album</c> route.
/// </summary>
public class GetMusicAlbumEndpoint : BaseEndpoint<GetMusicAlbumViewRequest, IResult>
{
private readonly IApiHttpClient _apiHttpClient;
/// <summary>
/// Initializes a new instance of the <see cref="GetMusicAlbumEndpoint"/> class.
/// </summary>
/// <param name="apiHttpClient">Injected service for interactions with the API.</param>
public GetMusicAlbumEndpoint(IApiHttpClient apiHttpClient)
{
_apiHttpClient = apiHttpClient;
}
/// <summary>
/// Configures the endpoint.
/// </summary>
public override void Configure()
{
base.Configure();
Verbs(Http.GET);
Routes(WebRoutes.Music.GET_ALBUM);
DontAutoTag();
Options(options => options.WithTags("Music"));
}
/// <summary>
/// Retrieves the full details of the music album identified by <paramref name="request"/>.
/// </summary>
/// <param name="request">The request containing the Id of the album to retrieve.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
public override async Task<IResult> ExecuteAsync(GetMusicAlbumViewRequest request, CancellationToken cancellationToken)
{
// The route values are normalized to Guids before they are substituted into the upstream URL, so that a crafted route value can never
// escape its URL segment, and an unparseable id is reported by the API as a missing album id.
request = request with { ArtistId = Guid.TryParse(request.ArtistId, out Guid artistId) ? artistId.ToString() : Guid.Empty.ToString() };
request = request with { AlbumId = Guid.TryParse(request.AlbumId, out Guid albumId) ? albumId.ToString() : Guid.Empty.ToString() };
MusicAlbumDto album = await _apiHttpClient.GetAsync<MusicAlbumDto>(ApiRoutes.Music.GET_ALBUM.Replace("{libraryId}", request.LibraryId.ToString()).Replace("{artistId}", request.ArtistId).Replace("{albumId}", request.AlbumId), cancellationToken).ConfigureAwait(false);
return JsonSuccess(album);
}
}
@@ -0,0 +1,29 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Albums;
using System.Diagnostics.CodeAnalysis;
#endregion
namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.GetMusicAlbum;
/// <summary>
/// Class used for providing a textual description for the <see cref="GetMusicAlbumEndpoint"/> endpoint, for OpenAPI.
/// </summary>
[ExcludeFromCodeCoverage]
public class GetMusicAlbumEndpointSummary : Summary<GetMusicAlbumEndpoint, GetMusicAlbumViewRequest>
{
/// <summary>
/// Initializes a new instance of the <see cref="GetMusicAlbumEndpointSummary"/> class.
/// </summary>
public GetMusicAlbumEndpointSummary()
{
Summary = "Retrieves the full details of a music album.";
Description = "Retrieves the full details of the music album identified by the route.";
RequestParam(r => r.ArtistId, "The unique identifier of the artist the album belongs to. Required.");
RequestParam(r => r.AlbumId, "The unique identifier of the album to retrieve. Required.");
RequestParam(r => r.LibraryId, "The unique identifier of the media library the album belongs to. Required.");
Response(200, "The full details of the music album are retrieved.");
}
}
@@ -0,0 +1,67 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using Lumina.Presentation.Web.Common.Api;
using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Albums;
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.Library.AudioLibrary.MusicLibrary.Albums.SaveMusicAlbum;
/// <summary>
/// API endpoint for the <c>/{culture}/library/audio-library/music-library/artists/{artistId}/albums/{albumId}/api-save-album</c> route.
/// </summary>
public class SaveMusicAlbumEndpoint : BaseEndpoint<UpdateMusicAlbumRequest, IResult>
{
private readonly IApiHttpClient _apiHttpClient;
/// <summary>
/// Initializes a new instance of the <see cref="SaveMusicAlbumEndpoint"/> class.
/// </summary>
/// <param name="apiHttpClient">Injected service for interactions with the API.</param>
public SaveMusicAlbumEndpoint(IApiHttpClient apiHttpClient)
{
_apiHttpClient = apiHttpClient;
}
/// <summary>
/// Configures the endpoint.
/// </summary>
public override void Configure()
{
base.Configure();
Verbs(Http.PUT);
Routes(WebRoutes.Music.SAVE_ALBUM);
DontAutoTag();
Options(options => options.WithTags("Music"));
EnableAntiforgery();
}
/// <summary>
/// Updates the music album described by <paramref name="request"/>.
/// </summary>
/// <param name="request">The request containing the edited details of the album.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
public override async Task<IResult> ExecuteAsync(UpdateMusicAlbumRequest request, CancellationToken cancellationToken)
{
// The album is identified by the {artistId} and {albumId} route values, not by any id posted in the body, so that a mismatched id can
// never redirect the update to another album; all ids are normalized to Guids before they are 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 id.
string routeArtistId = HttpContext.Request.RouteValues["artistId"]?.ToString() ?? string.Empty;
string artistId = Guid.TryParse(routeArtistId, out Guid parsedArtistId) ? parsedArtistId.ToString() : Guid.Empty.ToString();
string routeAlbumId = HttpContext.Request.RouteValues["albumId"]?.ToString() ?? string.Empty;
string albumId = Guid.TryParse(routeAlbumId, out Guid parsedAlbumId) ? parsedAlbumId.ToString() : Guid.Empty.ToString();
string queryLibraryId = HttpContext.Request.Query["libraryId"].ToString();
string libraryId = Guid.TryParse(queryLibraryId, out Guid parsedLibraryId) ? parsedLibraryId.ToString() : Guid.Empty.ToString();
MusicAlbumDto album = await _apiHttpClient.PutAsync<MusicAlbumDto, UpdateMusicAlbumRequest>(
ApiRoutes.Music.UPDATE_ALBUM.Replace("{libraryId}", libraryId).Replace("{artistId}", artistId).Replace("{albumId}", albumId), request, cancellationToken).ConfigureAwait(false);
return JsonSuccess(album);
}
}
@@ -0,0 +1,25 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Albums;
using System.Diagnostics.CodeAnalysis;
#endregion
namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.SaveMusicAlbum;
/// <summary>
/// Class used for providing a textual description for the <see cref="SaveMusicAlbumEndpoint"/> endpoint, for OpenAPI.
/// </summary>
[ExcludeFromCodeCoverage]
public class SaveMusicAlbumEndpointSummary : Summary<SaveMusicAlbumEndpoint, UpdateMusicAlbumRequest>
{
/// <summary>
/// Initializes a new instance of the <see cref="SaveMusicAlbumEndpointSummary"/> class.
/// </summary>
public SaveMusicAlbumEndpointSummary()
{
Summary = "Updates a music album.";
Description = "Updates the music album identified by the route, together with the tracks of the album.";
Response(200, "The music album was updated.");
}
}
@@ -0,0 +1,86 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using Lumina.Presentation.Web.Common.Api;
using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
using Lumina.Presentation.Web.Common.Routes;
using Lumina.Presentation.Web.Core.Endpoints.Common;
using Microsoft.AspNetCore.Http;
using System;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
#endregion
namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.UpdateAlbumCover;
/// <summary>
/// API endpoint for the <c>/{culture}/library/audio-library/music-library/artists/{artistId}/albums/{albumId}/api-update-cover</c> route.
/// </summary>
public class UpdateAlbumCoverEndpoint : BaseEndpoint<EmptyRequest, IResult>
{
private readonly IApiHttpClient _apiHttpClient;
/// <summary>
/// Initializes a new instance of the <see cref="UpdateAlbumCoverEndpoint"/> class.
/// </summary>
/// <param name="apiHttpClient">Injected service for interactions with the API.</param>
public UpdateAlbumCoverEndpoint(IApiHttpClient apiHttpClient)
{
_apiHttpClient = apiHttpClient;
}
/// <summary>
/// Configures the endpoint.
/// </summary>
public override void Configure()
{
base.Configure();
Verbs(Http.PUT);
Routes(WebRoutes.Music.UPDATE_ALBUM_COVER);
DontAutoTag();
Options(options => options.WithTags("Music"));
EnableAntiforgery();
}
/// <summary>
/// Updates the cover image of the album with the image uploaded in the multipart form of the request.
/// </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 endpoint takes no typed request, because its body is a multipart file, so the album id is read from the {albumId} route value and the
// owning library from the {libraryId} query string; all the ids are normalized to Guids before they are 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 id. A missing file is
// forwarded as a multipart form without any file, so that the upstream API reports it with its own validation error.
Guid artistId = Guid.TryParse(HttpContext.Request.RouteValues["artistId"]?.ToString(), out Guid parsedArtistId) ? parsedArtistId : Guid.Empty;
Guid albumId = Guid.TryParse(HttpContext.Request.RouteValues["albumId"]?.ToString(), out Guid parsedAlbumId) ? parsedAlbumId : Guid.Empty;
string libraryId = Guid.TryParse(HttpContext.Request.Query["libraryId"].ToString(), out Guid parsedLibraryId) ? parsedLibraryId.ToString() : Guid.Empty.ToString();
IFormFile? cover = null;
if (HttpContext.Request.HasFormContentType)
{
try
{
cover = HttpContext.Request.Form.Files.Count > 0 ? HttpContext.Request.Form.Files[0] : null;
}
catch (InvalidDataException)
{
cover = null;
}
}
// The cover stream must stay open while the file is streamed to the API, and is disposed when the request completes.
Stream? coverStream = cover?.OpenReadStream();
try
{
UpdateMusicCoverDto response = await _apiHttpClient.PutMultipartAsync<UpdateMusicCoverDto>(
ApiRoutes.Music.UPDATE_ALBUM_COVER.Replace("{libraryId}", libraryId).Replace("{artistId}", artistId.ToString()).Replace("{albumId}", albumId.ToString()), coverStream, cover?.FileName, "cover", cancellationToken).ConfigureAwait(false);
return JsonSuccess(response.CoverPath);
}
finally
{
coverStream?.Dispose();
}
}
}
@@ -0,0 +1,25 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using Lumina.Presentation.Web.Common.DTO.Common;
using System.Diagnostics.CodeAnalysis;
#endregion
namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.UpdateAlbumCover;
/// <summary>
/// Class used for providing a textual description for the <see cref="UpdateAlbumCoverEndpoint"/> endpoint, for OpenAPI.
/// </summary>
[ExcludeFromCodeCoverage]
public class UpdateAlbumCoverEndpointSummary : Summary<UpdateAlbumCoverEndpoint, EmptyRequest>
{
/// <summary>
/// Initializes a new instance of the <see cref="UpdateAlbumCoverEndpointSummary"/> class.
/// </summary>
public UpdateAlbumCoverEndpointSummary()
{
Summary = "Updates the cover image of an album.";
Description = "Updates the cover image of the album identified by the route, with the image uploaded in the multipart form of the request.";
Response(200, "The relative path of the stored cover image is returned.", example: new SuccessResponse<string>(true, default));
}
}
@@ -0,0 +1,61 @@
#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.Library.AudioLibrary.MusicLibrary.Artists.DeleteMusicArtist;
/// <summary>
/// API endpoint for the <c>/{culture}/library/audio-library/music-library/artists/{artistId}/api-delete-artist</c> route.
/// </summary>
public class DeleteMusicArtistEndpoint : BaseEndpoint<EmptyRequest, IResult>
{
private readonly IApiHttpClient _apiHttpClient;
/// <summary>
/// Initializes a new instance of the <see cref="DeleteMusicArtistEndpoint"/> class.
/// </summary>
/// <param name="apiHttpClient">Injected service for interactions with the API.</param>
public DeleteMusicArtistEndpoint(IApiHttpClient apiHttpClient)
{
_apiHttpClient = apiHttpClient;
}
/// <summary>
/// Configures the endpoint.
/// </summary>
public override void Configure()
{
base.Configure();
Verbs(Http.DELETE);
Routes(WebRoutes.Music.DELETE_ARTIST);
DontAutoTag();
Options(options => options.WithTags("Music"));
EnableAntiforgery();
}
/// <summary>
/// Deletes the music artist identified by the route.
/// </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 artist is identified by the {artistId} route value; both ids are normalized to Guids before they are 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 id.
string routeArtistId = HttpContext.Request.RouteValues["artistId"]?.ToString() ?? string.Empty;
string artistId = Guid.TryParse(routeArtistId, out Guid parsedArtistId) ? parsedArtistId.ToString() : Guid.Empty.ToString();
string queryLibraryId = HttpContext.Request.Query["libraryId"].ToString();
string libraryId = Guid.TryParse(queryLibraryId, out Guid parsedLibraryId) ? parsedLibraryId.ToString() : Guid.Empty.ToString();
await _apiHttpClient.DeleteAsync(ApiRoutes.Music.DELETE_ARTIST.Replace("{libraryId}", libraryId).Replace("{artistId}", artistId), cancellationToken).ConfigureAwait(false);
return JsonSuccess();
}
}
@@ -0,0 +1,24 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using System.Diagnostics.CodeAnalysis;
#endregion
namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.DeleteMusicArtist;
/// <summary>
/// Class used for providing a textual description for the <see cref="DeleteMusicArtistEndpoint"/> endpoint, for OpenAPI.
/// </summary>
[ExcludeFromCodeCoverage]
public class DeleteMusicArtistEndpointSummary : Summary<DeleteMusicArtistEndpoint>
{
/// <summary>
/// Initializes a new instance of the <see cref="DeleteMusicArtistEndpointSummary"/> class.
/// </summary>
public DeleteMusicArtistEndpointSummary()
{
Summary = "Deletes a music artist.";
Description = "Deletes the music artist identified by the route, together with its albums and tracks.";
Response(200, "The music artist was deleted.");
}
}
@@ -0,0 +1,132 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using Lumina.Presentation.Web.Common.Api;
using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
using Lumina.Presentation.Web.Common.DTO.Themes;
using Lumina.Presentation.Web.Common.Primitives;
using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists;
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.Library.AudioLibrary.MusicLibrary.Artists.EditMusicArtist;
/// <summary>
/// API endpoint for the <c>/{culture}/library/audio-library/music-library/artists/{artistId}</c> route.
/// </summary>
public class EditMusicArtistViewEndpoint : BaseEndpoint<GetMusicArtistViewRequest, 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.Library.AudioLibrary.MusicLibrary.Artists.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 = "library/audio-library/music-library/artists/item";
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="EditMusicArtistViewEndpoint"/> 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 EditMusicArtistViewEndpoint(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.Music.ARTIST);
DontAutoTag();
Options(options => options.WithTags("Music"));
}
/// <summary>
/// Displays the music artist details and editing view, rendered by the active theme with a fallback to the Razor view.
/// </summary>
/// <param name="request">The request containing the Id of the artist to view.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
public override async Task<IResult> ExecuteAsync(GetMusicArtistViewRequest request, CancellationToken cancellationToken)
{
// The view needs the full details of the artist to show its current values, so they are fetched from the API up front; the route
// value is normalized to a Guid before it is substituted into the upstream URL, so that a crafted route value can never escape
// its URL segment, and an unparseable id is reported by the API as a missing artist id.
request = request with { ArtistId = Guid.TryParse(request.ArtistId, out Guid artistId) ? artistId.ToString() : Guid.Empty.ToString() };
MusicArtistDto artist = await _apiHttpClient.GetAsync<MusicArtistDto>(ApiRoutes.Music.GET_ARTIST.Replace("{libraryId}", request.LibraryId.ToString()).Replace("{artistId}", request.ArtistId), cancellationToken).ConfigureAwait(false);
string title = artist.Metadata?.Name ?? string.Empty;
// The themed view is a regular page that submits its own requests, so a fresh anti-forgery token must be issued for it.
AntiforgeryTokenSet antiforgeryTokens = _antiforgery.GetAndStoreTokens(HttpContext);
ThemePageDto pageModel = new()
{
PageKey = VIEW_PAGE_KEY,
Title = title,
Description = string.Empty,
PageData = new Dictionary<string, object?>
{
["artistId"] = artist.Id.ToString(),
["libraryId"] = artist.LibraryId.ToString(),
["antiforgeryToken"] = antiforgeryTokens.RequestToken,
["saveUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Music.SAVE_ARTIST, new { artistId = default(Guid) }) ?? string.Empty,
["deleteUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Music.DELETE_ARTIST, new { artistId = default(Guid) }) ?? string.Empty,
["albumsUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Music.GET_ARTIST_ALBUMS, new { artistId = default(Guid) }) ?? string.Empty,
["albumUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Music.ALBUM, new { artistId = default(Guid), albumId = default(Guid) }) ?? string.Empty,
["deleteAlbumUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Music.DELETE_ALBUM, new { artistId = default(Guid), albumId = default(Guid) }) ?? string.Empty,
["coverUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Music.UPDATE_ARTIST_COVER, new { artistId = default(Guid) }) ?? string.Empty,
["backUrl"] = (_urlService.GetAbsoluteUrl(WebRoutes.Music.ARTISTS_INDEX) ?? string.Empty) + "?libraryId=" + artist.LibraryId,
["artistJson"] = JsonSerializer.Serialize(artist, s_camelCaseJsonOptions),
["strings"] = ThemePageDataFactory.CreateLocalizedStrings(_localizer),
["stringsJson"] = JsonSerializer.Serialize(ThemePageDataFactory.CreateLocalizedStrings(_localizer), s_camelCaseJsonOptions)
}
};
Result<ThemePageRenderResultDto> sectionResult = await _themePageRenderer.RenderAsync(pageModel, requestedThemeId: null, cancellationToken).ConfigureAwait(false);
if (sectionResult.IsFailure)
{
Dictionary<string, object?> viewData = new()
{
["Title"] = title
};
return View("/Core/Views/Library/AudioLibrary/MusicLibrary/Artists/Item.cshtml", artist, viewData);
}
return View(
"/Core/Views/Shared/_ThemedView.cshtml",
new ThemeViewDto(sectionResult.Value.Content, sectionResult.Value.Script),
new Dictionary<string, object?> { ["Title"] = title });
}
}
@@ -0,0 +1,29 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists;
using System;
using System.Diagnostics.CodeAnalysis;
#endregion
namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.EditMusicArtist;
/// <summary>
/// Class used for providing a textual description for the <see cref="EditMusicArtistViewEndpoint"/> endpoint, for OpenAPI.
/// </summary>
[ExcludeFromCodeCoverage]
public class EditMusicArtistViewEndpointSummary : Summary<EditMusicArtistViewEndpoint, GetMusicArtistViewRequest>
{
/// <summary>
/// Initializes a new instance of the <see cref="EditMusicArtistViewEndpointSummary"/> class.
/// </summary>
public EditMusicArtistViewEndpointSummary()
{
Summary = "Renders the music artist details and editing view.";
Description = "Renders the view for displaying and editing the music artist identified by the route.";
RequestParam(r => r.ArtistId, "The unique identifier of the artist to display. Required.");
RequestParam(r => r.LibraryId, "The unique identifier of the media library the artist belongs to. Required.");
Response(200, "The view for displaying and editing the music artist is rendered.");
}
}
@@ -0,0 +1,59 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using Lumina.Presentation.Web.Common.Api;
using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists;
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.Library.AudioLibrary.MusicLibrary.Artists.GetMusicArtist;
/// <summary>
/// API endpoint for the <c>/{culture}/library/audio-library/music-library/artists/{artistId}/api-get-artist</c> route.
/// </summary>
public class GetMusicArtistEndpoint : BaseEndpoint<GetMusicArtistViewRequest, IResult>
{
private readonly IApiHttpClient _apiHttpClient;
/// <summary>
/// Initializes a new instance of the <see cref="GetMusicArtistEndpoint"/> class.
/// </summary>
/// <param name="apiHttpClient">Injected service for interactions with the API.</param>
public GetMusicArtistEndpoint(IApiHttpClient apiHttpClient)
{
_apiHttpClient = apiHttpClient;
}
/// <summary>
/// Configures the endpoint.
/// </summary>
public override void Configure()
{
base.Configure();
Verbs(Http.GET);
Routes(WebRoutes.Music.GET_ARTIST);
DontAutoTag();
Options(options => options.WithTags("Music"));
}
/// <summary>
/// Retrieves the full details of the music artist identified by <paramref name="request"/>.
/// </summary>
/// <param name="request">The request containing the Id of the artist to retrieve.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
public override async Task<IResult> ExecuteAsync(GetMusicArtistViewRequest request, CancellationToken cancellationToken)
{
// The route value is normalized to a Guid before it is substituted into the upstream URL, so that a crafted route value can never
// escape its URL segment, and an unparseable id is reported by the API as a missing artist id.
request = request with { ArtistId = Guid.TryParse(request.ArtistId, out Guid artistId) ? artistId.ToString() : Guid.Empty.ToString() };
MusicArtistDto artist = await _apiHttpClient.GetAsync<MusicArtistDto>(ApiRoutes.Music.GET_ARTIST.Replace("{libraryId}", request.LibraryId.ToString()).Replace("{artistId}", request.ArtistId), cancellationToken).ConfigureAwait(false);
return JsonSuccess(artist);
}
}
@@ -0,0 +1,29 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists;
using System;
using System.Diagnostics.CodeAnalysis;
#endregion
namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.GetMusicArtist;
/// <summary>
/// Class used for providing a textual description for the <see cref="GetMusicArtistEndpoint"/> endpoint, for OpenAPI.
/// </summary>
[ExcludeFromCodeCoverage]
public class GetMusicArtistEndpointSummary : Summary<GetMusicArtistEndpoint, GetMusicArtistViewRequest>
{
/// <summary>
/// Initializes a new instance of the <see cref="GetMusicArtistEndpointSummary"/> class.
/// </summary>
public GetMusicArtistEndpointSummary()
{
Summary = "Retrieves the full details of a music artist.";
Description = "Retrieves the full details of the music artist identified by the route.";
RequestParam(r => r.ArtistId, "The unique identifier of the artist to retrieve. Required.");
RequestParam(r => r.LibraryId, "The unique identifier of the media library the artist belongs to. Required.");
Response(200, "The full details of the music artist are retrieved.");
}
}
@@ -0,0 +1,83 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using Lumina.Presentation.Web.Common.Api;
using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists;
using Lumina.Presentation.Web.Common.Routes;
using Lumina.Presentation.Web.Core.Endpoints.Common;
using Microsoft.AspNetCore.Http;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
#endregion
namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.GetMusicArtists;
/// <summary>
/// API endpoint for the <c>/{culture}/library/audio-library/music-library/artists/api-get-artists</c> route.
/// </summary>
public class GetMusicArtistsEndpoint : BaseEndpoint<GetMusicArtistsLiteRequest, IResult>
{
private readonly IApiHttpClient _apiHttpClient;
/// <summary>
/// Initializes a new instance of the <see cref="GetMusicArtistsEndpoint"/> class.
/// </summary>
/// <param name="apiHttpClient">Injected service for interactions with the API.</param>
public GetMusicArtistsEndpoint(IApiHttpClient apiHttpClient)
{
_apiHttpClient = apiHttpClient;
}
/// <summary>
/// Configures the endpoint.
/// </summary>
public override void Configure()
{
base.Configure();
Verbs(Http.GET);
Routes(WebRoutes.Music.GET_ARTISTS);
DontAutoTag();
Options(options => options.WithTags("Music"));
}
/// <summary>
/// Retrieves the lightweight details of the music artists of a media library.
/// </summary>
/// <param name="request">The request containing the parameters used to retrieve the artists.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
public override async Task<IResult> ExecuteAsync(GetMusicArtistsLiteRequest request, CancellationToken cancellationToken)
{
PaginatedMusicArtistLiteDto response = await _apiHttpClient.GetAsync<PaginatedMusicArtistLiteDto>(BuildItemsEndpoint(request), cancellationToken).ConfigureAwait(false);
return JsonSuccess(response);
}
/// <summary>
/// Builds the API endpoint used to retrieve the lightweight details of the music artists of a media library.
/// </summary>
/// <param name="query">The request containing the parameters used to retrieve the artists.</param>
/// <returns>The API endpoint to which the retrieval request is sent.</returns>
private static string BuildItemsEndpoint(GetMusicArtistsLiteRequest query)
{
StringBuilder endpoint = new(ApiRoutes.Music.GET_ARTISTS_LITE.Replace("{libraryId}", query.LibraryId.ToString()));
List<string> parameters = [];
if (query.CurrentPage is not null)
parameters.Add($"currentPage={query.CurrentPage}");
if (query.PerPage is not null)
parameters.Add($"perPage={query.PerPage}");
if (!string.IsNullOrWhiteSpace(query.SearchTerm))
parameters.Add($"searchTerm={Uri.EscapeDataString(query.SearchTerm)}");
if (!string.IsNullOrWhiteSpace(query.FilterAlphaKey))
parameters.Add($"filterAlphaKey={Uri.EscapeDataString(query.FilterAlphaKey)}");
parameters.Add($"shouldIgnoreThePrefixForAlphaPicker={query.ShouldIgnoreThePrefixForAlphaPicker}");
if (!string.IsNullOrWhiteSpace(query.SortBy))
parameters.Add($"sortBy={Uri.EscapeDataString(query.SortBy)}");
if (query.SortOrder is not null)
parameters.Add($"sortOrder={query.SortOrder}");
if (parameters.Count > 0)
endpoint.Append('?').Append(string.Join('&', parameters));
return endpoint.ToString();
}
}
@@ -0,0 +1,46 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists;
using System;
using System.Diagnostics.CodeAnalysis;
#endregion
namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.GetMusicArtists;
/// <summary>
/// Class used for providing a textual description for the <see cref="GetMusicArtistsEndpoint"/> endpoint, for OpenAPI.
/// </summary>
[ExcludeFromCodeCoverage]
public class GetMusicArtistsEndpointSummary : Summary<GetMusicArtistsEndpoint, GetMusicArtistsLiteRequest>
{
/// <summary>
/// Initializes a new instance of the <see cref="GetMusicArtistsEndpointSummary"/> class.
/// </summary>
public GetMusicArtistsEndpointSummary()
{
Summary = "Retrieves the lightweight details of the music artists of a media library.";
Description = "Retrieves the lightweight read models of the music artists of the media library identified by the route.";
RequestParam(r => r.LibraryId, "The Id of the media library whose artists are retrieved. Required.");
RequestParam(r => r.CurrentPage, "The page of results to retrieve. Optional.");
RequestParam(r => r.PerPage, "The maximum number of artists to retrieve per page. Optional.");
RequestParam(r => r.SearchTerm, "The search term used to filter the artists by name. Optional.");
RequestParam(r => r.FilterAlphaKey, "The alpha key used to filter the results by the first character of their name, for the alpha picker. Optional.");
RequestParam(r => r.ShouldIgnoreThePrefixForAlphaPicker, "Whether the leading \"The \" prefix of a name is ignored when computing the alpha key, or not. Optional.");
RequestParam(r => r.SortBy, "The name of the field by which to sort the results. Optional.");
RequestParam(r => r.SortOrder, "The direction in which to sort the results. Optional.");
ExampleRequest = new GetMusicArtistsLiteRequest(
LibraryId: Guid.NewGuid(),
CurrentPage: 1,
PerPage: 10,
SearchTerm: "queen",
FilterAlphaKey: null,
ShouldIgnoreThePrefixForAlphaPicker: false,
SortBy: null,
SortOrder: null
);
Response(200, "The lightweight details of the music artists of the media library are retrieved.");
}
}
@@ -0,0 +1,112 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using Lumina.Presentation.Web.Common.Api;
using Lumina.Presentation.Web.Common.DTO.Libraries;
using Lumina.Presentation.Web.Common.DTO.Themes;
using Lumina.Presentation.Web.Common.Primitives;
using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists;
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.Builder;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Localization;
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
#endregion
namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.Index;
/// <summary>
/// API endpoint for the <c>/{culture}/library/audio-library/music-library/artists</c> route.
/// </summary>
public class MusicArtistsIndexViewEndpoint : BaseEndpoint<GetMusicArtistsViewRequest, IResult>
{
// The resource base name deliberately excludes the "Core.Resources" segment: the localization factory re-roots it
// with the configured ResourcesPath, so "Lumina.Presentation.Web.Views.X" resolves to the embedded
// "Lumina.Presentation.Web.Core.Resources.Views.X" resource; including "Core" here would insert it twice.
private const string VIEW_RESOURCE_BASE_NAME = "Lumina.Presentation.Web.Views.Library.AudioLibrary.MusicLibrary.Artists.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 = "library/audio-library/music-library/artists/index";
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="MusicArtistsIndexViewEndpoint"/> 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 MusicArtistsIndexViewEndpoint(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.Music.ARTISTS_INDEX);
DontAutoTag();
Options(options => options.WithTags("Music"));
}
/// <summary>
/// Displays the music artists browsing view, rendered by the active theme with a fallback to the Razor view.
/// </summary>
/// <param name="request">The request containing the Id of the media library whose artists are browsed.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
public override async Task<IResult> ExecuteAsync(GetMusicArtistsViewRequest request, CancellationToken cancellationToken)
{
if (request.LibraryId is null)
return Results.Redirect(_urlService.GetAbsoluteUrl(WebRoutes.Home.INDEX_CULTURED)!);
LibraryDto library = await _apiHttpClient.GetAsync<LibraryDto>(ApiRoutes.Libraries.GET_LIBRARY_BY_ID.Replace("{id}", request.LibraryId.Value.ToString()), cancellationToken).ConfigureAwait(false);
// The page exposes delete actions, 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 = library.Title ?? string.Empty,
Description = string.Empty,
PageData = new Dictionary<string, object?>
{
["libraryId"] = library.Id?.ToString() ?? request.LibraryId.Value.ToString(),
["antiforgeryToken"] = antiforgeryTokens.RequestToken,
["itemsUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Music.GET_ARTISTS) ?? string.Empty,
["settingsUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Settings.GET_USER_SETTINGS) ?? string.Empty,
["artistUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Music.ARTIST, new { artistId = default(Guid) }) ?? string.Empty,
["deleteUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Music.DELETE_ARTIST, new { artistId = default(Guid) }) ?? string.Empty,
["strings"] = ThemePageDataFactory.CreateLocalizedStrings(_localizer)
}
};
Result<ThemePageRenderResultDto> sectionResult = await _themePageRenderer.RenderAsync(pageModel, requestedThemeId: null, cancellationToken).ConfigureAwait(false);
if (sectionResult.IsFailure)
return View("/Core/Views/Library/AudioLibrary/MusicLibrary/Artists/Index.cshtml", library);
return View(
"/Core/Views/Shared/_ThemedView.cshtml",
new ThemeViewDto(sectionResult.Value.Content, sectionResult.Value.Script),
new Dictionary<string, object?> { ["Title"] = pageModel.Title });
}
}
@@ -0,0 +1,32 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists;
using System;
using System.Diagnostics.CodeAnalysis;
#endregion
namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.Index;
/// <summary>
/// Class used for providing a textual description for the <see cref="MusicArtistsIndexViewEndpoint"/> endpoint, for OpenAPI.
/// </summary>
[ExcludeFromCodeCoverage]
public class MusicArtistsIndexViewEndpointSummary : Summary<MusicArtistsIndexViewEndpoint, GetMusicArtistsViewRequest>
{
/// <summary>
/// Initializes a new instance of the <see cref="MusicArtistsIndexViewEndpointSummary"/> class.
/// </summary>
public MusicArtistsIndexViewEndpointSummary()
{
Summary = "Renders the music artists browsing view.";
Description = "Renders the view for browsing the music artists of the media library identified by the query.";
RequestParam(r => r.LibraryId, "The unique identifier of the media library whose artists are browsed. Optional.");
ExampleRequest = new GetMusicArtistsViewRequest(
LibraryId: Guid.NewGuid()
);
Response(200, "The view for browsing the music artists of the media library is rendered.");
}
}
@@ -0,0 +1,65 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using Lumina.Presentation.Web.Common.Api;
using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists;
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.Library.AudioLibrary.MusicLibrary.Artists.SaveMusicArtist;
/// <summary>
/// API endpoint for the <c>/{culture}/library/audio-library/music-library/artists/{artistId}/api-save-artist</c> route.
/// </summary>
public class SaveMusicArtistEndpoint : BaseEndpoint<UpdateMusicArtistRequest, IResult>
{
private readonly IApiHttpClient _apiHttpClient;
/// <summary>
/// Initializes a new instance of the <see cref="SaveMusicArtistEndpoint"/> class.
/// </summary>
/// <param name="apiHttpClient">Injected service for interactions with the API.</param>
public SaveMusicArtistEndpoint(IApiHttpClient apiHttpClient)
{
_apiHttpClient = apiHttpClient;
}
/// <summary>
/// Configures the endpoint.
/// </summary>
public override void Configure()
{
base.Configure();
Verbs(Http.PUT);
Routes(WebRoutes.Music.SAVE_ARTIST);
DontAutoTag();
Options(options => options.WithTags("Music"));
EnableAntiforgery();
}
/// <summary>
/// Updates the music artist described by <paramref name="request"/>.
/// </summary>
/// <param name="request">The request containing the edited details of the artist.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
public override async Task<IResult> ExecuteAsync(UpdateMusicArtistRequest request, CancellationToken cancellationToken)
{
// The artist is identified by the {artistId} route value, not by any id posted in the body, so that a mismatched id can never redirect
// the update to another artist; both ids are normalized to Guids before they are 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 id.
string routeArtistId = HttpContext.Request.RouteValues["artistId"]?.ToString() ?? string.Empty;
string artistId = Guid.TryParse(routeArtistId, out Guid parsedArtistId) ? parsedArtistId.ToString() : Guid.Empty.ToString();
string queryLibraryId = HttpContext.Request.Query["libraryId"].ToString();
string libraryId = Guid.TryParse(queryLibraryId, out Guid parsedLibraryId) ? parsedLibraryId.ToString() : Guid.Empty.ToString();
MusicArtistDto artist = await _apiHttpClient.PutAsync<MusicArtistDto, UpdateMusicArtistRequest>(
ApiRoutes.Music.UPDATE_ARTIST.Replace("{libraryId}", libraryId).Replace("{artistId}", artistId), request, cancellationToken).ConfigureAwait(false);
return JsonSuccess(artist);
}
}
@@ -0,0 +1,25 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists;
using System.Diagnostics.CodeAnalysis;
#endregion
namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.SaveMusicArtist;
/// <summary>
/// Class used for providing a textual description for the <see cref="SaveMusicArtistEndpoint"/> endpoint, for OpenAPI.
/// </summary>
[ExcludeFromCodeCoverage]
public class SaveMusicArtistEndpointSummary : Summary<SaveMusicArtistEndpoint, UpdateMusicArtistRequest>
{
/// <summary>
/// Initializes a new instance of the <see cref="SaveMusicArtistEndpointSummary"/> class.
/// </summary>
public SaveMusicArtistEndpointSummary()
{
Summary = "Updates a music artist.";
Description = "Updates the music artist identified by the route, together with the albums of the artist and the tracks of those albums.";
Response(200, "The music artist was updated.");
}
}
@@ -0,0 +1,85 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using Lumina.Presentation.Web.Common.Api;
using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
using Lumina.Presentation.Web.Common.Routes;
using Lumina.Presentation.Web.Core.Endpoints.Common;
using Microsoft.AspNetCore.Http;
using System;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
#endregion
namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.UpdateArtistCover;
/// <summary>
/// API endpoint for the <c>/{culture}/library/audio-library/music-library/artists/{artistId}/api-update-cover</c> route.
/// </summary>
public class UpdateArtistCoverEndpoint : BaseEndpoint<EmptyRequest, IResult>
{
private readonly IApiHttpClient _apiHttpClient;
/// <summary>
/// Initializes a new instance of the <see cref="UpdateArtistCoverEndpoint"/> class.
/// </summary>
/// <param name="apiHttpClient">Injected service for interactions with the API.</param>
public UpdateArtistCoverEndpoint(IApiHttpClient apiHttpClient)
{
_apiHttpClient = apiHttpClient;
}
/// <summary>
/// Configures the endpoint.
/// </summary>
public override void Configure()
{
base.Configure();
Verbs(Http.PUT);
Routes(WebRoutes.Music.UPDATE_ARTIST_COVER);
DontAutoTag();
Options(options => options.WithTags("Music"));
EnableAntiforgery();
}
/// <summary>
/// Updates the cover image of the artist with the image uploaded in the multipart form of the request.
/// </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 endpoint takes no typed request, because its body is a multipart file, so the artist id is read from the {artistId} route value and the
// owning library from the {libraryId} query string; both are normalized to Guids before they are 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 id. A missing file is forwarded
// as a multipart form without any file, so that the upstream API reports it with its own validation error.
Guid artistId = Guid.TryParse(HttpContext.Request.RouteValues["artistId"]?.ToString(), out Guid parsedArtistId) ? parsedArtistId : Guid.Empty;
string libraryId = Guid.TryParse(HttpContext.Request.Query["libraryId"].ToString(), out Guid parsedLibraryId) ? parsedLibraryId.ToString() : Guid.Empty.ToString();
IFormFile? cover = null;
if (HttpContext.Request.HasFormContentType)
{
try
{
cover = HttpContext.Request.Form.Files.Count > 0 ? HttpContext.Request.Form.Files[0] : null;
}
catch (InvalidDataException)
{
cover = null;
}
}
// The cover stream must stay open while the file is streamed to the API, and is disposed when the request completes.
Stream? coverStream = cover?.OpenReadStream();
try
{
UpdateMusicCoverDto response = await _apiHttpClient.PutMultipartAsync<UpdateMusicCoverDto>(
ApiRoutes.Music.UPDATE_ARTIST_COVER.Replace("{libraryId}", libraryId).Replace("{artistId}", artistId.ToString()), coverStream, cover?.FileName, "cover", cancellationToken).ConfigureAwait(false);
return JsonSuccess(response.CoverPath);
}
finally
{
coverStream?.Dispose();
}
}
}
@@ -0,0 +1,25 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using Lumina.Presentation.Web.Common.DTO.Common;
using System.Diagnostics.CodeAnalysis;
#endregion
namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.UpdateArtistCover;
/// <summary>
/// Class used for providing a textual description for the <see cref="UpdateArtistCoverEndpoint"/> endpoint, for OpenAPI.
/// </summary>
[ExcludeFromCodeCoverage]
public class UpdateArtistCoverEndpointSummary : Summary<UpdateArtistCoverEndpoint, EmptyRequest>
{
/// <summary>
/// Initializes a new instance of the <see cref="UpdateArtistCoverEndpointSummary"/> class.
/// </summary>
public UpdateArtistCoverEndpointSummary()
{
Summary = "Updates the cover image of an artist.";
Description = "Updates the cover image of the artist identified by the route, with the image uploaded in the multipart form of the request.";
Response(200, "The relative path of the stored cover image is returned.", example: new SuccessResponse<string>(true, default));
}
}
@@ -0,0 +1,65 @@
#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.Library.AudioLibrary.MusicLibrary.Tracks.DeleteMusicTrack;
/// <summary>
/// API endpoint for the <c>/{culture}/library/audio-library/music-library/artists/{artistId}/albums/{albumId}/tracks/{trackId}/api-delete-track</c> route.
/// </summary>
public class DeleteMusicTrackEndpoint : BaseEndpoint<EmptyRequest, IResult>
{
private readonly IApiHttpClient _apiHttpClient;
/// <summary>
/// Initializes a new instance of the <see cref="DeleteMusicTrackEndpoint"/> class.
/// </summary>
/// <param name="apiHttpClient">Injected service for interactions with the API.</param>
public DeleteMusicTrackEndpoint(IApiHttpClient apiHttpClient)
{
_apiHttpClient = apiHttpClient;
}
/// <summary>
/// Configures the endpoint.
/// </summary>
public override void Configure()
{
base.Configure();
Verbs(Http.DELETE);
Routes(WebRoutes.Music.DELETE_TRACK);
DontAutoTag();
Options(options => options.WithTags("Music"));
EnableAntiforgery();
}
/// <summary>
/// Deletes the music track identified by the route.
/// </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 track is identified by the {artistId}, {albumId} and {trackId} route values; all ids are normalized to Guids before they are 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 id.
string routeArtistId = HttpContext.Request.RouteValues["artistId"]?.ToString() ?? string.Empty;
string artistId = Guid.TryParse(routeArtistId, out Guid parsedArtistId) ? parsedArtistId.ToString() : Guid.Empty.ToString();
string routeAlbumId = HttpContext.Request.RouteValues["albumId"]?.ToString() ?? string.Empty;
string albumId = Guid.TryParse(routeAlbumId, out Guid parsedAlbumId) ? parsedAlbumId.ToString() : Guid.Empty.ToString();
string routeTrackId = HttpContext.Request.RouteValues["trackId"]?.ToString() ?? string.Empty;
string trackId = Guid.TryParse(routeTrackId, out Guid parsedTrackId) ? parsedTrackId.ToString() : Guid.Empty.ToString();
string queryLibraryId = HttpContext.Request.Query["libraryId"].ToString();
string libraryId = Guid.TryParse(queryLibraryId, out Guid parsedLibraryId) ? parsedLibraryId.ToString() : Guid.Empty.ToString();
await _apiHttpClient.DeleteAsync(ApiRoutes.Music.DELETE_TRACK.Replace("{libraryId}", libraryId).Replace("{artistId}", artistId).Replace("{albumId}", albumId).Replace("{trackId}", trackId), cancellationToken).ConfigureAwait(false);
return JsonSuccess();
}
}
@@ -0,0 +1,24 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using System.Diagnostics.CodeAnalysis;
#endregion
namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Tracks.DeleteMusicTrack;
/// <summary>
/// Class used for providing a textual description for the <see cref="DeleteMusicTrackEndpoint"/> endpoint, for OpenAPI.
/// </summary>
[ExcludeFromCodeCoverage]
public class DeleteMusicTrackEndpointSummary : Summary<DeleteMusicTrackEndpoint>
{
/// <summary>
/// Initializes a new instance of the <see cref="DeleteMusicTrackEndpointSummary"/> class.
/// </summary>
public DeleteMusicTrackEndpointSummary()
{
Summary = "Deletes a music track.";
Description = "Deletes the music track identified by the route, together with its metadata.";
Response(200, "The music track was deleted.");
}
}
@@ -0,0 +1,140 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using Lumina.Presentation.Web.Common.Api;
using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
using Lumina.Presentation.Web.Common.DTO.Themes;
using Lumina.Presentation.Web.Common.Primitives;
using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Tracks;
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.Library.AudioLibrary.MusicLibrary.Tracks.EditMusicTrack;
/// <summary>
/// API endpoint for the <c>/{culture}/library/audio-library/music-library/artists/{artistId}/albums/{albumId}/tracks/{trackId}</c> route.
/// </summary>
public class EditMusicTrackViewEndpoint : BaseEndpoint<GetMusicTrackViewRequest, 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.Library.AudioLibrary.MusicLibrary.Tracks.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 = "library/audio-library/music-library/tracks/item";
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="EditMusicTrackViewEndpoint"/> 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 EditMusicTrackViewEndpoint(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.Music.TRACK);
DontAutoTag();
Options(options => options.WithTags("Music"));
}
/// <summary>
/// Displays the music track details and editing view, rendered by the active theme with a fallback to the Razor view.
/// </summary>
/// <param name="request">The request containing the Ids of the artist, album, track and media library to view.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
public override async Task<IResult> ExecuteAsync(GetMusicTrackViewRequest request, CancellationToken cancellationToken)
{
// The view needs the full details of the track to show its current values, so they are fetched from the API up front; the route
// values are normalized to Guids before they are substituted into the upstream URL, so that a crafted route value can never escape
// its URL segment, and an unparseable id is reported by the API as a missing id.
string normalizedArtistId = Guid.TryParse(request.ArtistId, out Guid parsedArtistId) ? parsedArtistId.ToString() : Guid.Empty.ToString();
string normalizedAlbumId = Guid.TryParse(request.AlbumId, out Guid parsedAlbumId) ? parsedAlbumId.ToString() : Guid.Empty.ToString();
string normalizedTrackId = Guid.TryParse(request.TrackId, out Guid parsedTrackId) ? parsedTrackId.ToString() : Guid.Empty.ToString();
MusicTrackDto track = await _apiHttpClient.GetAsync<MusicTrackDto>(
ApiRoutes.Music.GET_TRACK.Replace("{libraryId}", request.LibraryId.ToString()).Replace("{artistId}", normalizedArtistId).Replace("{albumId}", normalizedAlbumId).Replace("{trackId}", normalizedTrackId), cancellationToken).ConfigureAwait(false);
string title = track.Metadata?.Title ?? string.Empty;
// The cover shown on the left of the track page is the cover of the album that holds the track, so the album is fetched alongside the track.
MusicAlbumDto album = await _apiHttpClient.GetAsync<MusicAlbumDto>(
ApiRoutes.Music.GET_ALBUM.Replace("{libraryId}", request.LibraryId.ToString()).Replace("{artistId}", normalizedArtistId).Replace("{albumId}", normalizedAlbumId), cancellationToken).ConfigureAwait(false);
// The themed view is a regular page that submits its own requests, so a fresh anti-forgery token must be issued for it.
AntiforgeryTokenSet antiforgeryTokens = _antiforgery.GetAndStoreTokens(HttpContext);
ThemePageDto pageModel = new()
{
PageKey = VIEW_PAGE_KEY,
Title = title,
Description = string.Empty,
PageData = new Dictionary<string, object?>
{
["artistId"] = normalizedArtistId,
["albumId"] = normalizedAlbumId,
["trackId"] = track.Id.ToString(),
["libraryId"] = track.LibraryId.ToString(),
["antiforgeryToken"] = antiforgeryTokens.RequestToken,
["saveUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Music.SAVE_TRACK, new { artistId = default(Guid), albumId = default(Guid), trackId = default(Guid) }) ?? string.Empty,
["deleteUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Music.DELETE_TRACK, new { artistId = default(Guid), albumId = default(Guid), trackId = default(Guid) }) ?? string.Empty,
["backUrl"] = (_urlService.GetAbsoluteUrl(WebRoutes.Music.ALBUM, new { artistId = normalizedArtistId, albumId = track.AlbumId }) ?? string.Empty) + "?libraryId=" + track.LibraryId,
["albumCoverPath"] = album.CoverPath ?? string.Empty,
["trackJson"] = JsonSerializer.Serialize(track, s_camelCaseJsonOptions),
["strings"] = ThemePageDataFactory.CreateLocalizedStrings(_localizer),
["stringsJson"] = JsonSerializer.Serialize(ThemePageDataFactory.CreateLocalizedStrings(_localizer), s_camelCaseJsonOptions)
}
};
Result<ThemePageRenderResultDto> sectionResult = await _themePageRenderer.RenderAsync(pageModel, requestedThemeId: null, cancellationToken).ConfigureAwait(false);
if (sectionResult.IsFailure)
{
Dictionary<string, object?> viewData = new()
{
["Title"] = title,
["AlbumCoverPath"] = album.CoverPath ?? string.Empty
};
return View("/Core/Views/Library/AudioLibrary/MusicLibrary/Tracks/Item.cshtml", track, viewData);
}
return View(
"/Core/Views/Shared/_ThemedView.cshtml",
new ThemeViewDto(sectionResult.Value.Content, sectionResult.Value.Script),
new Dictionary<string, object?> { ["Title"] = title });
}
}
@@ -0,0 +1,31 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Tracks;
using System;
using System.Diagnostics.CodeAnalysis;
#endregion
namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Tracks.EditMusicTrack;
/// <summary>
/// Class used for providing a textual description for the <see cref="EditMusicTrackViewEndpoint"/> endpoint, for OpenAPI.
/// </summary>
[ExcludeFromCodeCoverage]
public class EditMusicTrackViewEndpointSummary : Summary<EditMusicTrackViewEndpoint, GetMusicTrackViewRequest>
{
/// <summary>
/// Initializes a new instance of the <see cref="EditMusicTrackViewEndpointSummary"/> class.
/// </summary>
public EditMusicTrackViewEndpointSummary()
{
Summary = "Renders the music track details and editing view.";
Description = "Renders the view for displaying and editing the music track identified by the route.";
RequestParam(r => r.ArtistId, "The unique identifier of the artist the album belongs to. Required.");
RequestParam(r => r.AlbumId, "The unique identifier of the album the track belongs to. Required.");
RequestParam(r => r.TrackId, "The unique identifier of the track to display. Required.");
RequestParam(r => r.LibraryId, "The unique identifier of the media library the track belongs to. Required.");
Response(200, "The view for displaying and editing the music track is rendered.");
}
}
@@ -0,0 +1,78 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using Lumina.Presentation.Web.Common.Api;
using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Tracks;
using Lumina.Presentation.Web.Common.Routes;
using Lumina.Presentation.Web.Core.Endpoints.Common;
using Microsoft.AspNetCore.Http;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
#endregion
namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Tracks.GetAlbumTracks;
/// <summary>
/// API endpoint for the <c>/{culture}/library/audio-library/music-library/artists/{artistId}/albums/{albumId}/tracks/api-get-tracks</c> route.
/// </summary>
public class GetAlbumTracksEndpoint : BaseEndpoint<GetAlbumTracksLiteRequest, IResult>
{
private readonly IApiHttpClient _apiHttpClient;
/// <summary>
/// Initializes a new instance of the <see cref="GetAlbumTracksEndpoint"/> class.
/// </summary>
/// <param name="apiHttpClient">Injected service for interactions with the API.</param>
public GetAlbumTracksEndpoint(IApiHttpClient apiHttpClient)
{
_apiHttpClient = apiHttpClient;
}
/// <summary>
/// Configures the endpoint.
/// </summary>
public override void Configure()
{
base.Configure();
Verbs(Http.GET);
Routes(WebRoutes.Music.GET_ALBUM_TRACKS);
DontAutoTag();
Options(options => options.WithTags("Music"));
}
/// <summary>
/// Retrieves the lightweight details of the tracks of an album.
/// </summary>
/// <param name="request">The request containing the parameters used to retrieve the tracks.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
public override async Task<IResult> ExecuteAsync(GetAlbumTracksLiteRequest request, CancellationToken cancellationToken)
{
PaginatedMusicTrackLiteDto response = await _apiHttpClient.GetAsync<PaginatedMusicTrackLiteDto>(BuildItemsEndpoint(request), cancellationToken).ConfigureAwait(false);
return JsonSuccess(response);
}
/// <summary>
/// Builds the API endpoint used to retrieve the lightweight details of the tracks of an album.
/// </summary>
/// <param name="query">The request containing the parameters used to retrieve the tracks.</param>
/// <returns>The API endpoint to which the retrieval request is sent.</returns>
private static string BuildItemsEndpoint(GetAlbumTracksLiteRequest query)
{
// The route values are normalized to Guids before they are substituted into the upstream URL, so that a crafted route value can never
// escape its URL segment, and an unparseable id is reported by the API as a missing id.
string artistId = Guid.TryParse(query.ArtistId, out Guid parsedArtistId) ? parsedArtistId.ToString() : Guid.Empty.ToString();
string albumId = Guid.TryParse(query.AlbumId, out Guid parsedAlbumId) ? parsedAlbumId.ToString() : Guid.Empty.ToString();
StringBuilder endpoint = new(ApiRoutes.Music.GET_ALBUM_TRACKS_LITE.Replace("{libraryId}", query.LibraryId.ToString()).Replace("{artistId}", artistId).Replace("{albumId}", albumId));
List<string> parameters = [];
if (query.CurrentPage is not null)
parameters.Add($"currentPage={query.CurrentPage}");
if (query.PerPage is not null)
parameters.Add($"perPage={query.PerPage}");
if (parameters.Count > 0)
endpoint.Append('?').Append(string.Join('&', parameters));
return endpoint.ToString();
}
}
@@ -0,0 +1,40 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Tracks;
using System;
using System.Diagnostics.CodeAnalysis;
#endregion
namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Tracks.GetAlbumTracks;
/// <summary>
/// Class used for providing a textual description for the <see cref="GetAlbumTracksEndpoint"/> endpoint, for OpenAPI.
/// </summary>
[ExcludeFromCodeCoverage]
public class GetAlbumTracksEndpointSummary : Summary<GetAlbumTracksEndpoint, GetAlbumTracksLiteRequest>
{
/// <summary>
/// Initializes a new instance of the <see cref="GetAlbumTracksEndpointSummary"/> class.
/// </summary>
public GetAlbumTracksEndpointSummary()
{
Summary = "Retrieves the lightweight details of the tracks of an album.";
Description = "Retrieves the lightweight read models of the tracks of the album identified by the route.";
RequestParam(r => r.ArtistId, "The unique identifier of the artist the album belongs to. Required.");
RequestParam(r => r.AlbumId, "The unique identifier of the album whose tracks are retrieved. Required.");
RequestParam(r => r.LibraryId, "The unique identifier of the media library the album belongs to. Required.");
RequestParam(r => r.CurrentPage, "The page of results to retrieve. Optional.");
RequestParam(r => r.PerPage, "The maximum number of tracks to retrieve per page. Optional.");
ExampleRequest = new GetAlbumTracksLiteRequest(
ArtistId: Guid.NewGuid().ToString(),
AlbumId: Guid.NewGuid().ToString(),
LibraryId: Guid.NewGuid(),
CurrentPage: 1,
PerPage: 10
);
Response(200, "The lightweight details of the tracks of the album are retrieved.");
}
}
@@ -0,0 +1,62 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using Lumina.Presentation.Web.Common.Api;
using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Tracks;
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.Library.AudioLibrary.MusicLibrary.Tracks.GetMusicTrack;
/// <summary>
/// API endpoint for the <c>/{culture}/library/audio-library/music-library/artists/{artistId}/albums/{albumId}/tracks/{trackId}/api-get-track</c> route.
/// </summary>
public class GetMusicTrackEndpoint : BaseEndpoint<GetMusicTrackViewRequest, IResult>
{
private readonly IApiHttpClient _apiHttpClient;
/// <summary>
/// Initializes a new instance of the <see cref="GetMusicTrackEndpoint"/> class.
/// </summary>
/// <param name="apiHttpClient">Injected service for interactions with the API.</param>
public GetMusicTrackEndpoint(IApiHttpClient apiHttpClient)
{
_apiHttpClient = apiHttpClient;
}
/// <summary>
/// Configures the endpoint.
/// </summary>
public override void Configure()
{
base.Configure();
Verbs(Http.GET);
Routes(WebRoutes.Music.GET_TRACK);
DontAutoTag();
Options(options => options.WithTags("Music"));
}
/// <summary>
/// Retrieves the full details of the music track identified by <paramref name="request"/>.
/// </summary>
/// <param name="request">The request containing the Ids of the artist, album, track and media library to retrieve.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
public override async Task<IResult> ExecuteAsync(GetMusicTrackViewRequest request, CancellationToken cancellationToken)
{
// The route values are normalized to Guids before they are substituted into the upstream URL, so that a crafted route value can never
// escape its URL segment, and an unparseable id is reported by the API as a missing id.
string normalizedArtistId = Guid.TryParse(request.ArtistId, out Guid parsedArtistId) ? parsedArtistId.ToString() : Guid.Empty.ToString();
string normalizedAlbumId = Guid.TryParse(request.AlbumId, out Guid parsedAlbumId) ? parsedAlbumId.ToString() : Guid.Empty.ToString();
string normalizedTrackId = Guid.TryParse(request.TrackId, out Guid parsedTrackId) ? parsedTrackId.ToString() : Guid.Empty.ToString();
MusicTrackDto track = await _apiHttpClient.GetAsync<MusicTrackDto>(
ApiRoutes.Music.GET_TRACK.Replace("{libraryId}", request.LibraryId.ToString()).Replace("{artistId}", normalizedArtistId).Replace("{albumId}", normalizedAlbumId).Replace("{trackId}", normalizedTrackId), cancellationToken).ConfigureAwait(false);
return JsonSuccess(track);
}
}
@@ -0,0 +1,31 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Tracks;
using System;
using System.Diagnostics.CodeAnalysis;
#endregion
namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Tracks.GetMusicTrack;
/// <summary>
/// Class used for providing a textual description for the <see cref="GetMusicTrackEndpoint"/> endpoint, for OpenAPI.
/// </summary>
[ExcludeFromCodeCoverage]
public class GetMusicTrackEndpointSummary : Summary<GetMusicTrackEndpoint, GetMusicTrackViewRequest>
{
/// <summary>
/// Initializes a new instance of the <see cref="GetMusicTrackEndpointSummary"/> class.
/// </summary>
public GetMusicTrackEndpointSummary()
{
Summary = "Retrieves the full details of a music track.";
Description = "Retrieves the full details of the music track identified by the route.";
RequestParam(r => r.ArtistId, "The unique identifier of the artist the album belongs to. Required.");
RequestParam(r => r.AlbumId, "The unique identifier of the album the track belongs to. Required.");
RequestParam(r => r.TrackId, "The unique identifier of the track to retrieve. Required.");
RequestParam(r => r.LibraryId, "The unique identifier of the media library the track belongs to. Required.");
Response(200, "The full details of the music track are retrieved.");
}
}
@@ -0,0 +1,69 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using Lumina.Presentation.Web.Common.Api;
using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Tracks;
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.Library.AudioLibrary.MusicLibrary.Tracks.SaveMusicTrack;
/// <summary>
/// API endpoint for the <c>/{culture}/library/audio-library/music-library/artists/{artistId}/albums/{albumId}/tracks/{trackId}/api-save-track</c> route.
/// </summary>
public class SaveMusicTrackEndpoint : BaseEndpoint<UpdateMusicTrackRequest, IResult>
{
private readonly IApiHttpClient _apiHttpClient;
/// <summary>
/// Initializes a new instance of the <see cref="SaveMusicTrackEndpoint"/> class.
/// </summary>
/// <param name="apiHttpClient">Injected service for interactions with the API.</param>
public SaveMusicTrackEndpoint(IApiHttpClient apiHttpClient)
{
_apiHttpClient = apiHttpClient;
}
/// <summary>
/// Configures the endpoint.
/// </summary>
public override void Configure()
{
base.Configure();
Verbs(Http.PUT);
Routes(WebRoutes.Music.SAVE_TRACK);
DontAutoTag();
Options(options => options.WithTags("Music"));
EnableAntiforgery();
}
/// <summary>
/// Updates the music track described by <paramref name="request"/>.
/// </summary>
/// <param name="request">The request containing the edited details of the track.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
public override async Task<IResult> ExecuteAsync(UpdateMusicTrackRequest request, CancellationToken cancellationToken)
{
// The track is identified by the {artistId}, {albumId} and {trackId} route values, not by any id posted in the body, so that a mismatched
// id can never redirect the update to another track; all ids are normalized to Guids before they are 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 id.
string routeArtistId = HttpContext.Request.RouteValues["artistId"]?.ToString() ?? string.Empty;
string artistId = Guid.TryParse(routeArtistId, out Guid parsedArtistId) ? parsedArtistId.ToString() : Guid.Empty.ToString();
string routeAlbumId = HttpContext.Request.RouteValues["albumId"]?.ToString() ?? string.Empty;
string albumId = Guid.TryParse(routeAlbumId, out Guid parsedAlbumId) ? parsedAlbumId.ToString() : Guid.Empty.ToString();
string routeTrackId = HttpContext.Request.RouteValues["trackId"]?.ToString() ?? string.Empty;
string trackId = Guid.TryParse(routeTrackId, out Guid parsedTrackId) ? parsedTrackId.ToString() : Guid.Empty.ToString();
string queryLibraryId = HttpContext.Request.Query["libraryId"].ToString();
string libraryId = Guid.TryParse(queryLibraryId, out Guid parsedLibraryId) ? parsedLibraryId.ToString() : Guid.Empty.ToString();
MusicTrackDto track = await _apiHttpClient.PutAsync<MusicTrackDto, UpdateMusicTrackRequest>(
ApiRoutes.Music.UPDATE_TRACK.Replace("{libraryId}", libraryId).Replace("{artistId}", artistId).Replace("{albumId}", albumId).Replace("{trackId}", trackId), request, cancellationToken).ConfigureAwait(false);
return JsonSuccess(track);
}
}
@@ -0,0 +1,25 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Tracks;
using System.Diagnostics.CodeAnalysis;
#endregion
namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Tracks.SaveMusicTrack;
/// <summary>
/// Class used for providing a textual description for the <see cref="SaveMusicTrackEndpoint"/> endpoint, for OpenAPI.
/// </summary>
[ExcludeFromCodeCoverage]
public class SaveMusicTrackEndpointSummary : Summary<SaveMusicTrackEndpoint, UpdateMusicTrackRequest>
{
/// <summary>
/// Initializes a new instance of the <see cref="SaveMusicTrackEndpointSummary"/> class.
/// </summary>
public SaveMusicTrackEndpointSummary()
{
Summary = "Updates a music track.";
Description = "Updates the music track identified by the route, together with its metadata.";
Response(200, "The music track was updated.");
}
}
@@ -0,0 +1,60 @@
<?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="Search" xml:space="preserve">
<value>بحث</value>
</data>
<data name="Items" xml:space="preserve">
<value>عناصر</value>
</data>
<data name="Of" xml:space="preserve">
<value>من</value>
</data>
<data name="Page" xml:space="preserve">
<value>صفحة</value>
</data>
<data name="Previous" xml:space="preserve">
<value>السابق</value>
</data>
<data name="Next" xml:space="preserve">
<value>التالي</value>
</data>
<data name="SortAscending" xml:space="preserve">
<value>الترتيب: أ-ي</value>
</data>
<data name="SortDescending" xml:space="preserve">
<value>الترتيب: ي-أ</value>
</data>
<data name="NoItems" xml:space="preserve">
<value>لا تحتوي هذه المكتبة على أي عناصر</value>
</data>
<data name="NoItemsMatchFilters" xml:space="preserve">
<value>لا توجد عناصر تطابق الفلاتر الحالية</value>
</data>
<data name="All" xml:space="preserve">
<value>الكل</value>
</data>
<data name="ViewDetails" 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>
</root>
@@ -0,0 +1,60 @@
<?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="Search" xml:space="preserve">
<value>Suchen</value>
</data>
<data name="Items" xml:space="preserve">
<value>Einträge</value>
</data>
<data name="Of" xml:space="preserve">
<value>von</value>
</data>
<data name="Page" xml:space="preserve">
<value>Seite</value>
</data>
<data name="Previous" xml:space="preserve">
<value>Zurück</value>
</data>
<data name="Next" xml:space="preserve">
<value>Weiter</value>
</data>
<data name="SortAscending" xml:space="preserve">
<value>Sortieren: A-Z</value>
</data>
<data name="SortDescending" xml:space="preserve">
<value>Sortieren: Z-A</value>
</data>
<data name="NoItems" xml:space="preserve">
<value>Diese Bibliothek hat keine Einträge</value>
</data>
<data name="NoItemsMatchFilters" xml:space="preserve">
<value>Keine Einträge entsprechen den aktuellen Filtern</value>
</data>
<data name="All" xml:space="preserve">
<value>Alle</value>
</data>
<data name="ViewDetails" xml:space="preserve">
<value>Details anzeigen</value>
</data>
<data name="Delete" xml:space="preserve">
<value>Löschen</value>
</data>
<data name="DeleteConfirm" xml:space="preserve">
<value>Möchten Sie dieses Element wirklich löschen?</value>
</data>
<data name="DeleteFailed" xml:space="preserve">
<value>Das Element konnte nicht gelöscht werden.</value>
</data>
</root>
@@ -0,0 +1,60 @@
<?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="Search" xml:space="preserve">
<value>Search</value>
</data>
<data name="Items" xml:space="preserve">
<value>items</value>
</data>
<data name="Of" xml:space="preserve">
<value>of</value>
</data>
<data name="Page" xml:space="preserve">
<value>Page</value>
</data>
<data name="Previous" xml:space="preserve">
<value>Previous</value>
</data>
<data name="Next" xml:space="preserve">
<value>Next</value>
</data>
<data name="SortAscending" xml:space="preserve">
<value>Sort: A-Z</value>
</data>
<data name="SortDescending" xml:space="preserve">
<value>Sort: Z-A</value>
</data>
<data name="NoItems" xml:space="preserve">
<value>This library has no items</value>
</data>
<data name="NoItemsMatchFilters" xml:space="preserve">
<value>No items match the current filters</value>
</data>
<data name="All" xml:space="preserve">
<value>All</value>
</data>
<data name="ViewDetails" xml:space="preserve">
<value>View details</value>
</data>
<data name="Delete" xml:space="preserve">
<value>Delete</value>
</data>
<data name="DeleteConfirm" xml:space="preserve">
<value>Are you sure you want to delete this item?</value>
</data>
<data name="DeleteFailed" xml:space="preserve">
<value>The item could not be deleted.</value>
</data>
</root>
@@ -0,0 +1,60 @@
<?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="Search" xml:space="preserve">
<value>Buscar</value>
</data>
<data name="Items" xml:space="preserve">
<value>elementos</value>
</data>
<data name="Of" xml:space="preserve">
<value>de</value>
</data>
<data name="Page" xml:space="preserve">
<value>Página</value>
</data>
<data name="Previous" xml:space="preserve">
<value>Anterior</value>
</data>
<data name="Next" xml:space="preserve">
<value>Siguiente</value>
</data>
<data name="SortAscending" xml:space="preserve">
<value>Ordenar: A-Z</value>
</data>
<data name="SortDescending" xml:space="preserve">
<value>Ordenar: Z-A</value>
</data>
<data name="NoItems" xml:space="preserve">
<value>Esta biblioteca no tiene elementos</value>
</data>
<data name="NoItemsMatchFilters" xml:space="preserve">
<value>Ningún elemento coincide con los filtros actuales</value>
</data>
<data name="All" xml:space="preserve">
<value>Todas</value>
</data>
<data name="ViewDetails" xml:space="preserve">
<value>Ver detalles</value>
</data>
<data name="Delete" xml:space="preserve">
<value>Eliminar</value>
</data>
<data name="DeleteConfirm" xml:space="preserve">
<value>¿Seguro que quieres eliminar este elemento?</value>
</data>
<data name="DeleteFailed" xml:space="preserve">
<value>No se ha podido eliminar el elemento.</value>
</data>
</root>
@@ -0,0 +1,60 @@
<?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="Search" xml:space="preserve">
<value>Rechercher</value>
</data>
<data name="Items" xml:space="preserve">
<value>éléments</value>
</data>
<data name="Of" xml:space="preserve">
<value>sur</value>
</data>
<data name="Page" xml:space="preserve">
<value>Page</value>
</data>
<data name="Previous" xml:space="preserve">
<value>Précédent</value>
</data>
<data name="Next" xml:space="preserve">
<value>Suivant</value>
</data>
<data name="SortAscending" xml:space="preserve">
<value>Trier : A-Z</value>
</data>
<data name="SortDescending" xml:space="preserve">
<value>Trier : Z-A</value>
</data>
<data name="NoItems" xml:space="preserve">
<value>Cette bibliothèque ne contient aucun élément</value>
</data>
<data name="NoItemsMatchFilters" xml:space="preserve">
<value>Aucun élément ne correspond aux filtres actuels</value>
</data>
<data name="All" xml:space="preserve">
<value>Toutes</value>
</data>
<data name="ViewDetails" xml:space="preserve">
<value>Voir les détails</value>
</data>
<data name="Delete" xml:space="preserve">
<value>Supprimer</value>
</data>
<data name="DeleteConfirm" xml:space="preserve">
<value>Voulez-vous vraiment supprimer cet élément ?</value>
</data>
<data name="DeleteFailed" xml:space="preserve">
<value>L'élément n'a pas pu être supprimé.</value>
</data>
</root>
@@ -0,0 +1,60 @@
<?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="Search" xml:space="preserve">
<value>Cerca</value>
</data>
<data name="Items" xml:space="preserve">
<value>elementi</value>
</data>
<data name="Of" xml:space="preserve">
<value>di</value>
</data>
<data name="Page" xml:space="preserve">
<value>Pagina</value>
</data>
<data name="Previous" xml:space="preserve">
<value>Precedente</value>
</data>
<data name="Next" xml:space="preserve">
<value>Successivo</value>
</data>
<data name="SortAscending" xml:space="preserve">
<value>Ordina: A-Z</value>
</data>
<data name="SortDescending" xml:space="preserve">
<value>Ordina: Z-A</value>
</data>
<data name="NoItems" xml:space="preserve">
<value>Questa biblioteca non contiene elementi</value>
</data>
<data name="NoItemsMatchFilters" xml:space="preserve">
<value>Nessun elemento corrisponde ai filtri correnti</value>
</data>
<data name="All" xml:space="preserve">
<value>Tutte</value>
</data>
<data name="ViewDetails" xml:space="preserve">
<value>Visualizza dettagli</value>
</data>
<data name="Delete" xml:space="preserve">
<value>Elimina</value>
</data>
<data name="DeleteConfirm" xml:space="preserve">
<value>Sei sicuro di voler eliminare questo elemento?</value>
</data>
<data name="DeleteFailed" xml:space="preserve">
<value>Non è stato possibile eliminare l'elemento.</value>
</data>
</root>
@@ -0,0 +1,60 @@
<?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="Search" xml:space="preserve">
<value>検索</value>
</data>
<data name="Items" xml:space="preserve">
<value>件</value>
</data>
<data name="Of" xml:space="preserve">
<value>/</value>
</data>
<data name="Page" xml:space="preserve">
<value>ページ</value>
</data>
<data name="Previous" xml:space="preserve">
<value>前へ</value>
</data>
<data name="Next" xml:space="preserve">
<value>次へ</value>
</data>
<data name="SortAscending" xml:space="preserve">
<value>並べ替え: A-Z</value>
</data>
<data name="SortDescending" xml:space="preserve">
<value>並べ替え: Z-A</value>
</data>
<data name="NoItems" xml:space="preserve">
<value>このライブラリには項目がありません</value>
</data>
<data name="NoItemsMatchFilters" xml:space="preserve">
<value>現在のフィルターに一致する項目はありません</value>
</data>
<data name="All" xml:space="preserve">
<value>すべて</value>
</data>
<data name="ViewDetails" 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>
</root>
@@ -0,0 +1,60 @@
<?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="Search" xml:space="preserve">
<value>Search</value>
</data>
<data name="Items" xml:space="preserve">
<value>items</value>
</data>
<data name="Of" xml:space="preserve">
<value>of</value>
</data>
<data name="Page" xml:space="preserve">
<value>Page</value>
</data>
<data name="Previous" xml:space="preserve">
<value>Previous</value>
</data>
<data name="Next" xml:space="preserve">
<value>Next</value>
</data>
<data name="SortAscending" xml:space="preserve">
<value>Sort: A-Z</value>
</data>
<data name="SortDescending" xml:space="preserve">
<value>Sort: Z-A</value>
</data>
<data name="NoItems" xml:space="preserve">
<value>This library has no items</value>
</data>
<data name="NoItemsMatchFilters" xml:space="preserve">
<value>No items match the current filters</value>
</data>
<data name="All" xml:space="preserve">
<value>All</value>
</data>
<data name="ViewDetails" xml:space="preserve">
<value>View details</value>
</data>
<data name="Delete" xml:space="preserve">
<value>Delete</value>
</data>
<data name="DeleteConfirm" xml:space="preserve">
<value>Are you sure you want to delete this item?</value>
</data>
<data name="DeleteFailed" xml:space="preserve">
<value>The item could not be deleted.</value>
</data>
</root>
Loaded 100 of 215 files, more files were not shown because too many files have changed in this diff. Show more