diff --git a/README.md b/README.md
index c7d8a563..46c79f7a 100644
--- a/README.md
+++ b/README.md
@@ -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.**
diff --git a/docs/manual/using-lumina/index.md b/docs/manual/using-lumina/index.md
index 60a693a3..62a45c37 100644
--- a/docs/manual/using-lumina/index.md
+++ b/docs/manual/using-lumina/index.md
@@ -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.
diff --git a/docs/technical/api/library/audio-library/music-library/Api.Albums.md b/docs/technical/api/library/audio-library/music-library/Api.Albums.md
index 21459643..cbe5d852 100644
--- a/docs/technical/api/library/audio-library/music-library/Api.Albums.md
+++ b/docs/technical/api/library/audio-library/music-library/Api.Albums.md
@@ -17,6 +17,9 @@
- [Update Album](#update-album)
- [Update Album Request](#update-album-request)
- [Update Album Response](#update-album-response)
+ - [Update Album Cover](#update-album-cover)
+ - [Update Album Cover Request](#update-album-cover-request)
+ - [Update Album Cover Response](#update-album-cover-response)
- [Delete Album](#delete-album)
- [Get Album Tracks](#get-album-tracks)
- [Get Album Tracks Request](#get-album-tracks-request)
@@ -41,12 +44,12 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b
"title": "A Night at the Opera",
"originalTitle": "A Night at the Opera",
"description": "The fourth studio album by the British rock band Queen, released in 1975. It was the most expensive album ever recorded at the time of its release.",
- "disambiguation": null,
+ "disambiguation": "original release",
"releaseInfo": {
"originalReleaseDate": "1975-11-21",
"originalReleaseYear": 1975,
- "reReleaseDate": null,
- "reReleaseYear": null,
+ "reReleaseDate": "2011-11-21",
+ "reReleaseYear": 2011,
"releaseCountry": "GB",
"releaseVersion": "Remastered"
},
@@ -109,12 +112,12 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b
"title": "Bohemian Rhapsody",
"originalTitle": "Bohemian Rhapsody",
"description": "A song by the British rock band Queen. It was written by Freddie Mercury and originally released on the album A Night at the Opera in 1975.",
- "disambiguation": null,
+ "disambiguation": "album version",
"releaseInfo": {
"originalReleaseDate": "1975-10-31",
"originalReleaseYear": 1975,
- "reReleaseDate": null,
- "reReleaseYear": null,
+ "reReleaseDate": "2011-11-21",
+ "reReleaseYear": 2011,
"releaseCountry": "GB",
"releaseVersion": "Original"
},
@@ -161,7 +164,7 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b
"languages": [
{ "languageCode": "en", "languageName": "English", "nativeName": "English" }
],
- "iswcs": []
+ "iswcs": ["T-010489707-6"]
},
"musicBrainzRecordingId": "d4e5f6a7-b8c9-4d0e-1f2a-3b4c5d6e7f8a",
"musicBrainzTrackId": "e5f6a7b8-c9d0-4e1f-2a3b-4c5d6e7f8a9b",
@@ -197,12 +200,12 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b
"title": "You're My Best Friend",
"originalTitle": "You're My Best Friend",
"description": "A song by the British rock band Queen, written by bass guitarist John Deacon. It was originally released on the album A Night at the Opera in 1975 and as a single in 1976.",
- "disambiguation": null,
+ "disambiguation": "album version",
"releaseInfo": {
"originalReleaseDate": "1976-06-18",
"originalReleaseYear": 1976,
- "reReleaseDate": null,
- "reReleaseYear": null,
+ "reReleaseDate": "2011-11-21",
+ "reReleaseYear": 2011,
"releaseCountry": "GB",
"releaseVersion": "Original"
},
@@ -231,11 +234,11 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b
"bitDepth": 16,
"audioCodec": "FLAC",
"bitrate": 912,
- "acoustId": null,
- "replayGainTrackGain": null,
- "replayGainTrackPeak": null,
- "replayGainAlbumGain": null,
- "replayGainAlbumPeak": null
+ "acoustId": "0a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d",
+ "replayGainTrackGain": -7.2,
+ "replayGainTrackPeak": 0.9812,
+ "replayGainAlbumGain": -6.5,
+ "replayGainAlbumPeak": 0.9987
},
"trackNumber": 7,
"discNumber": 1,
@@ -249,7 +252,7 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b
"languages": [
{ "languageCode": "en", "languageName": "English", "nativeName": "English" }
],
- "iswcs": []
+ "iswcs": ["T-010489707-6"]
},
"musicBrainzRecordingId": "0f3e4d5c-6b7a-4f8e-9d0c-1b2a3c4d5e6f",
"musicBrainzTrackId": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
@@ -298,12 +301,12 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b
"title": "A Night at the Opera",
"originalTitle": "A Night at the Opera",
"description": "The fourth studio album by the British rock band Queen, released in 1975. It was the most expensive album ever recorded at the time of its release.",
- "disambiguation": null,
+ "disambiguation": "original release",
"releaseInfo": {
"originalReleaseDate": "1975-11-21",
"originalReleaseYear": 1975,
- "reReleaseDate": null,
- "reReleaseYear": null,
+ "reReleaseDate": "2011-11-21",
+ "reReleaseYear": 2011,
"releaseCountry": "GB",
"releaseVersion": "Remastered"
},
@@ -342,7 +345,7 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b
"musicBrainzReleaseGroupId": "b2c3d4e5-f6a7-4b8c-9d0e-1f2a3b4c5d6e",
"musicBrainzReleaseArtistId": "c3d4e5f6-a7b8-4c9d-0e1f-2a3b4c5d6e7f",
"createdOnUtc": "2025-01-01T12:00:00.0000000Z",
- "updatedOnUtc": null,
+ "updatedOnUtc": "2025-01-20T14:45:00.0000000Z",
"contributors": [
{
"contributorId": "0e7b4a6c-5f8d-6b9e-ca0b-3c4d5e6f7a8b",
@@ -377,8 +380,8 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b
"title": "Bohemian Rhapsody",
"originalTitle": "Bohemian Rhapsody",
"description": "A song by the British rock band Queen. It was written by Freddie Mercury and originally released on the album A Night at the Opera in 1975.",
- "disambiguation": null,
- "releaseInfo": { "originalReleaseDate": "1975-10-31", "originalReleaseYear": 1975, "reReleaseDate": null, "reReleaseYear": null, "releaseCountry": "GB", "releaseVersion": "Original" },
+ "disambiguation": "album version",
+ "releaseInfo": { "originalReleaseDate": "1975-10-31", "originalReleaseYear": 1975, "reReleaseDate": "2011-11-21", "reReleaseYear": 2011, "releaseCountry": "GB", "releaseVersion": "Original" },
"language": { "languageCode": "en", "languageName": "English", "nativeName": "English" },
"originalLanguage": { "languageCode": "en", "languageName": "English", "nativeName": "English" },
"tags": [ { "name": "classic" }, { "name": "epic" } ],
@@ -408,12 +411,12 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b
"languages": [
{ "languageCode": "en", "languageName": "English", "nativeName": "English" }
],
- "iswcs": []
+ "iswcs": ["T-010489707-6"]
},
"musicBrainzRecordingId": "d4e5f6a7-b8c9-4d0e-1f2a-3b4c5d6e7f8a",
"musicBrainzTrackId": "e5f6a7b8-c9d0-4e1f-2a3b-4c5d6e7f8a9b",
"createdOnUtc": "2025-01-01T12:00:00.0000000Z",
- "updatedOnUtc": null,
+ "updatedOnUtc": "2025-01-20T14:45:00.0000000Z",
"moods": [
{ "name": "dramatic" },
{ "name": "anxious" }
@@ -455,8 +458,8 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b
"title": "You're My Best Friend",
"originalTitle": "You're My Best Friend",
"description": "A song by the British rock band Queen, written by bass guitarist John Deacon. It was originally released on the album A Night at the Opera in 1975 and as a single in 1976.",
- "disambiguation": null,
- "releaseInfo": { "originalReleaseDate": "1976-06-18", "originalReleaseYear": 1976, "reReleaseDate": null, "reReleaseYear": null, "releaseCountry": "GB", "releaseVersion": "Original" },
+ "disambiguation": "album version",
+ "releaseInfo": { "originalReleaseDate": "1976-06-18", "originalReleaseYear": 1976, "reReleaseDate": "2011-11-21", "reReleaseYear": 2011, "releaseCountry": "GB", "releaseVersion": "Original" },
"language": { "languageCode": "en", "languageName": "English", "nativeName": "English" },
"originalLanguage": { "languageCode": "en", "languageName": "English", "nativeName": "English" },
"tags": [ { "name": "classic" }, { "name": "love" } ],
@@ -468,11 +471,11 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b
"bitDepth": 16,
"audioCodec": "FLAC",
"bitrate": 912,
- "acoustId": null,
- "replayGainTrackGain": null,
- "replayGainTrackPeak": null,
- "replayGainAlbumGain": null,
- "replayGainAlbumPeak": null
+ "acoustId": "0a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d",
+ "replayGainTrackGain": -7.2,
+ "replayGainTrackPeak": 0.9812,
+ "replayGainAlbumGain": -6.5,
+ "replayGainAlbumPeak": 0.9987
},
"trackNumber": 7,
"discNumber": 1,
@@ -486,12 +489,12 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b
"languages": [
{ "languageCode": "en", "languageName": "English", "nativeName": "English" }
],
- "iswcs": []
+ "iswcs": ["T-010489707-6"]
},
"musicBrainzRecordingId": "0f3e4d5c-6b7a-4f8e-9d0c-1b2a3c4d5e6f",
"musicBrainzTrackId": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
"createdOnUtc": "2025-01-01T12:00:00.0000000Z",
- "updatedOnUtc": null,
+ "updatedOnUtc": "2025-01-20T14:45:00.0000000Z",
"moods": [
{ "name": "happy" },
{ "name": "warm" }
@@ -524,6 +527,14 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b
}
]
}
+ ],
+ "coverPath": "/media/music/Queen-3b3a19f3/A Night at the Opera-e8d52f7b/cover.jpg",
+ "artwork": [
+ {
+ "type": "Cover",
+ "ordinal": 0,
+ "path": "/media/music/Queen-3b3a19f3/A Night at the Opera-e8d52f7b/cover.jpg"
+ }
]
}
```
@@ -553,12 +564,12 @@ GET api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b-
"title": "A Night at the Opera",
"originalTitle": "A Night at the Opera",
"description": "The fourth studio album by the British rock band Queen, released in 1975. It was the most expensive album ever recorded at the time of its release.",
- "disambiguation": null,
+ "disambiguation": "original release",
"releaseInfo": {
"originalReleaseDate": "1975-11-21",
"originalReleaseYear": 1975,
- "reReleaseDate": null,
- "reReleaseYear": null,
+ "reReleaseDate": "2011-11-21",
+ "reReleaseYear": 2011,
"releaseCountry": "GB",
"releaseVersion": "Remastered"
},
@@ -597,7 +608,7 @@ GET api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b-
"musicBrainzReleaseGroupId": "b2c3d4e5-f6a7-4b8c-9d0e-1f2a3b4c5d6e",
"musicBrainzReleaseArtistId": "c3d4e5f6-a7b8-4c9d-0e1f-2a3b4c5d6e7f",
"createdOnUtc": "2025-01-01T12:00:00.0000000Z",
- "updatedOnUtc": null,
+ "updatedOnUtc": "2025-01-20T14:45:00.0000000Z",
"contributors": [
{
"contributorId": "0e7b4a6c-5f8d-6b9e-ca0b-3c4d5e6f7a8b",
@@ -622,7 +633,172 @@ GET api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b-
"voteCount": 1234
}
],
- "tracks": []
+ "tracks": [
+ {
+ "id": "9f0e1d2c-3b4a-4c6d-8e7f-9a0b1c2d3e4f",
+ "albumId": "e8d52f7b-0a3c-4c2d-ab4f-8a7b6c5d4e3f",
+ "libraryId": "3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a",
+ "path": "/music/queen/a-night-at-the-opera/01-bohemian-rhapsody.flac",
+ "metadata": {
+ "title": "Bohemian Rhapsody",
+ "originalTitle": "Bohemian Rhapsody",
+ "description": "A song by the British rock band Queen. It was written by Freddie Mercury and originally released on the album A Night at the Opera in 1975.",
+ "disambiguation": "album version",
+ "releaseInfo": { "originalReleaseDate": "1975-10-31", "originalReleaseYear": 1975, "reReleaseDate": "2011-11-21", "reReleaseYear": 2011, "releaseCountry": "GB", "releaseVersion": "Original" },
+ "language": { "languageCode": "en", "languageName": "English", "nativeName": "English" },
+ "originalLanguage": { "languageCode": "en", "languageName": "English", "nativeName": "English" },
+ "tags": [ { "name": "classic" }, { "name": "epic" } ],
+ "genres": [ { "name": "Rock" }, { "name": "Progressive Rock" } ],
+ "isVideo": false,
+ "durationInSeconds": 354,
+ "sampleRate": 44100,
+ "channels": 2,
+ "bitDepth": 16,
+ "audioCodec": "FLAC",
+ "bitrate": 980,
+ "acoustId": "f0e1d2c3-b4a5-4c6d-8e7f-9a0b1c2d3e4f",
+ "replayGainTrackGain": -7.5,
+ "replayGainTrackPeak": 0.9877,
+ "replayGainAlbumGain": -6.8,
+ "replayGainAlbumPeak": 0.9999
+ },
+ "trackNumber": 1,
+ "discNumber": 1,
+ "script": "Latn",
+ "key": "CMajor",
+ "bpm": 72,
+ "work": {
+ "musicBrainzWorkId": "f6a7b8c9-d0e1-4f2a-3b4c-5d6e7f8a9b0c",
+ "title": "Bohemian Rhapsody",
+ "type": "Song",
+ "languages": [
+ { "languageCode": "en", "languageName": "English", "nativeName": "English" }
+ ],
+ "iswcs": ["T-010489707-6"]
+ },
+ "musicBrainzRecordingId": "d4e5f6a7-b8c9-4d0e-1f2a-3b4c5d6e7f8a",
+ "musicBrainzTrackId": "e5f6a7b8-c9d0-4e1f-2a3b-4c5d6e7f8a9b",
+ "createdOnUtc": "2025-01-01T12:00:00.0000000Z",
+ "updatedOnUtc": "2025-01-20T14:45:00.0000000Z",
+ "moods": [
+ { "name": "dramatic" },
+ { "name": "anxious" }
+ ],
+ "isrcs": [
+ { "value": "GBUM71029604" }
+ ],
+ "contributors": [
+ {
+ "contributorId": "6a3f0c2d-1b4e-4f5a-8c6d-9e0f1a2b3c4d",
+ "role": "Vocals"
+ },
+ {
+ "contributorId": "7b4e1d3f-2c5a-4e6b-9d7e-0f1a2b3c4d5e",
+ "role": "Guitar"
+ }
+ ],
+ "ratings": [
+ {
+ "value": 4.5,
+ "maxValue": 5,
+ "source": "MusicBrainz",
+ "voteCount": 2345
+ },
+ {
+ "value": 4.8,
+ "maxValue": 5,
+ "source": "LastFm",
+ "voteCount": 1234
+ }
+ ]
+ },
+ {
+ "id": "8e1f2a3b-4c5d-4e6f-8a9b-0c1d2e3f4a5b",
+ "albumId": "e8d52f7b-0a3c-4c2d-ab4f-8a7b6c5d4e3f",
+ "libraryId": "3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a",
+ "path": "/music/queen/a-night-at-the-opera/07-youre-my-best-friend.flac",
+ "metadata": {
+ "title": "You're My Best Friend",
+ "originalTitle": "You're My Best Friend",
+ "description": "A song by the British rock band Queen, written by bass guitarist John Deacon. It was originally released on the album A Night at the Opera in 1975 and as a single in 1976.",
+ "disambiguation": "album version",
+ "releaseInfo": { "originalReleaseDate": "1976-06-18", "originalReleaseYear": 1976, "reReleaseDate": "2011-11-21", "reReleaseYear": 2011, "releaseCountry": "GB", "releaseVersion": "Original" },
+ "language": { "languageCode": "en", "languageName": "English", "nativeName": "English" },
+ "originalLanguage": { "languageCode": "en", "languageName": "English", "nativeName": "English" },
+ "tags": [ { "name": "classic" }, { "name": "love" } ],
+ "genres": [ { "name": "Rock" }, { "name": "Pop Rock" } ],
+ "isVideo": false,
+ "durationInSeconds": 181,
+ "sampleRate": 44100,
+ "channels": 2,
+ "bitDepth": 16,
+ "audioCodec": "FLAC",
+ "bitrate": 912,
+ "acoustId": "0a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d",
+ "replayGainTrackGain": -7.2,
+ "replayGainTrackPeak": 0.9812,
+ "replayGainAlbumGain": -6.5,
+ "replayGainAlbumPeak": 0.9987
+ },
+ "trackNumber": 7,
+ "discNumber": 1,
+ "script": "Latn",
+ "key": "BMajor",
+ "bpm": 118,
+ "work": {
+ "musicBrainzWorkId": "2b3c4d5e-6f7a-4b8c-9d0e-1f2a3b4c5d6e",
+ "title": "You're My Best Friend",
+ "type": "Song",
+ "languages": [
+ { "languageCode": "en", "languageName": "English", "nativeName": "English" }
+ ],
+ "iswcs": ["T-010489707-6"]
+ },
+ "musicBrainzRecordingId": "0f3e4d5c-6b7a-4f8e-9d0c-1b2a3c4d5e6f",
+ "musicBrainzTrackId": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
+ "createdOnUtc": "2025-01-01T12:00:00.0000000Z",
+ "updatedOnUtc": "2025-01-20T14:45:00.0000000Z",
+ "moods": [
+ { "name": "happy" },
+ { "name": "warm" }
+ ],
+ "isrcs": [
+ { "value": "GBUM71029609" }
+ ],
+ "contributors": [
+ {
+ "contributorId": "6a3f0c2d-1b4e-4f5a-8c6d-9e0f1a2b3c4d",
+ "role": "Vocals"
+ },
+ {
+ "contributorId": "7b4e1d3f-2c5a-4e6b-9d7e-0f1a2b3c4d5e",
+ "role": "Guitar"
+ }
+ ],
+ "ratings": [
+ {
+ "value": 4.2,
+ "maxValue": 5,
+ "source": "MusicBrainz",
+ "voteCount": 1234
+ },
+ {
+ "value": 4.4,
+ "maxValue": 5,
+ "source": "LastFm",
+ "voteCount": 567
+ }
+ ]
+ }
+ ],
+ "coverPath": "/media/music/Queen-3b3a19f3/A Night at the Opera-e8d52f7b/cover.jpg",
+ "artwork": [
+ {
+ "type": "Cover",
+ "ordinal": 0,
+ "path": "/media/music/Queen-3b3a19f3/A Night at the Opera-e8d52f7b/cover.jpg"
+ }
+ ]
}
]
```
@@ -653,7 +829,10 @@ GET api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b-
{
"id": "e8d52f7b-0a3c-4c2d-ab4f-8a7b6c5d4e3f",
"title": "A Night at the Opera",
- "totalTracks": 12
+ "totalTracks": 12,
+ "coverPath": "/media/music/Queen-3b3a19f3/A Night at the Opera-e8d52f7b/cover.jpg",
+ "releaseYear": 1975,
+ "releaseTypes": [ "Album" ]
}
],
"currentPage": 1,
@@ -687,12 +866,12 @@ GET api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b-
"title": "A Night at the Opera",
"originalTitle": "A Night at the Opera",
"description": "The fourth studio album by the British rock band Queen, released in 1975. It was the most expensive album ever recorded at the time of its release.",
- "disambiguation": null,
+ "disambiguation": "original release",
"releaseInfo": {
"originalReleaseDate": "1975-11-21",
"originalReleaseYear": 1975,
- "reReleaseDate": null,
- "reReleaseYear": null,
+ "reReleaseDate": "2011-11-21",
+ "reReleaseYear": 2011,
"releaseCountry": "GB",
"releaseVersion": "Remastered"
},
@@ -731,7 +910,7 @@ GET api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b-
"musicBrainzReleaseGroupId": "b2c3d4e5-f6a7-4b8c-9d0e-1f2a3b4c5d6e",
"musicBrainzReleaseArtistId": "c3d4e5f6-a7b8-4c9d-0e1f-2a3b4c5d6e7f",
"createdOnUtc": "2025-01-01T12:00:00.0000000Z",
- "updatedOnUtc": null,
+ "updatedOnUtc": "2025-01-20T14:45:00.0000000Z",
"contributors": [
{
"contributorId": "0e7b4a6c-5f8d-6b9e-ca0b-3c4d5e6f7a8b",
@@ -756,7 +935,182 @@ GET api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b-
"voteCount": 1234
}
],
- "tracks": []
+ "tracks": [
+ {
+ "id": "9f0e1d2c-3b4a-4c6d-8e7f-9a0b1c2d3e4f",
+ "albumId": "e8d52f7b-0a3c-4c2d-ab4f-8a7b6c5d4e3f",
+ "libraryId": "3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a",
+ "path": "/music/queen/a-night-at-the-opera/01-bohemian-rhapsody.flac",
+ "metadata": {
+ "title": "Bohemian Rhapsody",
+ "originalTitle": "Bohemian Rhapsody",
+ "description": "A song by the British rock band Queen. It was written by Freddie Mercury and originally released on the album A Night at the Opera in 1975.",
+ "disambiguation": "album version",
+ "releaseInfo": { "originalReleaseDate": "1975-10-31", "originalReleaseYear": 1975, "reReleaseDate": "2011-11-21", "reReleaseYear": 2011, "releaseCountry": "GB", "releaseVersion": "Original" },
+ "language": { "languageCode": "en", "languageName": "English", "nativeName": "English" },
+ "originalLanguage": { "languageCode": "en", "languageName": "English", "nativeName": "English" },
+ "tags": [ { "name": "classic" }, { "name": "epic" } ],
+ "genres": [ { "name": "Rock" }, { "name": "Progressive Rock" } ],
+ "isVideo": false,
+ "durationInSeconds": 354,
+ "sampleRate": 44100,
+ "channels": 2,
+ "bitDepth": 16,
+ "audioCodec": "FLAC",
+ "bitrate": 980,
+ "acoustId": "f0e1d2c3-b4a5-4c6d-8e7f-9a0b1c2d3e4f",
+ "replayGainTrackGain": -7.5,
+ "replayGainTrackPeak": 0.9877,
+ "replayGainAlbumGain": -6.8,
+ "replayGainAlbumPeak": 0.9999
+ },
+ "trackNumber": 1,
+ "discNumber": 1,
+ "script": "Latn",
+ "key": "CMajor",
+ "bpm": 72,
+ "work": {
+ "musicBrainzWorkId": "f6a7b8c9-d0e1-4f2a-3b4c-5d6e7f8a9b0c",
+ "title": "Bohemian Rhapsody",
+ "type": "Song",
+ "languages": [
+ { "languageCode": "en", "languageName": "English", "nativeName": "English" }
+ ],
+ "iswcs": ["T-010489707-6"]
+ },
+ "musicBrainzRecordingId": "d4e5f6a7-b8c9-4d0e-1f2a-3b4c5d6e7f8a",
+ "musicBrainzTrackId": "e5f6a7b8-c9d0-4e1f-2a3b-4c5d6e7f8a9b",
+ "createdOnUtc": "2025-01-01T12:00:00.0000000Z",
+ "updatedOnUtc": "2025-01-20T14:45:00.0000000Z",
+ "moods": [
+ { "name": "dramatic" },
+ { "name": "anxious" }
+ ],
+ "isrcs": [
+ { "value": "GBUM71029604" }
+ ],
+ "contributors": [
+ {
+ "contributorId": "6a3f0c2d-1b4e-4f5a-8c6d-9e0f1a2b3c4d",
+ "role": "Vocals"
+ },
+ {
+ "contributorId": "7b4e1d3f-2c5a-4e6b-9d7e-0f1a2b3c4d5e",
+ "role": "Guitar"
+ }
+ ],
+ "ratings": [
+ {
+ "value": 4.5,
+ "maxValue": 5,
+ "source": "MusicBrainz",
+ "voteCount": 2345
+ },
+ {
+ "value": 4.8,
+ "maxValue": 5,
+ "source": "LastFm",
+ "voteCount": 1234
+ }
+ ]
+ },
+ {
+ "id": "8e1f2a3b-4c5d-4e6f-8a9b-0c1d2e3f4a5b",
+ "albumId": "e8d52f7b-0a3c-4c2d-ab4f-8a7b6c5d4e3f",
+ "libraryId": "3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a",
+ "path": "/music/queen/a-night-at-the-opera/07-youre-my-best-friend.flac",
+ "metadata": {
+ "title": "You're My Best Friend",
+ "originalTitle": "You're My Best Friend",
+ "description": "A song by the British rock band Queen, written by bass guitarist John Deacon. It was originally released on the album A Night at the Opera in 1975 and as a single in 1976.",
+ "disambiguation": "album version",
+ "releaseInfo": { "originalReleaseDate": "1976-06-18", "originalReleaseYear": 1976, "reReleaseDate": "2011-11-21", "reReleaseYear": 2011, "releaseCountry": "GB", "releaseVersion": "Original" },
+ "language": { "languageCode": "en", "languageName": "English", "nativeName": "English" },
+ "originalLanguage": { "languageCode": "en", "languageName": "English", "nativeName": "English" },
+ "tags": [ { "name": "classic" }, { "name": "love" } ],
+ "genres": [ { "name": "Rock" }, { "name": "Pop Rock" } ],
+ "isVideo": false,
+ "durationInSeconds": 181,
+ "sampleRate": 44100,
+ "channels": 2,
+ "bitDepth": 16,
+ "audioCodec": "FLAC",
+ "bitrate": 912,
+ "acoustId": "0a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d",
+ "replayGainTrackGain": -7.2,
+ "replayGainTrackPeak": 0.9812,
+ "replayGainAlbumGain": -6.5,
+ "replayGainAlbumPeak": 0.9987
+ },
+ "trackNumber": 7,
+ "discNumber": 1,
+ "script": "Latn",
+ "key": "BMajor",
+ "bpm": 118,
+ "work": {
+ "musicBrainzWorkId": "2b3c4d5e-6f7a-4b8c-9d0e-1f2a3b4c5d6e",
+ "title": "You're My Best Friend",
+ "type": "Song",
+ "languages": [
+ { "languageCode": "en", "languageName": "English", "nativeName": "English" }
+ ],
+ "iswcs": ["T-010489707-6"]
+ },
+ "musicBrainzRecordingId": "0f3e4d5c-6b7a-4f8e-9d0c-1b2a3c4d5e6f",
+ "musicBrainzTrackId": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
+ "createdOnUtc": "2025-01-01T12:00:00.0000000Z",
+ "updatedOnUtc": "2025-01-20T14:45:00.0000000Z",
+ "moods": [
+ { "name": "happy" },
+ { "name": "warm" }
+ ],
+ "isrcs": [
+ { "value": "GBUM71029609" }
+ ],
+ "contributors": [
+ {
+ "contributorId": "6a3f0c2d-1b4e-4f5a-8c6d-9e0f1a2b3c4d",
+ "role": "Vocals"
+ },
+ {
+ "contributorId": "7b4e1d3f-2c5a-4e6b-9d7e-0f1a2b3c4d5e",
+ "role": "Guitar"
+ }
+ ],
+ "ratings": [
+ {
+ "value": 4.2,
+ "maxValue": 5,
+ "source": "MusicBrainz",
+ "voteCount": 1234
+ },
+ {
+ "value": 4.4,
+ "maxValue": 5,
+ "source": "LastFm",
+ "voteCount": 567
+ }
+ ]
+ }
+ ],
+ "coverPath": "/media/music/Queen-3b3a19f3/A Night at the Opera-e8d52f7b/cover.jpg",
+ "artwork": [
+ {
+ "type": "Cover",
+ "ordinal": 0,
+ "path": "/media/music/Queen-3b3a19f3/A Night at the Opera-e8d52f7b/cover.jpg"
+ },
+ {
+ "type": "Back",
+ "ordinal": 0,
+ "path": "/media/music/Queen-3b3a19f3/A Night at the Opera-e8d52f7b/back.jpg"
+ },
+ {
+ "type": "Booklet",
+ "ordinal": 0,
+ "path": "/media/music/Queen-3b3a19f3/A Night at the Opera-e8d52f7b/booklet.jpg"
+ }
+ ]
}
```
@@ -775,12 +1129,12 @@ PUT api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b-
"title": "A Night at the Opera",
"originalTitle": "A Night at the Opera",
"description": "The fourth studio album by the British rock band Queen, released in 1975. It was the most expensive album ever recorded at the time of its release.",
- "disambiguation": null,
+ "disambiguation": "original release",
"releaseInfo": {
"originalReleaseDate": "1975-11-21",
"originalReleaseYear": 1975,
- "reReleaseDate": null,
- "reReleaseYear": null,
+ "reReleaseDate": "2011-11-21",
+ "reReleaseYear": 2011,
"releaseCountry": "GB",
"releaseVersion": "Remastered"
},
@@ -854,12 +1208,12 @@ PUT api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b-
"title": "A Night at the Opera",
"originalTitle": "A Night at the Opera",
"description": "The fourth studio album by the British rock band Queen, released in 1975. It was the most expensive album ever recorded at the time of its release.",
- "disambiguation": null,
+ "disambiguation": "original release",
"releaseInfo": {
"originalReleaseDate": "1975-11-21",
"originalReleaseYear": 1975,
- "reReleaseDate": null,
- "reReleaseYear": null,
+ "reReleaseDate": "2011-11-21",
+ "reReleaseYear": 2011,
"releaseCountry": "GB",
"releaseVersion": "Remastered"
},
@@ -898,7 +1252,7 @@ PUT api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b-
"musicBrainzReleaseGroupId": "b2c3d4e5-f6a7-4b8c-9d0e-1f2a3b4c5d6e",
"musicBrainzReleaseArtistId": "c3d4e5f6-a7b8-4c9d-0e1f-2a3b4c5d6e7f",
"createdOnUtc": "2025-01-01T12:00:00.0000000Z",
- "updatedOnUtc": null,
+ "updatedOnUtc": "2025-01-20T14:45:00.0000000Z",
"contributors": [
{
"contributorId": "0e7b4a6c-5f8d-6b9e-ca0b-3c4d5e6f7a8b",
@@ -923,7 +1277,202 @@ PUT api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b-
"voteCount": 1234
}
],
- "tracks": []
+ "tracks": [
+ {
+ "id": "9f0e1d2c-3b4a-4c6d-8e7f-9a0b1c2d3e4f",
+ "albumId": "e8d52f7b-0a3c-4c2d-ab4f-8a7b6c5d4e3f",
+ "libraryId": "3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a",
+ "path": "/music/queen/a-night-at-the-opera/01-bohemian-rhapsody.flac",
+ "metadata": {
+ "title": "Bohemian Rhapsody",
+ "originalTitle": "Bohemian Rhapsody",
+ "description": "A song by the British rock band Queen. It was written by Freddie Mercury and originally released on the album A Night at the Opera in 1975.",
+ "disambiguation": "album version",
+ "releaseInfo": { "originalReleaseDate": "1975-10-31", "originalReleaseYear": 1975, "reReleaseDate": "2011-11-21", "reReleaseYear": 2011, "releaseCountry": "GB", "releaseVersion": "Original" },
+ "language": { "languageCode": "en", "languageName": "English", "nativeName": "English" },
+ "originalLanguage": { "languageCode": "en", "languageName": "English", "nativeName": "English" },
+ "tags": [ { "name": "classic" }, { "name": "epic" } ],
+ "genres": [ { "name": "Rock" }, { "name": "Progressive Rock" } ],
+ "isVideo": false,
+ "durationInSeconds": 354,
+ "sampleRate": 44100,
+ "channels": 2,
+ "bitDepth": 16,
+ "audioCodec": "FLAC",
+ "bitrate": 980,
+ "acoustId": "f0e1d2c3-b4a5-4c6d-8e7f-9a0b1c2d3e4f",
+ "replayGainTrackGain": -7.5,
+ "replayGainTrackPeak": 0.9877,
+ "replayGainAlbumGain": -6.8,
+ "replayGainAlbumPeak": 0.9999
+ },
+ "trackNumber": 1,
+ "discNumber": 1,
+ "script": "Latn",
+ "key": "CMajor",
+ "bpm": 72,
+ "work": {
+ "musicBrainzWorkId": "f6a7b8c9-d0e1-4f2a-3b4c-5d6e7f8a9b0c",
+ "title": "Bohemian Rhapsody",
+ "type": "Song",
+ "languages": [
+ { "languageCode": "en", "languageName": "English", "nativeName": "English" }
+ ],
+ "iswcs": ["T-010489707-6"]
+ },
+ "musicBrainzRecordingId": "d4e5f6a7-b8c9-4d0e-1f2a-3b4c5d6e7f8a",
+ "musicBrainzTrackId": "e5f6a7b8-c9d0-4e1f-2a3b-4c5d6e7f8a9b",
+ "createdOnUtc": "2025-01-01T12:00:00.0000000Z",
+ "updatedOnUtc": "2025-01-20T14:45:00.0000000Z",
+ "moods": [
+ { "name": "dramatic" },
+ { "name": "anxious" }
+ ],
+ "isrcs": [
+ { "value": "GBUM71029604" }
+ ],
+ "contributors": [
+ {
+ "contributorId": "6a3f0c2d-1b4e-4f5a-8c6d-9e0f1a2b3c4d",
+ "role": "Vocals"
+ },
+ {
+ "contributorId": "7b4e1d3f-2c5a-4e6b-9d7e-0f1a2b3c4d5e",
+ "role": "Guitar"
+ }
+ ],
+ "ratings": [
+ {
+ "value": 4.5,
+ "maxValue": 5,
+ "source": "MusicBrainz",
+ "voteCount": 2345
+ },
+ {
+ "value": 4.8,
+ "maxValue": 5,
+ "source": "LastFm",
+ "voteCount": 1234
+ }
+ ]
+ },
+ {
+ "id": "8e1f2a3b-4c5d-4e6f-8a9b-0c1d2e3f4a5b",
+ "albumId": "e8d52f7b-0a3c-4c2d-ab4f-8a7b6c5d4e3f",
+ "libraryId": "3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a",
+ "path": "/music/queen/a-night-at-the-opera/07-youre-my-best-friend.flac",
+ "metadata": {
+ "title": "You're My Best Friend",
+ "originalTitle": "You're My Best Friend",
+ "description": "A song by the British rock band Queen, written by bass guitarist John Deacon. It was originally released on the album A Night at the Opera in 1975 and as a single in 1976.",
+ "disambiguation": "album version",
+ "releaseInfo": { "originalReleaseDate": "1976-06-18", "originalReleaseYear": 1976, "reReleaseDate": "2011-11-21", "reReleaseYear": 2011, "releaseCountry": "GB", "releaseVersion": "Original" },
+ "language": { "languageCode": "en", "languageName": "English", "nativeName": "English" },
+ "originalLanguage": { "languageCode": "en", "languageName": "English", "nativeName": "English" },
+ "tags": [ { "name": "classic" }, { "name": "love" } ],
+ "genres": [ { "name": "Rock" }, { "name": "Pop Rock" } ],
+ "isVideo": false,
+ "durationInSeconds": 181,
+ "sampleRate": 44100,
+ "channels": 2,
+ "bitDepth": 16,
+ "audioCodec": "FLAC",
+ "bitrate": 912,
+ "acoustId": "0a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d",
+ "replayGainTrackGain": -7.2,
+ "replayGainTrackPeak": 0.9812,
+ "replayGainAlbumGain": -6.5,
+ "replayGainAlbumPeak": 0.9987
+ },
+ "trackNumber": 7,
+ "discNumber": 1,
+ "script": "Latn",
+ "key": "BMajor",
+ "bpm": 118,
+ "work": {
+ "musicBrainzWorkId": "2b3c4d5e-6f7a-4b8c-9d0e-1f2a3b4c5d6e",
+ "title": "You're My Best Friend",
+ "type": "Song",
+ "languages": [
+ { "languageCode": "en", "languageName": "English", "nativeName": "English" }
+ ],
+ "iswcs": ["T-010489707-6"]
+ },
+ "musicBrainzRecordingId": "0f3e4d5c-6b7a-4f8e-9d0c-1b2a3c4d5e6f",
+ "musicBrainzTrackId": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
+ "createdOnUtc": "2025-01-01T12:00:00.0000000Z",
+ "updatedOnUtc": "2025-01-20T14:45:00.0000000Z",
+ "moods": [
+ { "name": "happy" },
+ { "name": "warm" }
+ ],
+ "isrcs": [
+ { "value": "GBUM71029609" }
+ ],
+ "contributors": [
+ {
+ "contributorId": "6a3f0c2d-1b4e-4f5a-8c6d-9e0f1a2b3c4d",
+ "role": "Vocals"
+ },
+ {
+ "contributorId": "7b4e1d3f-2c5a-4e6b-9d7e-0f1a2b3c4d5e",
+ "role": "Guitar"
+ }
+ ],
+ "ratings": [
+ {
+ "value": 4.2,
+ "maxValue": 5,
+ "source": "MusicBrainz",
+ "voteCount": 1234
+ },
+ {
+ "value": 4.4,
+ "maxValue": 5,
+ "source": "LastFm",
+ "voteCount": 567
+ }
+ ]
+ }
+ ],
+ "coverPath": "/media/music/Queen-3b3a19f3/A Night at the Opera-e8d52f7b/cover.jpg",
+ "artwork": [
+ {
+ "type": "Cover",
+ "ordinal": 0,
+ "path": "/media/music/Queen-3b3a19f3/A Night at the Opera-e8d52f7b/cover.jpg"
+ }
+ ]
+}
+```
+
+### Update Album Cover
+
+Updates the cover image of the album identified by `albumId` with the image uploaded in the multipart form of the request. The album must belong to the artist identified by `artistId` and to the media library identified by `libraryId`, and the uploaded file must be an image.
+
+#### Update Album Cover Request
+
+```js
+PUT api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b-4b1c-9a3e-7f6e5d4c3b2a/albums/{albumId}/cover
+Content-Type: multipart/form-data; boundary=LuminaBoundary
+
+--LuminaBoundary
+Content-Disposition: form-data; name="cover"; filename="cover.jpg"
+Content-Type: image/jpeg
+
+< ./cover.jpg
+--LuminaBoundary--
+```
+
+#### Update Album Cover Response
+
+```js
+200 Ok
+```
+
+```json
+{
+ "coverPath": "/media/music/music-3f2504e0-4f89-41d3-9a0c-0305e82c3301/Queen-2b0e5f5a-0b3f-4b7e-8f4a-8c9e3d2f5a6b/A Night at the Opera-7c1d2e3f-4a5b-6c7d-8e9f-0a1b2c3d4e5f/cover.jpg"
}
```
@@ -966,8 +1515,8 @@ GET api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b-
"title": "Bohemian Rhapsody",
"originalTitle": "Bohemian Rhapsody",
"description": "A song by the British rock band Queen. It was written by Freddie Mercury and originally released on the album A Night at the Opera in 1975.",
- "disambiguation": null,
- "releaseInfo": { "originalReleaseDate": "1975-10-31", "originalReleaseYear": 1975, "reReleaseDate": null, "reReleaseYear": null, "releaseCountry": "GB", "releaseVersion": "Original" },
+ "disambiguation": "album version",
+ "releaseInfo": { "originalReleaseDate": "1975-10-31", "originalReleaseYear": 1975, "reReleaseDate": "2011-11-21", "reReleaseYear": 2011, "releaseCountry": "GB", "releaseVersion": "Original" },
"language": { "languageCode": "en", "languageName": "English", "nativeName": "English" },
"originalLanguage": { "languageCode": "en", "languageName": "English", "nativeName": "English" },
"tags": [ { "name": "classic" }, { "name": "epic" } ],
@@ -997,12 +1546,12 @@ GET api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b-
"languages": [
{ "languageCode": "en", "languageName": "English", "nativeName": "English" }
],
- "iswcs": []
+ "iswcs": ["T-010489707-6"]
},
"musicBrainzRecordingId": "d4e5f6a7-b8c9-4d0e-1f2a-3b4c5d6e7f8a",
"musicBrainzTrackId": "e5f6a7b8-c9d0-4e1f-2a3b-4c5d6e7f8a9b",
"createdOnUtc": "2025-01-01T12:00:00.0000000Z",
- "updatedOnUtc": null,
+ "updatedOnUtc": "2025-01-20T14:45:00.0000000Z",
"moods": [
{
"name": "dramatic"
@@ -1071,7 +1620,8 @@ GET api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b-
"id": "9f0e1d2c-3b4a-4c6d-8e7f-9a0b1c2d3e4f",
"title": "Bohemian Rhapsody",
"trackNumber": 1,
- "discNumber": 1
+ "discNumber": 1,
+ "durationInSeconds": 354
}
],
"currentPage": 1,
diff --git a/docs/technical/api/library/audio-library/music-library/Api.Artists.md b/docs/technical/api/library/audio-library/music-library/Api.Artists.md
index 5f37a0bb..3a5fe443 100644
--- a/docs/technical/api/library/audio-library/music-library/Api.Artists.md
+++ b/docs/technical/api/library/audio-library/music-library/Api.Artists.md
@@ -17,6 +17,9 @@
- [Update Artist](#update-artist)
- [Update Artist Request](#update-artist-request)
- [Update Artist Response](#update-artist-response)
+ - [Update Artist Cover](#update-artist-cover)
+ - [Update Artist Cover Request](#update-artist-cover-request)
+ - [Update Artist Cover Response](#update-artist-cover-response)
- [Delete Artist](#delete-artist)
## Artist
@@ -34,22 +37,36 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists
"metadata": {
"name": "Queen",
"sortName": "Queen",
- "disambiguation": null,
+ "disambiguation": "British rock band",
"type": "Group",
- "gender": null,
+ "gender": "NotApplicable",
"country": "GB",
"area": {
"musicBrainzAreaId": "7f2a1b3c-4d5e-4f6a-8b9c-0d1e2f3a4b5c",
"name": "United Kingdom",
"sortName": "United Kingdom",
- "disambiguation": null,
+ "disambiguation": "sovereign state",
+ "type": "Country",
+ "iso3166Code": "GB"
+ },
+ "beginArea": {
+ "musicBrainzAreaId": "7f2a1b3c-4d5e-4f6a-8b9c-0d1e2f3a4b5c",
+ "name": "United Kingdom",
+ "sortName": "United Kingdom",
+ "disambiguation": "sovereign state",
+ "type": "Country",
+ "iso3166Code": "GB"
+ },
+ "endArea": {
+ "musicBrainzAreaId": "7f2a1b3c-4d5e-4f6a-8b9c-0d1e2f3a4b5c",
+ "name": "United Kingdom",
+ "sortName": "United Kingdom",
+ "disambiguation": "sovereign state",
"type": "Country",
"iso3166Code": "GB"
},
- "beginArea": null,
- "endArea": null,
"lifeSpanBegin": "1970-06-27",
- "lifeSpanEnd": null,
+ "lifeSpanEnd": "1991-11-24",
"isEnded": false,
"genres": [
{ "name": "Rock" }
@@ -65,15 +82,15 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists
"locale": "en",
"isPrimary": true,
"beginDate": "1970-06-27",
- "endDate": null,
+ "endDate": "1991-11-24",
"isEnded": false
}
]
},
"website": "https://www.queenonline.com",
"musicBrainzArtistId": "6f9c0b2a-1d3e-4a5b-8c7d-9e0f1a2b3c4d",
- "ipis": [],
- "isnis": [],
+ "ipis": ["00012345678"],
+ "isnis": ["0000000123456789"],
"contributors": [
{ "contributorId": "6a3f0c2d-1b4e-4f5a-8c6d-9e0f1a2b3c4d", "role": "Vocals" },
{ "contributorId": "7b4e1d3f-2c5a-4e6b-9d7e-0f1a2b3c4d5e", "role": "Guitar" }
@@ -92,12 +109,12 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists
"title": "A Night at the Opera",
"originalTitle": "A Night at the Opera",
"description": "The fourth studio album by the British rock band Queen, released in 1975. It was the most expensive album ever recorded at the time of its release.",
- "disambiguation": null,
+ "disambiguation": "original release",
"releaseInfo": {
"originalReleaseDate": "1975-11-21",
"originalReleaseYear": 1975,
- "reReleaseDate": null,
- "reReleaseYear": null,
+ "reReleaseDate": "2011-11-21",
+ "reReleaseYear": 2011,
"releaseCountry": "GB",
"releaseVersion": "Remastered"
},
@@ -160,12 +177,12 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists
"title": "Bohemian Rhapsody",
"originalTitle": "Bohemian Rhapsody",
"description": "A song by the British rock band Queen. It was written by Freddie Mercury and originally released on the album A Night at the Opera in 1975.",
- "disambiguation": null,
+ "disambiguation": "album version",
"releaseInfo": {
"originalReleaseDate": "1975-10-31",
"originalReleaseYear": 1975,
- "reReleaseDate": null,
- "reReleaseYear": null,
+ "reReleaseDate": "2011-11-21",
+ "reReleaseYear": 2011,
"releaseCountry": "GB",
"releaseVersion": "Original"
},
@@ -212,7 +229,7 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists
"languages": [
{ "languageCode": "en", "languageName": "English", "nativeName": "English" }
],
- "iswcs": []
+ "iswcs": ["T-010489707-6"]
},
"musicBrainzRecordingId": "d4e5f6a7-b8c9-4d0e-1f2a-3b4c5d6e7f8a",
"musicBrainzTrackId": "e5f6a7b8-c9d0-4e1f-2a3b-4c5d6e7f8a9b",
@@ -248,12 +265,12 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists
"title": "You're My Best Friend",
"originalTitle": "You're My Best Friend",
"description": "A song by the British rock band Queen, written by bass guitarist John Deacon. It was originally released on the album A Night at the Opera in 1975 and as a single in 1976.",
- "disambiguation": null,
+ "disambiguation": "album version",
"releaseInfo": {
"originalReleaseDate": "1976-06-18",
"originalReleaseYear": 1976,
- "reReleaseDate": null,
- "reReleaseYear": null,
+ "reReleaseDate": "2011-11-21",
+ "reReleaseYear": 2011,
"releaseCountry": "GB",
"releaseVersion": "Original"
},
@@ -282,11 +299,11 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists
"bitDepth": 16,
"audioCodec": "FLAC",
"bitrate": 912,
- "acoustId": null,
- "replayGainTrackGain": null,
- "replayGainTrackPeak": null,
- "replayGainAlbumGain": null,
- "replayGainAlbumPeak": null
+ "acoustId": "0a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d",
+ "replayGainTrackGain": -7.2,
+ "replayGainTrackPeak": 0.9812,
+ "replayGainAlbumGain": -6.5,
+ "replayGainAlbumPeak": 0.9987
},
"trackNumber": 7,
"discNumber": 1,
@@ -300,7 +317,7 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists
"languages": [
{ "languageCode": "en", "languageName": "English", "nativeName": "English" }
],
- "iswcs": []
+ "iswcs": ["T-010489707-6"]
},
"musicBrainzRecordingId": "0f3e4d5c-6b7a-4f8e-9d0c-1b2a3c4d5e6f",
"musicBrainzTrackId": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
@@ -349,22 +366,36 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists
"metadata": {
"name": "Queen",
"sortName": "Queen",
- "disambiguation": null,
+ "disambiguation": "British rock band",
"type": "Group",
- "gender": null,
+ "gender": "NotApplicable",
"country": "GB",
"area": {
"musicBrainzAreaId": "7f2a1b3c-4d5e-4f6a-8b9c-0d1e2f3a4b5c",
"name": "United Kingdom",
"sortName": "United Kingdom",
- "disambiguation": null,
+ "disambiguation": "sovereign state",
+ "type": "Country",
+ "iso3166Code": "GB"
+ },
+ "beginArea": {
+ "musicBrainzAreaId": "7f2a1b3c-4d5e-4f6a-8b9c-0d1e2f3a4b5c",
+ "name": "United Kingdom",
+ "sortName": "United Kingdom",
+ "disambiguation": "sovereign state",
+ "type": "Country",
+ "iso3166Code": "GB"
+ },
+ "endArea": {
+ "musicBrainzAreaId": "7f2a1b3c-4d5e-4f6a-8b9c-0d1e2f3a4b5c",
+ "name": "United Kingdom",
+ "sortName": "United Kingdom",
+ "disambiguation": "sovereign state",
"type": "Country",
"iso3166Code": "GB"
},
- "beginArea": null,
- "endArea": null,
"lifeSpanBegin": "1970-06-27",
- "lifeSpanEnd": null,
+ "lifeSpanEnd": "1991-11-24",
"isEnded": false,
"genres": [
{ "name": "Rock" }
@@ -380,17 +411,17 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists
"locale": "en",
"isPrimary": true,
"beginDate": "1970-06-27",
- "endDate": null,
+ "endDate": "1991-11-24",
"isEnded": false
}
]
},
"website": "https://www.queenonline.com",
"musicBrainzArtistId": "6f9c0b2a-1d3e-4a5b-8c7d-9e0f1a2b3c4d",
- "ipis": [],
- "isnis": [],
+ "ipis": ["00012345678"],
+ "isnis": ["0000000123456789"],
"createdOnUtc": "2025-01-01T12:00:00.0000000Z",
- "updatedOnUtc": null,
+ "updatedOnUtc": "2025-01-20T14:45:00.0000000Z",
"contributors": [
{ "contributorId": "6a3f0c2d-1b4e-4f5a-8c6d-9e0f1a2b3c4d", "role": "Vocals" },
{ "contributorId": "7b4e1d3f-2c5a-4e6b-9d7e-0f1a2b3c4d5e", "role": "Guitar" }
@@ -412,12 +443,12 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists
"title": "A Night at the Opera",
"originalTitle": "A Night at the Opera",
"description": "The fourth studio album by the British rock band Queen, released in 1975. It was the most expensive album ever recorded at the time of its release.",
- "disambiguation": null,
+ "disambiguation": "original release",
"releaseInfo": {
"originalReleaseDate": "1975-11-21",
"originalReleaseYear": 1975,
- "reReleaseDate": null,
- "reReleaseYear": null,
+ "reReleaseDate": "2011-11-21",
+ "reReleaseYear": 2011,
"releaseCountry": "GB",
"releaseVersion": "Remastered"
},
@@ -456,7 +487,7 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists
"musicBrainzReleaseGroupId": "b2c3d4e5-f6a7-4b8c-9d0e-1f2a3b4c5d6e",
"musicBrainzReleaseArtistId": "c3d4e5f6-a7b8-4c9d-0e1f-2a3b4c5d6e7f",
"createdOnUtc": "2025-01-01T12:00:00.0000000Z",
- "updatedOnUtc": null,
+ "updatedOnUtc": "2025-01-20T14:45:00.0000000Z",
"contributors": [
{
"contributorId": "0e7b4a6c-5f8d-6b9e-ca0b-3c4d5e6f7a8b",
@@ -491,8 +522,8 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists
"title": "Bohemian Rhapsody",
"originalTitle": "Bohemian Rhapsody",
"description": "A song by the British rock band Queen. It was written by Freddie Mercury and originally released on the album A Night at the Opera in 1975.",
- "disambiguation": null,
- "releaseInfo": { "originalReleaseDate": "1975-10-31", "originalReleaseYear": 1975, "reReleaseDate": null, "reReleaseYear": null, "releaseCountry": "GB", "releaseVersion": "Original" },
+ "disambiguation": "album version",
+ "releaseInfo": { "originalReleaseDate": "1975-10-31", "originalReleaseYear": 1975, "reReleaseDate": "2011-11-21", "reReleaseYear": 2011, "releaseCountry": "GB", "releaseVersion": "Original" },
"language": { "languageCode": "en", "languageName": "English", "nativeName": "English" },
"originalLanguage": { "languageCode": "en", "languageName": "English", "nativeName": "English" },
"tags": [ { "name": "classic" }, { "name": "epic" } ],
@@ -522,12 +553,12 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists
"languages": [
{ "languageCode": "en", "languageName": "English", "nativeName": "English" }
],
- "iswcs": []
+ "iswcs": ["T-010489707-6"]
},
"musicBrainzRecordingId": "d4e5f6a7-b8c9-4d0e-1f2a-3b4c5d6e7f8a",
"musicBrainzTrackId": "e5f6a7b8-c9d0-4e1f-2a3b-4c5d6e7f8a9b",
"createdOnUtc": "2025-01-01T12:00:00.0000000Z",
- "updatedOnUtc": null,
+ "updatedOnUtc": "2025-01-20T14:45:00.0000000Z",
"moods": [
{ "name": "dramatic" },
{ "name": "anxious" }
@@ -569,8 +600,8 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists
"title": "You're My Best Friend",
"originalTitle": "You're My Best Friend",
"description": "A song by the British rock band Queen, written by bass guitarist John Deacon. It was originally released on the album A Night at the Opera in 1975 and as a single in 1976.",
- "disambiguation": null,
- "releaseInfo": { "originalReleaseDate": "1976-06-18", "originalReleaseYear": 1976, "reReleaseDate": null, "reReleaseYear": null, "releaseCountry": "GB", "releaseVersion": "Original" },
+ "disambiguation": "album version",
+ "releaseInfo": { "originalReleaseDate": "1976-06-18", "originalReleaseYear": 1976, "reReleaseDate": "2011-11-21", "reReleaseYear": 2011, "releaseCountry": "GB", "releaseVersion": "Original" },
"language": { "languageCode": "en", "languageName": "English", "nativeName": "English" },
"originalLanguage": { "languageCode": "en", "languageName": "English", "nativeName": "English" },
"tags": [ { "name": "classic" }, { "name": "love" } ],
@@ -582,11 +613,11 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists
"bitDepth": 16,
"audioCodec": "FLAC",
"bitrate": 912,
- "acoustId": null,
- "replayGainTrackGain": null,
- "replayGainTrackPeak": null,
- "replayGainAlbumGain": null,
- "replayGainAlbumPeak": null
+ "acoustId": "0a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d",
+ "replayGainTrackGain": -7.2,
+ "replayGainTrackPeak": 0.9812,
+ "replayGainAlbumGain": -6.5,
+ "replayGainAlbumPeak": 0.9987
},
"trackNumber": 7,
"discNumber": 1,
@@ -600,12 +631,12 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists
"languages": [
{ "languageCode": "en", "languageName": "English", "nativeName": "English" }
],
- "iswcs": []
+ "iswcs": ["T-010489707-6"]
},
"musicBrainzRecordingId": "0f3e4d5c-6b7a-4f8e-9d0c-1b2a3c4d5e6f",
"musicBrainzTrackId": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
"createdOnUtc": "2025-01-01T12:00:00.0000000Z",
- "updatedOnUtc": null,
+ "updatedOnUtc": "2025-01-20T14:45:00.0000000Z",
"moods": [
{ "name": "happy" },
{ "name": "warm" }
@@ -638,9 +669,18 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists
}
]
}
+ ],
+ "coverPath": "/media/music/Queen-3b3a19f3/A Night at the Opera-e8d52f7b/cover.jpg",
+ "artwork": [
+ {
+ "type": "Cover",
+ "ordinal": 0,
+ "path": "/media/music/Queen-3b3a19f3/A Night at the Opera-e8d52f7b/cover.jpg"
+ }
]
}
- ]
+ ],
+ "coverPath": "/media/music/Queen-3b3a19f3/cover.jpg"
}
```
@@ -674,29 +714,320 @@ GET api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists?currentPage=1&
"metadata": {
"name": "Queen",
"sortName": "Queen",
- "disambiguation": null,
+ "disambiguation": "British rock band",
"type": "Group",
- "gender": null,
+ "gender": "NotApplicable",
"country": "GB",
- "area": null,
- "beginArea": null,
- "endArea": null,
+ "area": {
+ "musicBrainzAreaId": "7f2a1b3c-4d5e-4f6a-8b9c-0d1e2f3a4b5c",
+ "name": "United Kingdom",
+ "sortName": "United Kingdom",
+ "disambiguation": "sovereign state",
+ "type": "Country",
+ "iso3166Code": "GB"
+ },
+ "beginArea": {
+ "musicBrainzAreaId": "7f2a1b3c-4d5e-4f6a-8b9c-0d1e2f3a4b5c",
+ "name": "United Kingdom",
+ "sortName": "United Kingdom",
+ "disambiguation": "sovereign state",
+ "type": "Country",
+ "iso3166Code": "GB"
+ },
+ "endArea": {
+ "musicBrainzAreaId": "7f2a1b3c-4d5e-4f6a-8b9c-0d1e2f3a4b5c",
+ "name": "United Kingdom",
+ "sortName": "United Kingdom",
+ "disambiguation": "sovereign state",
+ "type": "Country",
+ "iso3166Code": "GB"
+ },
"lifeSpanBegin": "1970-06-27",
- "lifeSpanEnd": null,
+ "lifeSpanEnd": "1991-11-24",
"isEnded": false,
- "genres": [],
- "tags": [],
- "aliases": []
+ "genres": [
+ { "name": "Rock" }
+ ],
+ "tags": [
+ { "name": "classic" }
+ ],
+ "aliases": [
+ {
+ "name": "The Queen",
+ "sortName": "Queen",
+ "type": "Artist name",
+ "locale": "en",
+ "isPrimary": false,
+ "beginDate": "1970-06-27",
+ "endDate": "1991-11-24",
+ "isEnded": true
+ }
+ ]
},
"website": "https://www.queenonline.com",
"musicBrainzArtistId": "6f9c0b2a-1d3e-4a5b-8c7d-9e0f1a2b3c4d",
- "ipis": [],
- "isnis": [],
+ "ipis": ["00012345678"],
+ "isnis": ["0000000123456789"],
"createdOnUtc": "2025-01-01T12:00:00.0000000Z",
- "updatedOnUtc": null,
- "contributors": [],
- "ratings": [],
- "albums": []
+ "updatedOnUtc": "2025-01-20T14:45:00.0000000Z",
+ "contributors": [
+ { "contributorId": "6a3f0c2d-1b4e-4f5a-8c6d-9e0f1a2b3c4d", "role": "Vocals" }
+ ],
+ "ratings": [
+ {
+ "value": 4.5,
+ "maxValue": 5,
+ "source": "MusicBrainz",
+ "voteCount": 2345
+ }
+ ],
+ "albums": [
+ {
+ "id": "e8d52f7b-0a3c-4c2d-ab4f-8a7b6c5d4e3f",
+ "artistId": "d7c41e6a-9f2b-4b1c-9a3e-7f6e5d4c3b2a",
+ "libraryId": "3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a",
+ "metadata": {
+ "title": "A Night at the Opera",
+ "originalTitle": "A Night at the Opera",
+ "description": "The fourth studio album by the British rock band Queen, released in 1975. It was the most expensive album ever recorded at the time of its release.",
+ "disambiguation": "original release",
+ "releaseInfo": {
+ "originalReleaseDate": "1975-11-21",
+ "originalReleaseYear": 1975,
+ "reReleaseDate": "2011-11-21",
+ "reReleaseYear": 2011,
+ "releaseCountry": "GB",
+ "releaseVersion": "Remastered"
+ },
+ "language": {
+ "languageCode": "en",
+ "languageName": "English",
+ "nativeName": "English"
+ },
+ "originalLanguage": {
+ "languageCode": "en",
+ "languageName": "English",
+ "nativeName": "English"
+ },
+ "tags": [
+ { "name": "classic" },
+ { "name": "vinyl" }
+ ],
+ "genres": [
+ { "name": "Rock" },
+ { "name": "Progressive Rock" }
+ ],
+ "script": "Latn",
+ "releaseTypes": [ "Album" ],
+ "releaseStatus": "Official",
+ "totalDiscs": 1,
+ "totalTracks": 12,
+ "releaseTitle": "A Night at the Opera"
+ },
+ "mediaFormat": "CD",
+ "packaging": "JewelCase",
+ "barcode": "0042282778329",
+ "catalogNumbers": ["EMC 4008"],
+ "label": "EMI",
+ "asin": "B000000000",
+ "musicBrainzReleaseId": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
+ "musicBrainzReleaseGroupId": "b2c3d4e5-f6a7-4b8c-9d0e-1f2a3b4c5d6e",
+ "musicBrainzReleaseArtistId": "c3d4e5f6-a7b8-4c9d-0e1f-2a3b4c5d6e7f",
+ "createdOnUtc": "2025-01-01T12:00:00.0000000Z",
+ "updatedOnUtc": "2025-01-20T14:45:00.0000000Z",
+ "contributors": [
+ {
+ "contributorId": "0e7b4a6c-5f8d-6b9e-ca0b-3c4d5e6f7a8b",
+ "role": "Producer"
+ },
+ {
+ "contributorId": "1a8c5b7d-6a9e-7c0f-db1c-4d5e6f7a8b9c",
+ "role": "Engineer"
+ }
+ ],
+ "ratings": [
+ {
+ "value": 4.5,
+ "maxValue": 5,
+ "source": "MusicBrainz",
+ "voteCount": 2345
+ },
+ {
+ "value": 4.8,
+ "maxValue": 5,
+ "source": "LastFm",
+ "voteCount": 1234
+ }
+ ],
+ "tracks": [
+ {
+ "id": "9f0e1d2c-3b4a-4c6d-8e7f-9a0b1c2d3e4f",
+ "albumId": "e8d52f7b-0a3c-4c2d-ab4f-8a7b6c5d4e3f",
+ "libraryId": "3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a",
+ "path": "/music/queen/a-night-at-the-opera/01-bohemian-rhapsody.flac",
+ "metadata": {
+ "title": "Bohemian Rhapsody",
+ "originalTitle": "Bohemian Rhapsody",
+ "description": "A song by the British rock band Queen. It was written by Freddie Mercury and originally released on the album A Night at the Opera in 1975.",
+ "disambiguation": "album version",
+ "releaseInfo": { "originalReleaseDate": "1975-10-31", "originalReleaseYear": 1975, "reReleaseDate": "2011-11-21", "reReleaseYear": 2011, "releaseCountry": "GB", "releaseVersion": "Original" },
+ "language": { "languageCode": "en", "languageName": "English", "nativeName": "English" },
+ "originalLanguage": { "languageCode": "en", "languageName": "English", "nativeName": "English" },
+ "tags": [ { "name": "classic" }, { "name": "epic" } ],
+ "genres": [ { "name": "Rock" }, { "name": "Progressive Rock" } ],
+ "isVideo": false,
+ "durationInSeconds": 354,
+ "sampleRate": 44100,
+ "channels": 2,
+ "bitDepth": 16,
+ "audioCodec": "FLAC",
+ "bitrate": 980,
+ "acoustId": "f0e1d2c3-b4a5-4c6d-8e7f-9a0b1c2d3e4f",
+ "replayGainTrackGain": -7.5,
+ "replayGainTrackPeak": 0.9877,
+ "replayGainAlbumGain": -6.8,
+ "replayGainAlbumPeak": 0.9999
+ },
+ "trackNumber": 1,
+ "discNumber": 1,
+ "script": "Latn",
+ "key": "CMajor",
+ "bpm": 72,
+ "work": {
+ "musicBrainzWorkId": "f6a7b8c9-d0e1-4f2a-3b4c-5d6e7f8a9b0c",
+ "title": "Bohemian Rhapsody",
+ "type": "Song",
+ "languages": [
+ { "languageCode": "en", "languageName": "English", "nativeName": "English" }
+ ],
+ "iswcs": ["T-010489707-6"]
+ },
+ "musicBrainzRecordingId": "d4e5f6a7-b8c9-4d0e-1f2a-3b4c5d6e7f8a",
+ "musicBrainzTrackId": "e5f6a7b8-c9d0-4e1f-2a3b-4c5d6e7f8a9b",
+ "createdOnUtc": "2025-01-01T12:00:00.0000000Z",
+ "updatedOnUtc": "2025-01-20T14:45:00.0000000Z",
+ "moods": [
+ { "name": "dramatic" },
+ { "name": "anxious" }
+ ],
+ "isrcs": [
+ { "value": "GBUM71029604" }
+ ],
+ "contributors": [
+ {
+ "contributorId": "6a3f0c2d-1b4e-4f5a-8c6d-9e0f1a2b3c4d",
+ "role": "Vocals"
+ },
+ {
+ "contributorId": "7b4e1d3f-2c5a-4e6b-9d7e-0f1a2b3c4d5e",
+ "role": "Guitar"
+ }
+ ],
+ "ratings": [
+ {
+ "value": 4.5,
+ "maxValue": 5,
+ "source": "MusicBrainz",
+ "voteCount": 2345
+ },
+ {
+ "value": 4.8,
+ "maxValue": 5,
+ "source": "LastFm",
+ "voteCount": 1234
+ }
+ ]
+ },
+ {
+ "id": "8e1f2a3b-4c5d-4e6f-8a9b-0c1d2e3f4a5b",
+ "albumId": "e8d52f7b-0a3c-4c2d-ab4f-8a7b6c5d4e3f",
+ "libraryId": "3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a",
+ "path": "/music/queen/a-night-at-the-opera/07-youre-my-best-friend.flac",
+ "metadata": {
+ "title": "You're My Best Friend",
+ "originalTitle": "You're My Best Friend",
+ "description": "A song by the British rock band Queen, written by bass guitarist John Deacon. It was originally released on the album A Night at the Opera in 1975 and as a single in 1976.",
+ "disambiguation": "album version",
+ "releaseInfo": { "originalReleaseDate": "1976-06-18", "originalReleaseYear": 1976, "reReleaseDate": "2011-11-21", "reReleaseYear": 2011, "releaseCountry": "GB", "releaseVersion": "Original" },
+ "language": { "languageCode": "en", "languageName": "English", "nativeName": "English" },
+ "originalLanguage": { "languageCode": "en", "languageName": "English", "nativeName": "English" },
+ "tags": [ { "name": "classic" }, { "name": "love" } ],
+ "genres": [ { "name": "Rock" }, { "name": "Pop Rock" } ],
+ "isVideo": false,
+ "durationInSeconds": 181,
+ "sampleRate": 44100,
+ "channels": 2,
+ "bitDepth": 16,
+ "audioCodec": "FLAC",
+ "bitrate": 912,
+ "acoustId": "0a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d",
+ "replayGainTrackGain": -7.2,
+ "replayGainTrackPeak": 0.9812,
+ "replayGainAlbumGain": -6.5,
+ "replayGainAlbumPeak": 0.9987
+ },
+ "trackNumber": 7,
+ "discNumber": 1,
+ "script": "Latn",
+ "key": "BMajor",
+ "bpm": 118,
+ "work": {
+ "musicBrainzWorkId": "2b3c4d5e-6f7a-4b8c-9d0e-1f2a3b4c5d6e",
+ "title": "You're My Best Friend",
+ "type": "Song",
+ "languages": [
+ { "languageCode": "en", "languageName": "English", "nativeName": "English" }
+ ],
+ "iswcs": ["T-010489707-6"]
+ },
+ "musicBrainzRecordingId": "0f3e4d5c-6b7a-4f8e-9d0c-1b2a3c4d5e6f",
+ "musicBrainzTrackId": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
+ "createdOnUtc": "2025-01-01T12:00:00.0000000Z",
+ "updatedOnUtc": "2025-01-20T14:45:00.0000000Z",
+ "moods": [
+ { "name": "happy" },
+ { "name": "warm" }
+ ],
+ "isrcs": [
+ { "value": "GBUM71029609" }
+ ],
+ "contributors": [
+ {
+ "contributorId": "6a3f0c2d-1b4e-4f5a-8c6d-9e0f1a2b3c4d",
+ "role": "Vocals"
+ },
+ {
+ "contributorId": "7b4e1d3f-2c5a-4e6b-9d7e-0f1a2b3c4d5e",
+ "role": "Guitar"
+ }
+ ],
+ "ratings": [
+ {
+ "value": 4.2,
+ "maxValue": 5,
+ "source": "MusicBrainz",
+ "voteCount": 1234
+ },
+ {
+ "value": 4.4,
+ "maxValue": 5,
+ "source": "LastFm",
+ "voteCount": 567
+ }
+ ]
+ }
+ ],
+ "coverPath": "/media/music/Queen-3b3a19f3/A Night at the Opera-e8d52f7b/cover.jpg",
+ "artwork": [
+ {
+ "type": "Cover",
+ "ordinal": 0,
+ "path": "/media/music/Queen-3b3a19f3/A Night at the Opera-e8d52f7b/cover.jpg"
+ }
+ ]
+ }
+ ],
+ "coverPath": "/media/music/Queen-3b3a19f3/cover.jpg"
}
],
"currentPage": 1,
@@ -712,7 +1043,7 @@ GET api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists?currentPage=1&
#### Get Artists Lite Request
```js
-GET api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/lite?currentPage=1&perPage=10&searchTerm=queen
+GET api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/lite?currentPage=1&perPage=10&searchTerm=queen&filterAlphaKey=q&shouldIgnoreThePrefixForAlphaPicker=true&sortBy=name&sortOrder=Ascending
```
| Query Parameter | Type | Description |
@@ -720,6 +1051,10 @@ GET api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/lite?currentPa
| `currentPage` | `int` | Optional. The page of results to retrieve. |
| `perPage` | `int` | Optional. The maximum number of artists to retrieve per page. |
| `searchTerm` | `string` | Optional. The search term used to filter the artists by name. |
+| `filterAlphaKey` | `string` | Optional. Filters results by the first character of their name. A single ASCII letter (case-insensitive), `#` for names starting with a digit, or `*` for names starting with any other character. |
+| `shouldIgnoreThePrefixForAlphaPicker` | `bool` | Whether the leading "The " prefix of a name should be ignored when computing the alpha key. |
+| `sortBy` | `string` | Optional. The name of the field by which to sort the results. |
+| `sortOrder` | `string` | Optional. The direction in which to sort the results (`Ascending` or `Descending`). |
#### Get Artists Lite Response
@@ -732,7 +1067,8 @@ GET api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/lite?currentPa
"data": [
{
"id": "d7c41e6a-9f2b-4b1c-9a3e-7f6e5d4c3b2a",
- "name": "Queen"
+ "name": "Queen",
+ "coverPath": "/media/music/Queen-3b3a19f3/cover.jpg"
}
],
"currentPage": 1,
@@ -764,22 +1100,36 @@ GET api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/{artistId}
"metadata": {
"name": "Queen",
"sortName": "Queen",
- "disambiguation": null,
+ "disambiguation": "British rock band",
"type": "Group",
- "gender": null,
+ "gender": "NotApplicable",
"country": "GB",
"area": {
"musicBrainzAreaId": "7f2a1b3c-4d5e-4f6a-8b9c-0d1e2f3a4b5c",
"name": "United Kingdom",
"sortName": "United Kingdom",
- "disambiguation": null,
+ "disambiguation": "sovereign state",
+ "type": "Country",
+ "iso3166Code": "GB"
+ },
+ "beginArea": {
+ "musicBrainzAreaId": "7f2a1b3c-4d5e-4f6a-8b9c-0d1e2f3a4b5c",
+ "name": "United Kingdom",
+ "sortName": "United Kingdom",
+ "disambiguation": "sovereign state",
+ "type": "Country",
+ "iso3166Code": "GB"
+ },
+ "endArea": {
+ "musicBrainzAreaId": "7f2a1b3c-4d5e-4f6a-8b9c-0d1e2f3a4b5c",
+ "name": "United Kingdom",
+ "sortName": "United Kingdom",
+ "disambiguation": "sovereign state",
"type": "Country",
"iso3166Code": "GB"
},
- "beginArea": null,
- "endArea": null,
"lifeSpanBegin": "1970-06-27",
- "lifeSpanEnd": null,
+ "lifeSpanEnd": "1991-11-24",
"isEnded": false,
"genres": [
{ "name": "Rock" }
@@ -795,17 +1145,17 @@ GET api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/{artistId}
"locale": "en",
"isPrimary": true,
"beginDate": "1970-06-27",
- "endDate": null,
+ "endDate": "1991-11-24",
"isEnded": false
}
]
},
"website": "https://www.queenonline.com",
"musicBrainzArtistId": "6f9c0b2a-1d3e-4a5b-8c7d-9e0f1a2b3c4d",
- "ipis": [],
- "isnis": [],
+ "ipis": ["00012345678"],
+ "isnis": ["0000000123456789"],
"createdOnUtc": "2025-01-01T12:00:00.0000000Z",
- "updatedOnUtc": null,
+ "updatedOnUtc": "2025-01-20T14:45:00.0000000Z",
"contributors": [
{ "contributorId": "6a3f0c2d-1b4e-4f5a-8c6d-9e0f1a2b3c4d", "role": "Vocals" },
{ "contributorId": "7b4e1d3f-2c5a-4e6b-9d7e-0f1a2b3c4d5e", "role": "Guitar" }
@@ -818,7 +1168,253 @@ GET api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/{artistId}
"voteCount": 2345
}
],
- "albums": []
+ "albums": [
+ {
+ "id": "e8d52f7b-0a3c-4c2d-ab4f-8a7b6c5d4e3f",
+ "artistId": "d7c41e6a-9f2b-4b1c-9a3e-7f6e5d4c3b2a",
+ "libraryId": "3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a",
+ "metadata": {
+ "title": "A Night at the Opera",
+ "originalTitle": "A Night at the Opera",
+ "description": "The fourth studio album by the British rock band Queen, released in 1975. It was the most expensive album ever recorded at the time of its release.",
+ "disambiguation": "original release",
+ "releaseInfo": {
+ "originalReleaseDate": "1975-11-21",
+ "originalReleaseYear": 1975,
+ "reReleaseDate": "2011-11-21",
+ "reReleaseYear": 2011,
+ "releaseCountry": "GB",
+ "releaseVersion": "Remastered"
+ },
+ "language": {
+ "languageCode": "en",
+ "languageName": "English",
+ "nativeName": "English"
+ },
+ "originalLanguage": {
+ "languageCode": "en",
+ "languageName": "English",
+ "nativeName": "English"
+ },
+ "tags": [
+ { "name": "classic" },
+ { "name": "vinyl" }
+ ],
+ "genres": [
+ { "name": "Rock" },
+ { "name": "Progressive Rock" }
+ ],
+ "script": "Latn",
+ "releaseTypes": [ "Album" ],
+ "releaseStatus": "Official",
+ "totalDiscs": 1,
+ "totalTracks": 12,
+ "releaseTitle": "A Night at the Opera"
+ },
+ "mediaFormat": "CD",
+ "packaging": "JewelCase",
+ "barcode": "0042282778329",
+ "catalogNumbers": ["EMC 4008"],
+ "label": "EMI",
+ "asin": "B000000000",
+ "musicBrainzReleaseId": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
+ "musicBrainzReleaseGroupId": "b2c3d4e5-f6a7-4b8c-9d0e-1f2a3b4c5d6e",
+ "musicBrainzReleaseArtistId": "c3d4e5f6-a7b8-4c9d-0e1f-2a3b4c5d6e7f",
+ "createdOnUtc": "2025-01-01T12:00:00.0000000Z",
+ "updatedOnUtc": "2025-01-20T14:45:00.0000000Z",
+ "contributors": [
+ {
+ "contributorId": "0e7b4a6c-5f8d-6b9e-ca0b-3c4d5e6f7a8b",
+ "role": "Producer"
+ },
+ {
+ "contributorId": "1a8c5b7d-6a9e-7c0f-db1c-4d5e6f7a8b9c",
+ "role": "Engineer"
+ }
+ ],
+ "ratings": [
+ {
+ "value": 4.5,
+ "maxValue": 5,
+ "source": "MusicBrainz",
+ "voteCount": 2345
+ },
+ {
+ "value": 4.8,
+ "maxValue": 5,
+ "source": "LastFm",
+ "voteCount": 1234
+ }
+ ],
+ "tracks": [
+ {
+ "id": "9f0e1d2c-3b4a-4c6d-8e7f-9a0b1c2d3e4f",
+ "albumId": "e8d52f7b-0a3c-4c2d-ab4f-8a7b6c5d4e3f",
+ "libraryId": "3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a",
+ "path": "/music/queen/a-night-at-the-opera/01-bohemian-rhapsody.flac",
+ "metadata": {
+ "title": "Bohemian Rhapsody",
+ "originalTitle": "Bohemian Rhapsody",
+ "description": "A song by the British rock band Queen. It was written by Freddie Mercury and originally released on the album A Night at the Opera in 1975.",
+ "disambiguation": "album version",
+ "releaseInfo": { "originalReleaseDate": "1975-10-31", "originalReleaseYear": 1975, "reReleaseDate": "2011-11-21", "reReleaseYear": 2011, "releaseCountry": "GB", "releaseVersion": "Original" },
+ "language": { "languageCode": "en", "languageName": "English", "nativeName": "English" },
+ "originalLanguage": { "languageCode": "en", "languageName": "English", "nativeName": "English" },
+ "tags": [ { "name": "classic" }, { "name": "epic" } ],
+ "genres": [ { "name": "Rock" }, { "name": "Progressive Rock" } ],
+ "isVideo": false,
+ "durationInSeconds": 354,
+ "sampleRate": 44100,
+ "channels": 2,
+ "bitDepth": 16,
+ "audioCodec": "FLAC",
+ "bitrate": 980,
+ "acoustId": "f0e1d2c3-b4a5-4c6d-8e7f-9a0b1c2d3e4f",
+ "replayGainTrackGain": -7.5,
+ "replayGainTrackPeak": 0.9877,
+ "replayGainAlbumGain": -6.8,
+ "replayGainAlbumPeak": 0.9999
+ },
+ "trackNumber": 1,
+ "discNumber": 1,
+ "script": "Latn",
+ "key": "CMajor",
+ "bpm": 72,
+ "work": {
+ "musicBrainzWorkId": "f6a7b8c9-d0e1-4f2a-3b4c-5d6e7f8a9b0c",
+ "title": "Bohemian Rhapsody",
+ "type": "Song",
+ "languages": [
+ { "languageCode": "en", "languageName": "English", "nativeName": "English" }
+ ],
+ "iswcs": ["T-010489707-6"]
+ },
+ "musicBrainzRecordingId": "d4e5f6a7-b8c9-4d0e-1f2a-3b4c5d6e7f8a",
+ "musicBrainzTrackId": "e5f6a7b8-c9d0-4e1f-2a3b-4c5d6e7f8a9b",
+ "createdOnUtc": "2025-01-01T12:00:00.0000000Z",
+ "updatedOnUtc": "2025-01-20T14:45:00.0000000Z",
+ "moods": [
+ { "name": "dramatic" },
+ { "name": "anxious" }
+ ],
+ "isrcs": [
+ { "value": "GBUM71029604" }
+ ],
+ "contributors": [
+ {
+ "contributorId": "6a3f0c2d-1b4e-4f5a-8c6d-9e0f1a2b3c4d",
+ "role": "Vocals"
+ },
+ {
+ "contributorId": "7b4e1d3f-2c5a-4e6b-9d7e-0f1a2b3c4d5e",
+ "role": "Guitar"
+ }
+ ],
+ "ratings": [
+ {
+ "value": 4.5,
+ "maxValue": 5,
+ "source": "MusicBrainz",
+ "voteCount": 2345
+ },
+ {
+ "value": 4.8,
+ "maxValue": 5,
+ "source": "LastFm",
+ "voteCount": 1234
+ }
+ ]
+ },
+ {
+ "id": "8e1f2a3b-4c5d-4e6f-8a9b-0c1d2e3f4a5b",
+ "albumId": "e8d52f7b-0a3c-4c2d-ab4f-8a7b6c5d4e3f",
+ "libraryId": "3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a",
+ "path": "/music/queen/a-night-at-the-opera/07-youre-my-best-friend.flac",
+ "metadata": {
+ "title": "You're My Best Friend",
+ "originalTitle": "You're My Best Friend",
+ "description": "A song by the British rock band Queen, written by bass guitarist John Deacon. It was originally released on the album A Night at the Opera in 1975 and as a single in 1976.",
+ "disambiguation": "album version",
+ "releaseInfo": { "originalReleaseDate": "1976-06-18", "originalReleaseYear": 1976, "reReleaseDate": "2011-11-21", "reReleaseYear": 2011, "releaseCountry": "GB", "releaseVersion": "Original" },
+ "language": { "languageCode": "en", "languageName": "English", "nativeName": "English" },
+ "originalLanguage": { "languageCode": "en", "languageName": "English", "nativeName": "English" },
+ "tags": [ { "name": "classic" }, { "name": "love" } ],
+ "genres": [ { "name": "Rock" }, { "name": "Pop Rock" } ],
+ "isVideo": false,
+ "durationInSeconds": 181,
+ "sampleRate": 44100,
+ "channels": 2,
+ "bitDepth": 16,
+ "audioCodec": "FLAC",
+ "bitrate": 912,
+ "acoustId": "0a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d",
+ "replayGainTrackGain": -7.2,
+ "replayGainTrackPeak": 0.9812,
+ "replayGainAlbumGain": -6.5,
+ "replayGainAlbumPeak": 0.9987
+ },
+ "trackNumber": 7,
+ "discNumber": 1,
+ "script": "Latn",
+ "key": "BMajor",
+ "bpm": 118,
+ "work": {
+ "musicBrainzWorkId": "2b3c4d5e-6f7a-4b8c-9d0e-1f2a3b4c5d6e",
+ "title": "You're My Best Friend",
+ "type": "Song",
+ "languages": [
+ { "languageCode": "en", "languageName": "English", "nativeName": "English" }
+ ],
+ "iswcs": ["T-010489707-6"]
+ },
+ "musicBrainzRecordingId": "0f3e4d5c-6b7a-4f8e-9d0c-1b2a3c4d5e6f",
+ "musicBrainzTrackId": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
+ "createdOnUtc": "2025-01-01T12:00:00.0000000Z",
+ "updatedOnUtc": "2025-01-20T14:45:00.0000000Z",
+ "moods": [
+ { "name": "happy" },
+ { "name": "warm" }
+ ],
+ "isrcs": [
+ { "value": "GBUM71029609" }
+ ],
+ "contributors": [
+ {
+ "contributorId": "6a3f0c2d-1b4e-4f5a-8c6d-9e0f1a2b3c4d",
+ "role": "Vocals"
+ },
+ {
+ "contributorId": "7b4e1d3f-2c5a-4e6b-9d7e-0f1a2b3c4d5e",
+ "role": "Guitar"
+ }
+ ],
+ "ratings": [
+ {
+ "value": 4.2,
+ "maxValue": 5,
+ "source": "MusicBrainz",
+ "voteCount": 1234
+ },
+ {
+ "value": 4.4,
+ "maxValue": 5,
+ "source": "LastFm",
+ "voteCount": 567
+ }
+ ]
+ }
+ ],
+ "coverPath": "/media/music/Queen-3b3a19f3/A Night at the Opera-e8d52f7b/cover.jpg",
+ "artwork": [
+ {
+ "type": "Cover",
+ "ordinal": 0,
+ "path": "/media/music/Queen-3b3a19f3/A Night at the Opera-e8d52f7b/cover.jpg"
+ }
+ ]
+ }
+ ],
+ "coverPath": "/media/music/Queen-3b3a19f3/cover.jpg"
}
```
@@ -836,22 +1432,36 @@ PUT api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/{artistId}
"metadata": {
"name": "Queen",
"sortName": "Queen",
- "disambiguation": null,
+ "disambiguation": "British rock band",
"type": "Group",
- "gender": null,
+ "gender": "NotApplicable",
"country": "GB",
"area": {
"musicBrainzAreaId": "7f2a1b3c-4d5e-4f6a-8b9c-0d1e2f3a4b5c",
"name": "United Kingdom",
"sortName": "United Kingdom",
- "disambiguation": null,
+ "disambiguation": "sovereign state",
+ "type": "Country",
+ "iso3166Code": "GB"
+ },
+ "beginArea": {
+ "musicBrainzAreaId": "7f2a1b3c-4d5e-4f6a-8b9c-0d1e2f3a4b5c",
+ "name": "United Kingdom",
+ "sortName": "United Kingdom",
+ "disambiguation": "sovereign state",
+ "type": "Country",
+ "iso3166Code": "GB"
+ },
+ "endArea": {
+ "musicBrainzAreaId": "7f2a1b3c-4d5e-4f6a-8b9c-0d1e2f3a4b5c",
+ "name": "United Kingdom",
+ "sortName": "United Kingdom",
+ "disambiguation": "sovereign state",
"type": "Country",
"iso3166Code": "GB"
},
- "beginArea": null,
- "endArea": null,
"lifeSpanBegin": "1970-06-27",
- "lifeSpanEnd": null,
+ "lifeSpanEnd": "1991-11-24",
"isEnded": false,
"genres": [
{ "name": "Rock" }
@@ -867,15 +1477,15 @@ PUT api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/{artistId}
"locale": "en",
"isPrimary": true,
"beginDate": "1970-06-27",
- "endDate": null,
+ "endDate": "1991-11-24",
"isEnded": false
}
]
},
"website": "https://www.queenonline.com",
"musicBrainzArtistId": "6f9c0b2a-1d3e-4a5b-8c7d-9e0f1a2b3c4d",
- "ipis": [],
- "isnis": [],
+ "ipis": ["00012345678"],
+ "isnis": ["0000000123456789"],
"contributors": [
{ "contributorId": "6a3f0c2d-1b4e-4f5a-8c6d-9e0f1a2b3c4d", "role": "Vocals" },
{ "contributorId": "7b4e1d3f-2c5a-4e6b-9d7e-0f1a2b3c4d5e", "role": "Guitar" }
@@ -895,12 +1505,12 @@ PUT api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/{artistId}
"title": "A Night at the Opera",
"originalTitle": "A Night at the Opera",
"description": "The fourth studio album by the British rock band Queen, released in 1975. It was the most expensive album ever recorded at the time of its release.",
- "disambiguation": null,
+ "disambiguation": "original release",
"releaseInfo": {
"originalReleaseDate": "1975-11-21",
"originalReleaseYear": 1975,
- "reReleaseDate": null,
- "reReleaseYear": null,
+ "reReleaseDate": "2011-11-21",
+ "reReleaseYear": 2011,
"releaseCountry": "GB",
"releaseVersion": "Remastered"
},
@@ -964,12 +1574,12 @@ PUT api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/{artistId}
"title": "Bohemian Rhapsody",
"originalTitle": "Bohemian Rhapsody",
"description": "A song by the British rock band Queen. It was written by Freddie Mercury and originally released on the album A Night at the Opera in 1975.",
- "disambiguation": null,
+ "disambiguation": "album version",
"releaseInfo": {
"originalReleaseDate": "1975-10-31",
"originalReleaseYear": 1975,
- "reReleaseDate": null,
- "reReleaseYear": null,
+ "reReleaseDate": "2011-11-21",
+ "reReleaseYear": 2011,
"releaseCountry": "GB",
"releaseVersion": "Original"
},
@@ -1016,7 +1626,7 @@ PUT api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/{artistId}
"languages": [
{ "languageCode": "en", "languageName": "English", "nativeName": "English" }
],
- "iswcs": []
+ "iswcs": ["T-010489707-6"]
},
"musicBrainzRecordingId": "d4e5f6a7-b8c9-4d0e-1f2a-3b4c5d6e7f8a",
"musicBrainzTrackId": "e5f6a7b8-c9d0-4e1f-2a3b-4c5d6e7f8a9b",
@@ -1053,12 +1663,12 @@ PUT api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/{artistId}
"title": "You're My Best Friend",
"originalTitle": "You're My Best Friend",
"description": "A song by the British rock band Queen, written by bass guitarist John Deacon. It was originally released on the album A Night at the Opera in 1975 and as a single in 1976.",
- "disambiguation": null,
+ "disambiguation": "album version",
"releaseInfo": {
"originalReleaseDate": "1976-06-18",
"originalReleaseYear": 1976,
- "reReleaseDate": null,
- "reReleaseYear": null,
+ "reReleaseDate": "2011-11-21",
+ "reReleaseYear": 2011,
"releaseCountry": "GB",
"releaseVersion": "Original"
},
@@ -1087,11 +1697,11 @@ PUT api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/{artistId}
"bitDepth": 16,
"audioCodec": "FLAC",
"bitrate": 912,
- "acoustId": null,
- "replayGainTrackGain": null,
- "replayGainTrackPeak": null,
- "replayGainAlbumGain": null,
- "replayGainAlbumPeak": null
+ "acoustId": "0a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d",
+ "replayGainTrackGain": -7.2,
+ "replayGainTrackPeak": 0.9812,
+ "replayGainAlbumGain": -6.5,
+ "replayGainAlbumPeak": 0.9987
},
"trackNumber": 7,
"discNumber": 1,
@@ -1105,7 +1715,7 @@ PUT api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/{artistId}
"languages": [
{ "languageCode": "en", "languageName": "English", "nativeName": "English" }
],
- "iswcs": []
+ "iswcs": ["T-010489707-6"]
},
"musicBrainzRecordingId": "0f3e4d5c-6b7a-4f8e-9d0c-1b2a3c4d5e6f",
"musicBrainzTrackId": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
@@ -1154,22 +1764,36 @@ PUT api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/{artistId}
"metadata": {
"name": "Queen",
"sortName": "Queen",
- "disambiguation": null,
+ "disambiguation": "British rock band",
"type": "Group",
- "gender": null,
+ "gender": "NotApplicable",
"country": "GB",
"area": {
"musicBrainzAreaId": "7f2a1b3c-4d5e-4f6a-8b9c-0d1e2f3a4b5c",
"name": "United Kingdom",
"sortName": "United Kingdom",
- "disambiguation": null,
+ "disambiguation": "sovereign state",
+ "type": "Country",
+ "iso3166Code": "GB"
+ },
+ "beginArea": {
+ "musicBrainzAreaId": "7f2a1b3c-4d5e-4f6a-8b9c-0d1e2f3a4b5c",
+ "name": "United Kingdom",
+ "sortName": "United Kingdom",
+ "disambiguation": "sovereign state",
+ "type": "Country",
+ "iso3166Code": "GB"
+ },
+ "endArea": {
+ "musicBrainzAreaId": "7f2a1b3c-4d5e-4f6a-8b9c-0d1e2f3a4b5c",
+ "name": "United Kingdom",
+ "sortName": "United Kingdom",
+ "disambiguation": "sovereign state",
"type": "Country",
"iso3166Code": "GB"
},
- "beginArea": null,
- "endArea": null,
"lifeSpanBegin": "1970-06-27",
- "lifeSpanEnd": null,
+ "lifeSpanEnd": "1991-11-24",
"isEnded": false,
"genres": [
{ "name": "Rock" }
@@ -1185,15 +1809,15 @@ PUT api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/{artistId}
"locale": "en",
"isPrimary": true,
"beginDate": "1970-06-27",
- "endDate": null,
+ "endDate": "1991-11-24",
"isEnded": false
}
]
},
"website": "https://www.queenonline.com",
"musicBrainzArtistId": "6f9c0b2a-1d3e-4a5b-8c7d-9e0f1a2b3c4d",
- "ipis": [],
- "isnis": [],
+ "ipis": ["00012345678"],
+ "isnis": ["0000000123456789"],
"createdOnUtc": "2025-01-01T12:00:00.0000000Z",
"updatedOnUtc": "2025-02-01T12:00:00.0000000Z",
"contributors": [
@@ -1217,12 +1841,12 @@ PUT api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/{artistId}
"title": "A Night at the Opera",
"originalTitle": "A Night at the Opera",
"description": "The fourth studio album by the British rock band Queen, released in 1975. It was the most expensive album ever recorded at the time of its release.",
- "disambiguation": null,
+ "disambiguation": "original release",
"releaseInfo": {
"originalReleaseDate": "1975-11-21",
"originalReleaseYear": 1975,
- "reReleaseDate": null,
- "reReleaseYear": null,
+ "reReleaseDate": "2011-11-21",
+ "reReleaseYear": 2011,
"releaseCountry": "GB",
"releaseVersion": "Remastered"
},
@@ -1261,7 +1885,7 @@ PUT api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/{artistId}
"musicBrainzReleaseGroupId": "b2c3d4e5-f6a7-4b8c-9d0e-1f2a3b4c5d6e",
"musicBrainzReleaseArtistId": "c3d4e5f6-a7b8-4c9d-0e1f-2a3b4c5d6e7f",
"createdOnUtc": "2025-01-01T12:00:00.0000000Z",
- "updatedOnUtc": null,
+ "updatedOnUtc": "2025-01-20T14:45:00.0000000Z",
"contributors": [
{
"contributorId": "0e7b4a6c-5f8d-6b9e-ca0b-3c4d5e6f7a8b",
@@ -1296,8 +1920,8 @@ PUT api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/{artistId}
"title": "Bohemian Rhapsody",
"originalTitle": "Bohemian Rhapsody",
"description": "A song by the British rock band Queen. It was written by Freddie Mercury and originally released on the album A Night at the Opera in 1975.",
- "disambiguation": null,
- "releaseInfo": { "originalReleaseDate": "1975-10-31", "originalReleaseYear": 1975, "reReleaseDate": null, "reReleaseYear": null, "releaseCountry": "GB", "releaseVersion": "Original" },
+ "disambiguation": "album version",
+ "releaseInfo": { "originalReleaseDate": "1975-10-31", "originalReleaseYear": 1975, "reReleaseDate": "2011-11-21", "reReleaseYear": 2011, "releaseCountry": "GB", "releaseVersion": "Original" },
"language": { "languageCode": "en", "languageName": "English", "nativeName": "English" },
"originalLanguage": { "languageCode": "en", "languageName": "English", "nativeName": "English" },
"tags": [ { "name": "classic" }, { "name": "epic" } ],
@@ -1327,12 +1951,12 @@ PUT api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/{artistId}
"languages": [
{ "languageCode": "en", "languageName": "English", "nativeName": "English" }
],
- "iswcs": []
+ "iswcs": ["T-010489707-6"]
},
"musicBrainzRecordingId": "d4e5f6a7-b8c9-4d0e-1f2a-3b4c5d6e7f8a",
"musicBrainzTrackId": "e5f6a7b8-c9d0-4e1f-2a3b-4c5d6e7f8a9b",
"createdOnUtc": "2025-01-01T12:00:00.0000000Z",
- "updatedOnUtc": null,
+ "updatedOnUtc": "2025-01-20T14:45:00.0000000Z",
"moods": [
{ "name": "dramatic" },
{ "name": "anxious" }
@@ -1374,8 +1998,8 @@ PUT api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/{artistId}
"title": "You're My Best Friend",
"originalTitle": "You're My Best Friend",
"description": "A song by the British rock band Queen, written by bass guitarist John Deacon. It was originally released on the album A Night at the Opera in 1975 and as a single in 1976.",
- "disambiguation": null,
- "releaseInfo": { "originalReleaseDate": "1976-06-18", "originalReleaseYear": 1976, "reReleaseDate": null, "reReleaseYear": null, "releaseCountry": "GB", "releaseVersion": "Original" },
+ "disambiguation": "album version",
+ "releaseInfo": { "originalReleaseDate": "1976-06-18", "originalReleaseYear": 1976, "reReleaseDate": "2011-11-21", "reReleaseYear": 2011, "releaseCountry": "GB", "releaseVersion": "Original" },
"language": { "languageCode": "en", "languageName": "English", "nativeName": "English" },
"originalLanguage": { "languageCode": "en", "languageName": "English", "nativeName": "English" },
"tags": [ { "name": "classic" }, { "name": "love" } ],
@@ -1387,11 +2011,11 @@ PUT api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/{artistId}
"bitDepth": 16,
"audioCodec": "FLAC",
"bitrate": 912,
- "acoustId": null,
- "replayGainTrackGain": null,
- "replayGainTrackPeak": null,
- "replayGainAlbumGain": null,
- "replayGainAlbumPeak": null
+ "acoustId": "0a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d",
+ "replayGainTrackGain": -7.2,
+ "replayGainTrackPeak": 0.9812,
+ "replayGainAlbumGain": -6.5,
+ "replayGainAlbumPeak": 0.9987
},
"trackNumber": 7,
"discNumber": 1,
@@ -1405,12 +2029,12 @@ PUT api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/{artistId}
"languages": [
{ "languageCode": "en", "languageName": "English", "nativeName": "English" }
],
- "iswcs": []
+ "iswcs": ["T-010489707-6"]
},
"musicBrainzRecordingId": "0f3e4d5c-6b7a-4f8e-9d0c-1b2a3c4d5e6f",
"musicBrainzTrackId": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
"createdOnUtc": "2025-01-01T12:00:00.0000000Z",
- "updatedOnUtc": null,
+ "updatedOnUtc": "2025-01-20T14:45:00.0000000Z",
"moods": [
{ "name": "happy" },
{ "name": "warm" }
@@ -1443,9 +2067,48 @@ PUT api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/{artistId}
}
]
}
+ ],
+ "coverPath": "/media/music/Queen-3b3a19f3/A Night at the Opera-e8d52f7b/cover.jpg",
+ "artwork": [
+ {
+ "type": "Cover",
+ "ordinal": 0,
+ "path": "/media/music/Queen-3b3a19f3/A Night at the Opera-e8d52f7b/cover.jpg"
+ }
]
}
- ]
+ ],
+ "coverPath": "/media/music/Queen-3b3a19f3/cover.jpg"
+}
+```
+
+### Update Artist Cover
+
+Updates the cover image of the artist identified by `artistId` with the image uploaded in the multipart form of the request. The artist must belong to the media library identified by `libraryId`, and the uploaded file must be an image.
+
+#### Update Artist Cover Request
+
+```js
+PUT api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/{artistId}/cover
+Content-Type: multipart/form-data; boundary=LuminaBoundary
+
+--LuminaBoundary
+Content-Disposition: form-data; name="cover"; filename="cover.jpg"
+Content-Type: image/jpeg
+
+< ./cover.jpg
+--LuminaBoundary--
+```
+
+#### Update Artist Cover Response
+
+```js
+200 Ok
+```
+
+```json
+{
+ "coverPath": "/media/music/music-3f2504e0-4f89-41d3-9a0c-0305e82c3301/Queen-2b0e5f5a-0b3f-4b7e-8f4a-8c9e3d2f5a6b/cover.jpg"
}
```
diff --git a/docs/technical/api/library/audio-library/music-library/Api.Tracks.md b/docs/technical/api/library/audio-library/music-library/Api.Tracks.md
index bdb6e2d9..4cf0d71c 100644
--- a/docs/technical/api/library/audio-library/music-library/Api.Tracks.md
+++ b/docs/technical/api/library/audio-library/music-library/Api.Tracks.md
@@ -30,12 +30,12 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b
"title": "Bohemian Rhapsody",
"originalTitle": "Bohemian Rhapsody",
"description": "A song by the British rock band Queen. It was written by Freddie Mercury and originally released on the album A Night at the Opera in 1975.",
- "disambiguation": null,
+ "disambiguation": "album version",
"releaseInfo": {
"originalReleaseDate": "1975-10-31",
"originalReleaseYear": 1975,
- "reReleaseDate": null,
- "reReleaseYear": null,
+ "reReleaseDate": "2011-11-21",
+ "reReleaseYear": 2011,
"releaseCountry": "GB",
"releaseVersion": "Original"
},
@@ -82,7 +82,7 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b
"languages": [
{ "languageCode": "en", "languageName": "English", "nativeName": "English" }
],
- "iswcs": []
+ "iswcs": ["T-010489707-6"]
},
"musicBrainzRecordingId": "d4e5f6a7-b8c9-4d0e-1f2a-3b4c5d6e7f8a",
"musicBrainzTrackId": "e5f6a7b8-c9d0-4e1f-2a3b-4c5d6e7f8a9b",
@@ -130,8 +130,8 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b
"title": "Bohemian Rhapsody",
"originalTitle": "Bohemian Rhapsody",
"description": "A song by the British rock band Queen. It was written by Freddie Mercury and originally released on the album A Night at the Opera in 1975.",
- "disambiguation": null,
- "releaseInfo": { "originalReleaseDate": "1975-10-31", "originalReleaseYear": 1975, "reReleaseDate": null, "reReleaseYear": null, "releaseCountry": "GB", "releaseVersion": "Original" },
+ "disambiguation": "album version",
+ "releaseInfo": { "originalReleaseDate": "1975-10-31", "originalReleaseYear": 1975, "reReleaseDate": "2011-11-21", "reReleaseYear": 2011, "releaseCountry": "GB", "releaseVersion": "Original" },
"language": { "languageCode": "en", "languageName": "English", "nativeName": "English" },
"originalLanguage": { "languageCode": "en", "languageName": "English", "nativeName": "English" },
"tags": [ { "name": "classic" }, { "name": "epic" } ],
@@ -161,12 +161,12 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b
"languages": [
{ "languageCode": "en", "languageName": "English", "nativeName": "English" }
],
- "iswcs": []
+ "iswcs": ["T-010489707-6"]
},
"musicBrainzRecordingId": "d4e5f6a7-b8c9-4d0e-1f2a-3b4c5d6e7f8a",
"musicBrainzTrackId": "e5f6a7b8-c9d0-4e1f-2a3b-4c5d6e7f8a9b",
"createdOnUtc": "2025-01-01T12:00:00.0000000Z",
- "updatedOnUtc": null,
+ "updatedOnUtc": "2025-01-20T14:45:00.0000000Z",
"moods": [
{
"name": "dramatic"
@@ -232,8 +232,8 @@ GET api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b-
"title": "Bohemian Rhapsody",
"originalTitle": "Bohemian Rhapsody",
"description": "A song by the British rock band Queen. It was written by Freddie Mercury and originally released on the album A Night at the Opera in 1975.",
- "disambiguation": null,
- "releaseInfo": { "originalReleaseDate": "1975-10-31", "originalReleaseYear": 1975, "reReleaseDate": null, "reReleaseYear": null, "releaseCountry": "GB", "releaseVersion": "Original" },
+ "disambiguation": "album version",
+ "releaseInfo": { "originalReleaseDate": "1975-10-31", "originalReleaseYear": 1975, "reReleaseDate": "2011-11-21", "reReleaseYear": 2011, "releaseCountry": "GB", "releaseVersion": "Original" },
"language": { "languageCode": "en", "languageName": "English", "nativeName": "English" },
"originalLanguage": { "languageCode": "en", "languageName": "English", "nativeName": "English" },
"tags": [ { "name": "classic" }, { "name": "epic" } ],
@@ -263,12 +263,12 @@ GET api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b-
"languages": [
{ "languageCode": "en", "languageName": "English", "nativeName": "English" }
],
- "iswcs": []
+ "iswcs": ["T-010489707-6"]
},
"musicBrainzRecordingId": "d4e5f6a7-b8c9-4d0e-1f2a-3b4c5d6e7f8a",
"musicBrainzTrackId": "e5f6a7b8-c9d0-4e1f-2a3b-4c5d6e7f8a9b",
"createdOnUtc": "2025-01-01T12:00:00.0000000Z",
- "updatedOnUtc": null,
+ "updatedOnUtc": "2025-01-20T14:45:00.0000000Z",
"moods": [
{
"name": "dramatic"
@@ -325,12 +325,12 @@ PUT api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b-
"title": "Bohemian Rhapsody",
"originalTitle": "Bohemian Rhapsody",
"description": "A song by the British rock band Queen. It was written by Freddie Mercury and originally released on the album A Night at the Opera in 1975.",
- "disambiguation": null,
+ "disambiguation": "album version",
"releaseInfo": {
"originalReleaseDate": "1975-10-31",
"originalReleaseYear": 1975,
- "reReleaseDate": null,
- "reReleaseYear": null,
+ "reReleaseDate": "2011-11-21",
+ "reReleaseYear": 2011,
"releaseCountry": "GB",
"releaseVersion": "Original"
},
@@ -377,7 +377,7 @@ PUT api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b-
"languages": [
{ "languageCode": "en", "languageName": "English", "nativeName": "English" }
],
- "iswcs": []
+ "iswcs": ["T-010489707-6"]
},
"musicBrainzRecordingId": "d4e5f6a7-b8c9-4d0e-1f2a-3b4c5d6e7f8a",
"musicBrainzTrackId": "e5f6a7b8-c9d0-4e1f-2a3b-4c5d6e7f8a9b",
@@ -425,8 +425,8 @@ PUT api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b-
"title": "Bohemian Rhapsody",
"originalTitle": "Bohemian Rhapsody",
"description": "A song by the British rock band Queen. It was written by Freddie Mercury and originally released on the album A Night at the Opera in 1975.",
- "disambiguation": null,
- "releaseInfo": { "originalReleaseDate": "1975-10-31", "originalReleaseYear": 1975, "reReleaseDate": null, "reReleaseYear": null, "releaseCountry": "GB", "releaseVersion": "Original" },
+ "disambiguation": "album version",
+ "releaseInfo": { "originalReleaseDate": "1975-10-31", "originalReleaseYear": 1975, "reReleaseDate": "2011-11-21", "reReleaseYear": 2011, "releaseCountry": "GB", "releaseVersion": "Original" },
"language": { "languageCode": "en", "languageName": "English", "nativeName": "English" },
"originalLanguage": { "languageCode": "en", "languageName": "English", "nativeName": "English" },
"tags": [ { "name": "classic" }, { "name": "epic" } ],
@@ -456,12 +456,12 @@ PUT api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b-
"languages": [
{ "languageCode": "en", "languageName": "English", "nativeName": "English" }
],
- "iswcs": []
+ "iswcs": ["T-010489707-6"]
},
"musicBrainzRecordingId": "d4e5f6a7-b8c9-4d0e-1f2a-3b4c5d6e7f8a",
"musicBrainzTrackId": "e5f6a7b8-c9d0-4e1f-2a3b-4c5d6e7f8a9b",
"createdOnUtc": "2025-01-01T12:00:00.0000000Z",
- "updatedOnUtc": null,
+ "updatedOnUtc": "2025-01-20T14:45:00.0000000Z",
"moods": [
{
"name": "dramatic"
diff --git a/docs/technical/api/library/written-content-library/book-library/Api.Books.md b/docs/technical/api/library/written-content-library/book-library/Api.Books.md
index ef7a6afb..8d386d2e 100644
--- a/docs/technical/api/library/written-content-library/book-library/Api.Books.md
+++ b/docs/technical/api/library/written-content-library/book-library/Api.Books.md
@@ -237,7 +237,7 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/books
"metadataProvider": null,
"createdOnUtc": "2025-01-01T12:00:00.0000000Z",
"updatedOnUtc": null,
- "coverPath": null
+ "coverPath": "/media/books/tolkien/the-fellowship-of-the-ring/cover.jpg"
}
```
@@ -353,7 +353,7 @@ GET api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/books/{bookId}
"metadataProvider": null,
"createdOnUtc": "2025-01-01T12:00:00.0000000Z",
"updatedOnUtc": null,
- "coverPath": null
+ "coverPath": "/media/books/tolkien/the-fellowship-of-the-ring/cover.jpg"
}
```
@@ -467,7 +467,7 @@ GET api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/books?currentPage=1&pe
"metadataProvider": null,
"createdOnUtc": "2025-01-01T12:00:00.0000000Z",
"updatedOnUtc": null,
- "coverPath": null
+ "coverPath": "/media/books/tolkien/the-fellowship-of-the-ring/cover.jpg"
}
],
"currentPage": 1,
diff --git a/docs/technical/requests/library/audio-library/music-library/albums/UpdateAlbumCover.http b/docs/technical/requests/library/audio-library/music-library/albums/UpdateAlbumCover.http
new file mode 100644
index 00000000..147a43cf
--- /dev/null
+++ b/docs/technical/requests/library/audio-library/music-library/albums/UpdateAlbumCover.http
@@ -0,0 +1,10 @@
+PUT {{host}}/api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b-4b1c-9a3e-7f6e5d4c3b2a/albums/{{$guid}}/cover
+Authorization: Bearer {{ACCESS_TOKEN}}
+Content-Type: multipart/form-data; boundary=LuminaBoundary
+
+--LuminaBoundary
+Content-Disposition: form-data; name="cover"; filename="cover.jpg"
+Content-Type: image/jpeg
+
+< ./cover.jpg
+--LuminaBoundary--
diff --git a/docs/technical/requests/library/audio-library/music-library/artists/GetArtistsLite.http b/docs/technical/requests/library/audio-library/music-library/artists/GetArtistsLite.http
index c95805e1..679436a5 100644
--- a/docs/technical/requests/library/audio-library/music-library/artists/GetArtistsLite.http
+++ b/docs/technical/requests/library/audio-library/music-library/artists/GetArtistsLite.http
@@ -1,2 +1,2 @@
-GET {{host}}/api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/lite?currentPage=1&perPage=10&searchTerm=queen
+GET {{host}}/api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/lite?currentPage=1&perPage=10&searchTerm=queen&filterAlphaKey=q&shouldIgnoreThePrefixForAlphaPicker=true&sortBy=name&sortOrder=Ascending
Authorization: Bearer {{ACCESS_TOKEN}}
diff --git a/docs/technical/requests/library/audio-library/music-library/artists/UpdateArtistCover.http b/docs/technical/requests/library/audio-library/music-library/artists/UpdateArtistCover.http
new file mode 100644
index 00000000..a83a3218
--- /dev/null
+++ b/docs/technical/requests/library/audio-library/music-library/artists/UpdateArtistCover.http
@@ -0,0 +1,10 @@
+PUT {{host}}/api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/{{$guid}}/cover
+Authorization: Bearer {{ACCESS_TOKEN}}
+Content-Type: multipart/form-data; boundary=LuminaBoundary
+
+--LuminaBoundary
+Content-Disposition: form-data; name="cover"; filename="cover.jpg"
+Content-Type: image/jpeg
+
+< ./cover.jpg
+--LuminaBoundary--
diff --git a/src/Lumina.Application/Common/DTO/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumLiteRow.cs b/src/Lumina.Application/Common/DTO/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumLiteRow.cs
index 93b67e3a..9a74fa8a 100644
--- a/src/Lumina.Application/Common/DTO/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumLiteRow.cs
+++ b/src/Lumina.Application/Common/DTO/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumLiteRow.cs
@@ -1,5 +1,7 @@
#region ========================================================================= USING =====================================================================================
+using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary;
using System;
+using System.Collections.Generic;
#endregion
namespace Lumina.Application.Common.DTO.MediaLibrary.AudioLibrary.MusicLibrary.Albums;
@@ -23,4 +25,19 @@ public sealed record AlbumLiteRow
/// Gets the number of tracks of the release.
///
public int TotalTracks { get; init; }
+
+ ///
+ /// Gets the path of the image representing the album, if available.
+ ///
+ public string? CoverPath { get; init; }
+
+ ///
+ /// Gets the release year of the album (the re-release year, if available, or the original release year), if known.
+ ///
+ public int? ReleaseYear { get; init; }
+
+ ///
+ /// Gets the set of types of the release.
+ ///
+ public List? ReleaseTypes { get; init; }
}
diff --git a/src/Lumina.Application/Common/DTO/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistLiteRow.cs b/src/Lumina.Application/Common/DTO/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistLiteRow.cs
index 27aae3d4..31970314 100644
--- a/src/Lumina.Application/Common/DTO/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistLiteRow.cs
+++ b/src/Lumina.Application/Common/DTO/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistLiteRow.cs
@@ -18,4 +18,9 @@ public sealed record ArtistLiteRow
/// Gets the name of the artist.
///
public required string Name { get; init; }
+
+ ///
+ /// Gets the path of the image representing the artist, if available.
+ ///
+ public string? CoverPath { get; init; }
}
diff --git a/src/Lumina.Application/Common/DTO/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/TrackLiteRow.cs b/src/Lumina.Application/Common/DTO/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/TrackLiteRow.cs
index 2b21efcf..33275f1a 100644
--- a/src/Lumina.Application/Common/DTO/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/TrackLiteRow.cs
+++ b/src/Lumina.Application/Common/DTO/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/TrackLiteRow.cs
@@ -28,4 +28,9 @@ public sealed record TrackLiteRow
/// Gets the number of the disc the track belongs to, if applicable.
///
public int? DiscNumber { get; init; }
+
+ ///
+ /// Gets the duration of the track in seconds.
+ ///
+ public int DurationInSeconds { get; init; }
}
diff --git a/src/Lumina.Application/Common/DataAccess/Repositories/BookLibrary/IBookRepository.cs b/src/Lumina.Application/Common/DataAccess/Repositories/BookLibrary/IBookRepository.cs
index 56ebf0c6..d9516d0b 100644
--- a/src/Lumina.Application/Common/DataAccess/Repositories/BookLibrary/IBookRepository.cs
+++ b/src/Lumina.Application/Common/DataAccess/Repositories/BookLibrary/IBookRepository.cs
@@ -123,4 +123,12 @@ public interface IBookRepository : IRepository,
/// Cancellation token that can be used to stop the execution.
/// An containing either the display names of the authors of the books, keyed by book Id, or an error.
Task>> GetAuthorsDisplayNamesByBookIdsAsync(IReadOnlyCollection bookIds, CancellationToken cancellationToken);
+
+ ///
+ /// Deletes all the books of the media library identified by , together with their artwork and their related data.
+ ///
+ /// The Id of the media library whose books are deleted.
+ /// Cancellation token that can be used to stop the execution.
+ /// An representing either a successful operation, or an error.
+ Task> DeleteByLibraryIdAsync(Guid libraryId, CancellationToken cancellationToken);
}
diff --git a/src/Lumina.Application/Common/DataAccess/Repositories/MusicLibrary/IArtistRepository.cs b/src/Lumina.Application/Common/DataAccess/Repositories/MusicLibrary/IArtistRepository.cs
index 1cc604ac..b1aed090 100644
--- a/src/Lumina.Application/Common/DataAccess/Repositories/MusicLibrary/IArtistRepository.cs
+++ b/src/Lumina.Application/Common/DataAccess/Repositories/MusicLibrary/IArtistRepository.cs
@@ -78,4 +78,12 @@ public interface IArtistRepository : IRepository,
/// Cancellation token that can be used to stop the execution.
/// An representing either a successful operation, or an error.
Task> ResetMetadataStatusForLibraryAsync(Guid libraryId, CancellationToken cancellationToken);
+
+ ///
+ /// Deletes all the artists of the media library identified by , together with their albums and tracks and their related data.
+ ///
+ /// The Id of the media library whose artists are deleted.
+ /// Cancellation token that can be used to stop the execution.
+ /// An representing either a successful operation, or an error.
+ Task> DeleteByLibraryIdAsync(Guid libraryId, CancellationToken cancellationToken);
}
diff --git a/src/Lumina.Application/Common/DataAccess/Repositories/MusicLibrary/IMusicArtworkRepository.cs b/src/Lumina.Application/Common/DataAccess/Repositories/MusicLibrary/IMusicArtworkRepository.cs
index 2d1686e8..dd5898c4 100644
--- a/src/Lumina.Application/Common/DataAccess/Repositories/MusicLibrary/IMusicArtworkRepository.cs
+++ b/src/Lumina.Application/Common/DataAccess/Repositories/MusicLibrary/IMusicArtworkRepository.cs
@@ -46,4 +46,23 @@ public interface IMusicArtworkRepository : IRepository,
/// Cancellation token that can be used to stop the execution.
/// An representing either a successful operation, or an error.
Task> ResetStatusForLibraryAsync(Guid libraryId, CancellationToken cancellationToken);
+
+ ///
+ /// Deletes all the pieces of artwork owned by the artists, albums and tracks of the media library identified by .
+ ///
+ /// The Id of the media library whose artwork is deleted.
+ /// Cancellation token that can be used to stop the execution.
+ /// An representing either a successful operation, or an error.
+ Task> DeleteByLibraryIdAsync(Guid libraryId, CancellationToken cancellationToken);
+
+ ///
+ /// Stores the cover image of the music library item of the provided identified by ,
+ /// replacing the file of its existing cover, or adding a new cover artwork when it has none.
+ ///
+ /// The type of the music library item that owns the artwork.
+ /// The Id of the music library item that owns the artwork.
+ /// The relative file name of the stored cover image.
+ /// Cancellation token that can be used to stop the execution.
+ /// An representing either a successful operation, or an error.
+ Task> UpsertCoverAsync(MusicArtworkOwnerType ownerType, Guid ownerId, string fileName, CancellationToken cancellationToken);
}
diff --git a/src/Lumina.Application/Common/DataAccess/Repositories/MusicLibrary/IMusicLibraryScanItemMetadataRepository.cs b/src/Lumina.Application/Common/DataAccess/Repositories/MusicLibrary/IMusicLibraryScanItemMetadataRepository.cs
index 488c0d9c..073d8c6e 100644
--- a/src/Lumina.Application/Common/DataAccess/Repositories/MusicLibrary/IMusicLibraryScanItemMetadataRepository.cs
+++ b/src/Lumina.Application/Common/DataAccess/Repositories/MusicLibrary/IMusicLibraryScanItemMetadataRepository.cs
@@ -32,4 +32,12 @@ public interface IMusicLibraryScanItemMetadataRepository : IRepositoryCancellation token that can be used to stop the execution.
/// An representing either a successful operation, or an error.
Task> DeleteByScanIdAsync(Guid scanId, CancellationToken cancellationToken);
+
+ ///
+ /// Deletes all the staged music metadata items of the media library identified by .
+ ///
+ /// The Id of the media library whose staged music metadata is deleted.
+ /// Cancellation token that can be used to stop the execution.
+ /// An representing either a successful operation, or an error.
+ Task> DeleteByLibraryIdAsync(Guid libraryId, CancellationToken cancellationToken);
}
diff --git a/src/Lumina.Application/Common/DependencyInjection/ApplicationLayerServices.cs b/src/Lumina.Application/Common/DependencyInjection/ApplicationLayerServices.cs
index 6ca6bec2..f85aabf0 100644
--- a/src/Lumina.Application/Common/DependencyInjection/ApplicationLayerServices.cs
+++ b/src/Lumina.Application/Common/DependencyInjection/ApplicationLayerServices.cs
@@ -1,5 +1,6 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Application.Common.Telemetry;
+using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artwork;
using Lumina.Application.Core.MediaLibrary.Management.Deletion;
using Lumina.Domain.Common.Events;
using Microsoft.Extensions.DependencyInjection;
@@ -44,6 +45,7 @@ public static class ApplicationLayerServices
services.AddScoped();
services.AddScoped();
+ services.AddScoped();
foreach (var registration in handlerRegistrations)
{
diff --git a/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumEntityMapping.cs b/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumEntityMapping.cs
index add81757..887dcb2c 100644
--- a/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumEntityMapping.cs
+++ b/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumEntityMapping.cs
@@ -157,8 +157,10 @@ public static class AlbumEntityMapping
/// Converts to .
///
/// The repository entity to be converted.
+ /// The optional path of the image representing the album.
+ /// The optional stored artwork of the album, in display order.
/// The converted response entity.
- public static AlbumResponse ToResponse(this AlbumEntity repositoryEntity)
+ public static AlbumResponse ToResponse(this AlbumEntity repositoryEntity, string? coverPath = null, IReadOnlyList? artwork = null)
{
ReleaseInfoDto releaseInfo = new(
repositoryEntity.OriginalReleaseDate,
@@ -220,7 +222,9 @@ public static class AlbumEntityMapping
repositoryEntity.UpdatedOnUtc,
[.. repositoryEntity.Contributors.Select(contributor => new MediaContributorReferenceDto(contributor.MediaContributorId, contributor.Role))],
[.. repositoryEntity.Ratings.ToResponses()],
- [.. repositoryEntity.Tracks.Select(track => track.ToResponse())]);
+ [.. repositoryEntity.Tracks.Select(track => track.ToResponse())],
+ coverPath,
+ artwork ?? []);
}
///
diff --git a/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumLiteRowMapping.cs b/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumLiteRowMapping.cs
index 4d5075a6..4cc0c2b7 100644
--- a/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumLiteRowMapping.cs
+++ b/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumLiteRowMapping.cs
@@ -24,7 +24,10 @@ public static class AlbumLiteRowMapping
return new AlbumLiteResponse(
readModel.Id,
readModel.Title,
- readModel.TotalTracks);
+ readModel.TotalTracks,
+ readModel.CoverPath,
+ readModel.ReleaseYear,
+ readModel.ReleaseTypes);
}
///
diff --git a/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistEntityMapping.cs b/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistEntityMapping.cs
index bf1560ba..c77a161e 100644
--- a/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistEntityMapping.cs
+++ b/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistEntityMapping.cs
@@ -147,8 +147,9 @@ public static class ArtistEntityMapping
/// Converts to .
///
/// The repository entity to be converted.
+ /// The optional path of the image representing the artist.
/// The converted response entity.
- public static ArtistResponse ToResponse(this ArtistEntity repositoryEntity)
+ public static ArtistResponse ToResponse(this ArtistEntity repositoryEntity, string? coverPath = null)
{
MusicArtistMetadataDto metadata = new(
repositoryEntity.Name,
@@ -178,7 +179,8 @@ public static class ArtistEntityMapping
repositoryEntity.UpdatedOnUtc,
[.. repositoryEntity.Contributors.Select(contributor => new MediaContributorReferenceDto(contributor.MediaContributorId, contributor.Role))],
[.. repositoryEntity.Ratings.ToResponses()],
- [.. repositoryEntity.Albums.Select(album => album.ToResponse())]);
+ [.. repositoryEntity.Albums.Select(album => album.ToResponse())],
+ coverPath);
}
///
diff --git a/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistLiteRowMapping.cs b/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistLiteRowMapping.cs
index b68bd3a7..d1d6c91a 100644
--- a/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistLiteRowMapping.cs
+++ b/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistLiteRowMapping.cs
@@ -23,7 +23,8 @@ public static class ArtistLiteRowMapping
{
return new ArtistLiteResponse(
readModel.Id,
- readModel.Name);
+ readModel.Name,
+ readModel.CoverPath);
}
///
diff --git a/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Artists/GetArtistsLiteRequestMapping.cs b/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Artists/GetArtistsLiteRequestMapping.cs
index 2eebc351..78957980 100644
--- a/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Artists/GetArtistsLiteRequestMapping.cs
+++ b/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Artists/GetArtistsLiteRequestMapping.cs
@@ -30,6 +30,10 @@ public static class GetArtistsLiteRequestMapping
return new GetArtistsLiteQuery(
libraryId,
paginationData,
- request.SearchTerm);
+ request.SearchTerm,
+ request.FilterAlphaKey,
+ request.ShouldIgnoreThePrefixForAlphaPicker,
+ request.SortBy,
+ request.SortOrder);
}
}
diff --git a/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Artists/UpdateArtistCommandMapping.cs b/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Artists/UpdateArtistCommandMapping.cs
index 8b877823..076e5672 100644
--- a/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Artists/UpdateArtistCommandMapping.cs
+++ b/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Artists/UpdateArtistCommandMapping.cs
@@ -160,6 +160,7 @@ public static class UpdateArtistCommandMapping
existingTrack,
domainTrack.Path,
domainTrack.Metadata,
+ domainTrack.Disambiguation,
domainTrack.TrackNumber,
domainTrack.DiscNumber,
domainTrack.Script,
diff --git a/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/AudioMetadataDtoMapping.cs b/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/AudioMetadataDtoMapping.cs
index c8c6da37..76393ef8 100644
--- a/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/AudioMetadataDtoMapping.cs
+++ b/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/AudioMetadataDtoMapping.cs
@@ -94,6 +94,9 @@ public static class AudioMetadataDtoMapping
Optional bpm = Optional.FromNullable(dto.Bpm);
if (!bpm.HasValue)
bpm = track.Bpm;
+ Optional disambiguation = Optional.FromNullable(dto.Disambiguation);
+ if (!disambiguation.HasValue)
+ disambiguation = track.Disambiguation;
Optional musicBrainzRecordingId = Optional.None();
if (dto.MusicBrainzRecordingId is not null)
musicBrainzRecordingId = MusicBrainzId.Create(dto.MusicBrainzRecordingId.Value);
@@ -110,6 +113,7 @@ public static class AudioMetadataDtoMapping
track,
track.Path,
metadataResult.Value,
+ disambiguation,
track.TrackNumber,
track.DiscNumber,
script,
@@ -187,21 +191,37 @@ public static class AudioMetadataDtoMapping
if (dto.OriginalLanguage is not null && dto.OriginalLanguage.LanguageCode is not null && dto.OriginalLanguage.LanguageName is not null)
originalLanguage = LanguageInfo.Create(dto.OriginalLanguage.LanguageCode, dto.OriginalLanguage.LanguageName, Optional.FromNullable(dto.OriginalLanguage.NativeName));
+ Optional originalTitle = Optional.FromNullable(dto.OriginalTitle);
+ if (!originalTitle.HasValue)
+ originalTitle = track.Metadata.OriginalTitle;
+ Optional description = Optional.FromNullable(dto.Description);
+ if (!description.HasValue)
+ description = track.Metadata.Description;
+ Optional bitDepth = Optional.FromNullable(dto.BitDepth);
+ if (!bitDepth.HasValue)
+ bitDepth = track.Metadata.BitDepth;
+ Optional audioCodec = Optional.FromNullable(dto.AudioCodec);
+ if (!audioCodec.HasValue)
+ audioCodec = track.Metadata.AudioCodec;
+ Optional bitrate = Optional.FromNullable(dto.Bitrate);
+ if (!bitrate.HasValue)
+ bitrate = track.Metadata.Bitrate;
+
return AudioMetadata.Create(
string.IsNullOrWhiteSpace(dto.Title) ? track.Metadata.Title : dto.Title,
- Optional.FromNullable(dto.OriginalTitle).HasValue ? Optional.FromNullable(dto.OriginalTitle) : track.Metadata.OriginalTitle,
+ originalTitle,
dto.DurationInSeconds is > 0 ? dto.DurationInSeconds.Value : track.Metadata.DurationInSeconds,
dto.SampleRate is > 0 ? dto.SampleRate.Value : track.Metadata.SampleRate,
dto.Channels is > 0 ? dto.Channels.Value : track.Metadata.Channels,
releaseInfoResult.Value,
- Optional.FromNullable(dto.Description).HasValue ? Optional.FromNullable(dto.Description) : track.Metadata.Description,
+ description,
genres,
tags,
language,
originalLanguage,
- Optional.FromNullable(dto.BitDepth).HasValue ? Optional.FromNullable(dto.BitDepth) : track.Metadata.BitDepth,
- Optional.FromNullable(dto.AudioCodec).HasValue ? Optional.FromNullable(dto.AudioCodec) : track.Metadata.AudioCodec,
- Optional.FromNullable(dto.Bitrate).HasValue ? Optional.FromNullable(dto.Bitrate) : track.Metadata.Bitrate,
+ bitDepth,
+ audioCodec,
+ bitrate,
track.Metadata.AcoustId,
track.Metadata.ReplayGainTrackGain,
track.Metadata.ReplayGainTrackPeak,
diff --git a/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/TrackLiteRowMapping.cs b/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/TrackLiteRowMapping.cs
index a32662b9..cd5b67ca 100644
--- a/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/TrackLiteRowMapping.cs
+++ b/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/TrackLiteRowMapping.cs
@@ -25,7 +25,8 @@ public static class TrackLiteRowMapping
readModel.Id,
readModel.Title,
readModel.TrackNumber,
- readModel.DiscNumber);
+ readModel.DiscNumber,
+ readModel.DurationInSeconds);
}
///
diff --git a/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/UpdateTrackCommandMapping.cs b/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/UpdateTrackCommandMapping.cs
index 143a6ba9..c7ff1519 100644
--- a/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/UpdateTrackCommandMapping.cs
+++ b/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/UpdateTrackCommandMapping.cs
@@ -87,6 +87,7 @@ public static class UpdateTrackCommandMapping
track,
command.Path!,
metadataResult.Value,
+ Optional.FromNullable(metadata.Disambiguation),
command.TrackNumber!.Value,
Optional.FromNullable(command.DiscNumber),
Optional.FromNullable(command.Script),
diff --git a/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/DeleteAlbum/DeleteAlbumCommandHandler.cs b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/DeleteAlbum/DeleteAlbumCommandHandler.cs
index 3c63ada0..173bbe3b 100644
--- a/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/DeleteAlbum/DeleteAlbumCommandHandler.cs
+++ b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/DeleteAlbum/DeleteAlbumCommandHandler.cs
@@ -8,6 +8,7 @@ using Lumina.Application.Common.Infrastructure.Authorization;
using Lumina.Application.Common.Infrastructure.Authorization.Policies.LibraryOwnership;
using Lumina.Application.Common.Infrastructure.Validation;
using Lumina.Application.Common.Mapping.MediaLibrary.AudioLibrary.MusicLibrary.Artists;
+using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artwork;
using Lumina.Domain.Common.Primitives;
using Lumina.Domain.Core.BoundedContexts.AudioLibraryBoundedContext.MusicLibraryAggregate;
using Lumina.Domain.Core.BoundedContexts.AudioLibraryBoundedContext.MusicLibraryAggregate.Entities;
@@ -28,6 +29,7 @@ namespace Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Albums.
public class DeleteAlbumCommandHandler : ICommandHandler>
{
private readonly IUnitOfWork _unitOfWork;
+ private readonly IMusicArtworkCleanupService _musicArtworkCleanupService;
private readonly IAuthorizationService _authorizationService;
private readonly ICurrentUserService _currentUserService;
private readonly IValidator _validator;
@@ -36,12 +38,14 @@ public class DeleteAlbumCommandHandler : ICommandHandler class.
///
/// Injected unit of work for interacting with the data access layer repositories.
+ /// Injected service for removing the artwork of a music library item and of its children.
/// Injected service for authorization related functionality.
/// Injected service to retrieve the current user information.
/// Injected validator for application validation rules.
- public DeleteAlbumCommandHandler(IUnitOfWork unitOfWork, IAuthorizationService authorizationService, ICurrentUserService currentUserService, IValidator validator)
+ public DeleteAlbumCommandHandler(IUnitOfWork unitOfWork, IMusicArtworkCleanupService musicArtworkCleanupService, IAuthorizationService authorizationService, ICurrentUserService currentUserService, IValidator validator)
{
_unitOfWork = unitOfWork;
+ _musicArtworkCleanupService = musicArtworkCleanupService;
_authorizationService = authorizationService;
_currentUserService = currentUserService;
_validator = validator;
@@ -115,6 +119,12 @@ public class DeleteAlbumCommandHandler : ICommandHandler deleteArtworkResult = await _musicArtworkCleanupService.DeleteAlbumArtworkAsync(albumId, cancellationToken).ConfigureAwait(false);
+ if (deleteArtworkResult.IsFailure)
+ return deleteArtworkResult.Errors;
+
Result updateResult = await _unitOfWork.ArtistRepository
.UpdateAsync(artistResult.Value.ToRepositoryEntity(), cancellationToken).ConfigureAwait(false);
if (updateResult.IsFailure)
diff --git a/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/UpdateAlbumCover/UpdateAlbumCoverCommand.cs b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/UpdateAlbumCover/UpdateAlbumCoverCommand.cs
new file mode 100644
index 00000000..69f8d7da
--- /dev/null
+++ b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/UpdateAlbumCover/UpdateAlbumCoverCommand.cs
@@ -0,0 +1,24 @@
+#region ========================================================================= USING =====================================================================================
+using Lumina.Application.Common.CQRS;
+using System.Diagnostics;
+using System.IO;
+#endregion
+
+namespace Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Albums.Commands.UpdateAlbumCover;
+
+///
+/// Command for updating the cover image of an existing album.
+///
+/// The unique identifier of the media library the album belongs to, taken from the route.
+/// The unique identifier of the artist the album belongs to, taken from the route.
+/// The unique identifier of the album whose cover image is updated, taken from the route.
+/// The stream of the uploaded cover image file.
+/// The name of the uploaded cover image file.
+[DebuggerDisplay("AlbumId: {AlbumId} FileName: {FileName}")]
+public record UpdateAlbumCoverCommand(
+ string? LibraryId,
+ string? ArtistId,
+ string? AlbumId,
+ Stream? Cover,
+ string? FileName
+) : ICommand;
diff --git a/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/UpdateAlbumCover/UpdateAlbumCoverCommandHandler.cs b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/UpdateAlbumCover/UpdateAlbumCoverCommandHandler.cs
new file mode 100644
index 00000000..cc24503b
--- /dev/null
+++ b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/UpdateAlbumCover/UpdateAlbumCoverCommandHandler.cs
@@ -0,0 +1,198 @@
+#region ========================================================================= USING =====================================================================================
+using Lumina.Application.Common.CQRS;
+using Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary;
+using Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management;
+using Lumina.Application.Common.DataAccess.UoW;
+using Lumina.Application.Common.Infrastructure.Authentication;
+using Lumina.Application.Common.Infrastructure.Authorization;
+using Lumina.Application.Common.Infrastructure.Authorization.Policies.LibraryOwnership;
+using Lumina.Application.Common.Infrastructure.Validation;
+using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artwork;
+using Lumina.Contracts.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Albums;
+using Lumina.Domain.Common.Primitives;
+using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Services;
+using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.ValueObjects;
+using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary;
+using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
+using ApplicationErrors = Lumina.Application.Common.Errors.Errors;
+using DomainErrors = Lumina.Domain.Common.Errors.Errors;
+#endregion
+
+namespace Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Albums.Commands.UpdateAlbumCover;
+
+///
+/// Handler for the command to update the cover image of an existing album.
+///
+public class UpdateAlbumCoverCommandHandler : ICommandHandler>
+{
+ private readonly IUnitOfWork _unitOfWork;
+ private readonly IMusicArtworkService _musicArtworkService;
+ private readonly IPathService _pathService;
+ private readonly IAuthorizationService _authorizationService;
+ private readonly ICurrentUserService _currentUserService;
+ private readonly IValidator _validator;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Injected unit of work for interacting with the data access layer repositories.
+ /// Injected service for storing the artwork of a music library item.
+ /// Injected service for handling file system paths.
+ /// Injected service for authorization related functionality.
+ /// Injected service to retrieve the current user information.
+ /// Injected validator for application validation rules.
+ public UpdateAlbumCoverCommandHandler(IUnitOfWork unitOfWork, IMusicArtworkService musicArtworkService, IPathService pathService, IAuthorizationService authorizationService, ICurrentUserService currentUserService, IValidator validator)
+ {
+ _unitOfWork = unitOfWork;
+ _musicArtworkService = musicArtworkService;
+ _pathService = pathService;
+ _authorizationService = authorizationService;
+ _currentUserService = currentUserService;
+ _validator = validator;
+ }
+
+ ///
+ /// Handles the command to update the cover image of an existing album.
+ ///
+ /// The command to be handled.
+ /// Cancellation token that can be used to stop the execution.
+ ///
+ /// An containing either the response carrying the relative path of the stored cover image, or an error message.
+ ///
+ public async Task> HandleAsync(UpdateAlbumCoverCommand command, CancellationToken cancellationToken)
+ {
+ List validationResult = _validator.Validate(command);
+ if (validationResult.Count > 0)
+ return validationResult;
+
+ // An authenticated request must always carry a user identity.
+ Guid? currentUserId = _currentUserService.UserId;
+ if (currentUserId is null)
+ return ApplicationErrors.Authorization.NotAuthorized;
+ Guid userId = currentUserId.Value;
+
+ // The validator guarantees that the route identifiers are non-empty Guids before this point.
+ Guid libraryId = Guid.Parse(command.LibraryId!);
+ Guid artistId = Guid.Parse(command.ArtistId!);
+ Guid albumId = Guid.Parse(command.AlbumId!);
+
+ Result getAlbumResult = await _unitOfWork.AlbumRepository.GetByIdAsync(albumId, shouldTrackEntities: false, cancellationToken: cancellationToken).ConfigureAwait(false);
+ if (getAlbumResult.IsFailure)
+ return getAlbumResult.Errors;
+ if (getAlbumResult.Value is null)
+ return DomainErrors.Music.AlbumNotFound;
+ AlbumEntity existingAlbum = getAlbumResult.Value;
+
+ // Resource scoping: the album must belong to the library and the artist named by the route, so that an album can never be edited through
+ // another library's or artist's route; the mismatch is reported as not found, without disclosing that the album exists elsewhere.
+ if (existingAlbum.LibraryId != libraryId || existingAlbum.ArtistId != artistId)
+ return DomainErrors.Music.AlbumNotFound;
+
+ // Admins can update the albums of all libraries; for everyone else, only the albums of the libraries they own.
+ bool canAccessLibrary = await _authorizationService.EvaluatePolicyAsync(
+ userId, new LibraryOwnershipPolicyContext(existingAlbum.LibraryId), cancellationToken).ConfigureAwait(false);
+ if (!canAccessLibrary)
+ return ApplicationErrors.Authorization.NotAuthorized;
+
+ // The artwork is stored under the library and artist segments, so their names are resolved to keep the location consistent with the scanned artwork.
+ Result getLibraryResult = await _unitOfWork.LibraryRepository.GetByIdAsync(existingAlbum.LibraryId, cancellationToken: cancellationToken).ConfigureAwait(false);
+ if (getLibraryResult.IsFailure)
+ return getLibraryResult.Errors;
+ if (getLibraryResult.Value is null)
+ return DomainErrors.Library.LibraryNotFound;
+ string libraryName = getLibraryResult.Value.Title;
+
+ Result getArtistResult = await _unitOfWork.ArtistRepository.GetByIdAsync(existingAlbum.ArtistId, shouldTrackEntities: false, cancellationToken: cancellationToken).ConfigureAwait(false);
+ if (getArtistResult.IsFailure)
+ return getArtistResult.Errors;
+ string artistName = getArtistResult.Value?.Name ?? string.Empty;
+
+ // The artwork of the album is stored under the directory of its release type, mirroring the structure of the scanned files, so that a
+ // re-uploaded cover replaces the cover stored for the album at its standardized location instead of writing a second copy elsewhere.
+ Result> getArtworkResult = await _unitOfWork.MusicArtworkRepository.GetByOwnerAsync(MusicArtworkOwnerType.Album, albumId, cancellationToken).ConfigureAwait(false);
+ if (getArtworkResult.IsFailure)
+ return getArtworkResult.Errors;
+ string? existingCoverPath = getArtworkResult.Value
+ .Where(artwork => artwork.ArtworkType == ArtworkType.Cover)
+ .Select(artwork => artwork.FileName)
+ .FirstOrDefault();
+ string? releaseTypeName = ExtractReleaseTypeDirectoryName(existingCoverPath, artistName)
+ ?? (existingAlbum.ReleaseTypes.Count > 0 ? existingAlbum.ReleaseTypes[0].ReleaseType.ToString() : null);
+
+ Result storeArtworkResult = await _musicArtworkService.SaveAlbumArtworkAsync(
+ existingAlbum.LibraryId,
+ existingAlbum.Id,
+ libraryName,
+ artistName,
+ existingAlbum.Title,
+ command.Cover!,
+ command.FileName!,
+ releaseTypeName,
+ cancellationToken).ConfigureAwait(false);
+ if (storeArtworkResult.IsFailure)
+ return storeArtworkResult.Errors;
+
+ // The stored cover of the album is replaced as a whole: when the new cover is stored under a different name than the previous one
+ // (for example a png replacing a jpg), the previous file is removed, so that no orphaned artwork is left on disk without a reference.
+ if (!string.IsNullOrWhiteSpace(existingCoverPath) && existingCoverPath != storeArtworkResult.Value)
+ {
+ Result deleteResult = _musicArtworkService.DeleteStoredArtwork(existingCoverPath);
+ if (deleteResult.IsFailure)
+ return deleteResult.Errors;
+ }
+
+ // Map the newly stored cover image onto the artwork of the album, replacing the existing cover or adding a new one.
+ Result upsertResult = await _unitOfWork.MusicArtworkRepository.UpsertCoverAsync(
+ MusicArtworkOwnerType.Album, albumId, storeArtworkResult.Value, cancellationToken).ConfigureAwait(false);
+ if (upsertResult.IsFailure)
+ return upsertResult.Errors;
+
+ Result saveChangesResult = await _unitOfWork.SaveChangesAsync(cancellationToken).ConfigureAwait(false);
+ if (saveChangesResult.IsFailure)
+ return saveChangesResult.Errors;
+
+ return new UpdateAlbumCoverResponse(storeArtworkResult.Value);
+ }
+
+ ///
+ /// Resolves the name of the release type directory the artwork of an album is stored under, from the relative path of its existing cover.
+ ///
+ /// The relative path of the existing cover image of the album, or when the album has no cover.
+ /// The name of the artist of the album.
+ /// The name of the on-disk release type directory, or when the album does not use one.
+ private string? ExtractReleaseTypeDirectoryName(string? coverRelativePath, string artistName)
+ {
+ if (string.IsNullOrWhiteSpace(coverRelativePath))
+ return null;
+ // The path is media/music/{library}/{artist}[/{releaseType}]/{album}/{file}, so the segment right before the album directory is the release
+ // type directory when the album uses one, and the artist directory otherwise. An artist whose name happens to match a release type, like
+ // "Live", must not be mistaken for one, so the segment is only accepted as a release type when it is not the directory of the artist.
+ string[] segments = coverRelativePath.Split(_pathService.PathSeparator, StringSplitOptions.RemoveEmptyEntries);
+ if (segments.Length < 3)
+ return null;
+ string candidate = segments[^3];
+ if (IsArtistDirectory(candidate, artistName))
+ return null;
+ return Enum.TryParse(candidate, ignoreCase: true, out MusicReleaseType releaseType) && Enum.IsDefined(releaseType) ? candidate : null;
+ }
+
+ ///
+ /// Checks whether the provided path segment is the artwork directory of the artist of the album.
+ ///
+ /// The path segment to be checked.
+ /// The name of the artist of the album.
+ /// when the segment is the artwork directory of the artist, otherwise.
+ private bool IsArtistDirectory(string pathSegment, string artistName)
+ {
+ if (string.IsNullOrWhiteSpace(artistName))
+ return false;
+ Result artistSegmentResult = _pathService.SanitizeSegment(artistName);
+ return artistSegmentResult.IsSuccess
+ && string.Equals(pathSegment, artistSegmentResult.Value.Name, StringComparison.OrdinalIgnoreCase);
+ }
+}
diff --git a/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/UpdateAlbumCover/UpdateAlbumCoverCommandValidator.cs b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/UpdateAlbumCover/UpdateAlbumCoverCommandValidator.cs
new file mode 100644
index 00000000..8d9792eb
--- /dev/null
+++ b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/UpdateAlbumCover/UpdateAlbumCoverCommandValidator.cs
@@ -0,0 +1,60 @@
+#region ========================================================================= USING =====================================================================================
+using Lumina.Application.Common.Infrastructure.Validation;
+using Lumina.Application.Common.Utilities;
+using Lumina.Domain.Common.Errors;
+using System;
+#endregion
+
+namespace Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Albums.Commands.UpdateAlbumCover;
+
+///
+/// Validates the needed validation rules for .
+///
+public class UpdateAlbumCoverCommandValidator : AbstractValidator
+{
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public UpdateAlbumCoverCommandValidator()
+ {
+ // Validates the identifier of the media library the album belongs to, taken from the route.
+ RuleFor(command => command.LibraryId)
+ .NotEmpty()
+ .WithError(Errors.Library.LibraryIdCannotBeEmpty);
+
+ RuleFor(command => command.LibraryId)
+ .Must(libraryId => Guid.TryParse(libraryId, out Guid parsedLibraryId) && parsedLibraryId != Guid.Empty)
+ .When(command => command.LibraryId is not null && command.LibraryId.Length > 0)
+ .WithError(Errors.Library.LibraryIdCannotBeEmpty);
+
+ // Validates the identifier of the artist the album belongs to, taken from the route.
+ RuleFor(command => command.ArtistId)
+ .NotEmpty()
+ .WithError(Errors.Music.ArtistIdCannotBeEmpty);
+
+ RuleFor(command => command.ArtistId)
+ .Must(artistId => Guid.TryParse(artistId, out Guid parsedArtistId) && parsedArtistId != Guid.Empty)
+ .When(command => command.ArtistId is not null && command.ArtistId.Length > 0)
+ .WithError(Errors.Music.ArtistIdCannotBeEmpty);
+
+ // Validates the identifier of the album whose cover image is updated, taken from the route.
+ RuleFor(command => command.AlbumId)
+ .NotEmpty()
+ .WithError(Errors.Music.AlbumIdCannotBeEmpty);
+
+ RuleFor(command => command.AlbumId)
+ .Must(albumId => Guid.TryParse(albumId, out Guid parsedAlbumId) && parsedAlbumId != Guid.Empty)
+ .When(command => command.AlbumId is not null && command.AlbumId.Length > 0)
+ .WithError(Errors.Music.AlbumIdCannotBeEmpty);
+
+ // Validates the uploaded cover image.
+ RuleFor(command => command.Cover)
+ .NotNull()
+ .WithError(Errors.Music.CoverCannotBeNull);
+
+ RuleFor(command => command.FileName)
+ .NotEmpty()
+ .When(command => command.Cover is not null)
+ .WithError(Errors.FileSystemManagement.FileNameCannotBeEmpty);
+ }
+}
diff --git a/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Queries/GetAlbum/GetAlbumQueryHandler.cs b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Queries/GetAlbum/GetAlbumQueryHandler.cs
index e0d81c41..7bf9d626 100644
--- a/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Queries/GetAlbum/GetAlbumQueryHandler.cs
+++ b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Queries/GetAlbum/GetAlbumQueryHandler.cs
@@ -8,11 +8,15 @@ using Lumina.Application.Common.Infrastructure.Authorization.Policies.LibraryOwn
using Lumina.Application.Common.Infrastructure.Validation;
using Lumina.Application.Common.Mapping.MediaLibrary.AudioLibrary.MusicLibrary;
using Lumina.Application.Common.Mapping.MediaLibrary.AudioLibrary.MusicLibrary.Albums;
+using Lumina.Contracts.DTO.Common;
using Lumina.Contracts.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Albums;
using Lumina.Domain.Common.Errors;
using Lumina.Domain.Common.Primitives;
+using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary;
+using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary;
using System;
using System.Collections.Generic;
+using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using ApplicationErrors = Lumina.Application.Common.Errors.Errors;
@@ -88,6 +92,21 @@ public class GetAlbumQueryHandler : IQueryHandler> getArtworkResult = await _unitOfWork.MusicArtworkRepository.GetByOwnerAsync(MusicArtworkOwnerType.Album, albumId, cancellationToken).ConfigureAwait(false);
+ if (getArtworkResult.IsFailure)
+ return getArtworkResult.Errors;
+ string? coverPath = getArtworkResult.Value
+ .Where(artwork => artwork.ArtworkType == ArtworkType.Cover)
+ .Select(artwork => artwork.FileName)
+ .FirstOrDefault();
+
+ // Only the artwork whose file has already been stored can be presented, so the ones that are still pending resolution are left out.
+ List artwork = [.. getArtworkResult.Value
+ .Where(storedArtwork => !string.IsNullOrWhiteSpace(storedArtwork.FileName))
+ .Select(storedArtwork => new MediaArtworkDto(storedArtwork.ArtworkType, storedArtwork.Ordinal, storedArtwork.FileName!))];
+
+ return existingAlbum.ToResponse(coverPath, artwork);
}
}
diff --git a/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/DeleteArtist/DeleteArtistCommandHandler.cs b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/DeleteArtist/DeleteArtistCommandHandler.cs
index 5a6d2fbb..ed03a91b 100644
--- a/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/DeleteArtist/DeleteArtistCommandHandler.cs
+++ b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/DeleteArtist/DeleteArtistCommandHandler.cs
@@ -7,6 +7,7 @@ using Lumina.Application.Common.Infrastructure.Authentication;
using Lumina.Application.Common.Infrastructure.Authorization;
using Lumina.Application.Common.Infrastructure.Authorization.Policies.LibraryOwnership;
using Lumina.Application.Common.Infrastructure.Validation;
+using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artwork;
using Lumina.Domain.Common.Primitives;
using System;
using System.Collections.Generic;
@@ -24,6 +25,7 @@ namespace Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artists
public class DeleteArtistCommandHandler : ICommandHandler>
{
private readonly IUnitOfWork _unitOfWork;
+ private readonly IMusicArtworkCleanupService _musicArtworkCleanupService;
private readonly IAuthorizationService _authorizationService;
private readonly ICurrentUserService _currentUserService;
private readonly IValidator _validator;
@@ -32,12 +34,14 @@ public class DeleteArtistCommandHandler : ICommandHandler class.
///
/// Injected unit of work for interacting with the data access layer repositories.
+ /// Injected service for removing the artwork of a music library item and of its children.
/// Injected service for authorization related functionality.
/// Injected service to retrieve the current user information.
/// Injected validator for application validation rules.
- public DeleteArtistCommandHandler(IUnitOfWork unitOfWork, IAuthorizationService authorizationService, ICurrentUserService currentUserService, IValidator validator)
+ public DeleteArtistCommandHandler(IUnitOfWork unitOfWork, IMusicArtworkCleanupService musicArtworkCleanupService, IAuthorizationService authorizationService, ICurrentUserService currentUserService, IValidator validator)
{
_unitOfWork = unitOfWork;
+ _musicArtworkCleanupService = musicArtworkCleanupService;
_authorizationService = authorizationService;
_currentUserService = currentUserService;
_validator = validator;
@@ -92,6 +96,12 @@ public class DeleteArtistCommandHandler : ICommandHandler deleteArtworkResult = await _musicArtworkCleanupService.DeleteArtistArtworkAsync(artistId, cancellationToken).ConfigureAwait(false);
+ if (deleteArtworkResult.IsFailure)
+ return deleteArtworkResult.Errors;
+
Result deleteArtistResult = await _unitOfWork.ArtistRepository.DeleteByIdAsync(artistId, cancellationToken).ConfigureAwait(false);
if (deleteArtistResult.IsFailure)
return deleteArtistResult.Errors;
diff --git a/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/UpdateArtistCover/UpdateArtistCoverCommand.cs b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/UpdateArtistCover/UpdateArtistCoverCommand.cs
new file mode 100644
index 00000000..98bb23f2
--- /dev/null
+++ b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/UpdateArtistCover/UpdateArtistCoverCommand.cs
@@ -0,0 +1,22 @@
+#region ========================================================================= USING =====================================================================================
+using Lumina.Application.Common.CQRS;
+using System.Diagnostics;
+using System.IO;
+#endregion
+
+namespace Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artists.Commands.UpdateArtistCover;
+
+///
+/// Command for updating the cover image of an existing artist.
+///
+/// The unique identifier of the media library this artist belongs to, taken from the route.
+/// The unique identifier of the artist whose cover image is updated, taken from the route.
+/// The stream of the uploaded cover image file.
+/// The name of the uploaded cover image file.
+[DebuggerDisplay("ArtistId: {ArtistId} FileName: {FileName}")]
+public record UpdateArtistCoverCommand(
+ string? LibraryId,
+ string? ArtistId,
+ Stream? Cover,
+ string? FileName
+) : ICommand;
diff --git a/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/UpdateArtistCover/UpdateArtistCoverCommandHandler.cs b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/UpdateArtistCover/UpdateArtistCoverCommandHandler.cs
new file mode 100644
index 00000000..7b84738e
--- /dev/null
+++ b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/UpdateArtistCover/UpdateArtistCoverCommandHandler.cs
@@ -0,0 +1,144 @@
+#region ========================================================================= USING =====================================================================================
+using Lumina.Application.Common.CQRS;
+using Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary;
+using Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management;
+using Lumina.Application.Common.DataAccess.UoW;
+using Lumina.Application.Common.Infrastructure.Authentication;
+using Lumina.Application.Common.Infrastructure.Authorization;
+using Lumina.Application.Common.Infrastructure.Authorization.Policies.LibraryOwnership;
+using Lumina.Application.Common.Infrastructure.Validation;
+using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artwork;
+using Lumina.Contracts.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Artists;
+using Lumina.Domain.Common.Primitives;
+using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary;
+using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
+using ApplicationErrors = Lumina.Application.Common.Errors.Errors;
+using DomainErrors = Lumina.Domain.Common.Errors.Errors;
+#endregion
+
+namespace Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artists.Commands.UpdateArtistCover;
+
+///
+/// Handler for the command to update the cover image of an existing artist.
+///
+public class UpdateArtistCoverCommandHandler : ICommandHandler>
+{
+ private readonly IUnitOfWork _unitOfWork;
+ private readonly IMusicArtworkService _musicArtworkService;
+ private readonly IAuthorizationService _authorizationService;
+ private readonly ICurrentUserService _currentUserService;
+ private readonly IValidator _validator;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Injected unit of work for interacting with the data access layer repositories.
+ /// Injected service for storing the artwork of a music library item.
+ /// Injected service for authorization related functionality.
+ /// Injected service to retrieve the current user information.
+ /// Injected validator for application validation rules.
+ public UpdateArtistCoverCommandHandler(IUnitOfWork unitOfWork, IMusicArtworkService musicArtworkService, IAuthorizationService authorizationService, ICurrentUserService currentUserService, IValidator validator)
+ {
+ _unitOfWork = unitOfWork;
+ _musicArtworkService = musicArtworkService;
+ _authorizationService = authorizationService;
+ _currentUserService = currentUserService;
+ _validator = validator;
+ }
+
+ ///
+ /// Handles the command to update the cover image of an existing artist.
+ ///
+ /// The command to be handled.
+ /// Cancellation token that can be used to stop the execution.
+ ///
+ /// An containing either the response carrying the relative path of the stored cover image, or an error message.
+ ///
+ public async Task> HandleAsync(UpdateArtistCoverCommand command, CancellationToken cancellationToken)
+ {
+ List validationResult = _validator.Validate(command);
+ if (validationResult.Count > 0)
+ return validationResult;
+
+ // An authenticated request must always carry a user identity.
+ Guid? currentUserId = _currentUserService.UserId;
+ if (currentUserId is null)
+ return ApplicationErrors.Authorization.NotAuthorized;
+ Guid userId = currentUserId.Value;
+
+ // The validator guarantees that the route identifiers are non-empty Guids before this point.
+ Guid libraryId = Guid.Parse(command.LibraryId!);
+ Guid artistId = Guid.Parse(command.ArtistId!);
+
+ Result getArtistResult = await _unitOfWork.ArtistRepository.GetByIdAsync(artistId, shouldTrackEntities: false, cancellationToken: cancellationToken).ConfigureAwait(false);
+ if (getArtistResult.IsFailure)
+ return getArtistResult.Errors;
+ if (getArtistResult.Value is null)
+ return DomainErrors.Music.ArtistNotFound;
+ ArtistEntity existingArtist = getArtistResult.Value;
+
+ // Resource scoping: the artist must belong to the library named by the route, so that an artist can never be edited through another
+ // library's route; the mismatch is reported as not found, without disclosing that the artist exists in another library.
+ if (existingArtist.LibraryId != libraryId)
+ return DomainErrors.Music.ArtistNotFound;
+
+ // Admins can update the artists of all libraries; for everyone else, only the artists of the libraries they own.
+ bool canAccessLibrary = await _authorizationService.EvaluatePolicyAsync(
+ userId, new LibraryOwnershipPolicyContext(existingArtist.LibraryId), cancellationToken).ConfigureAwait(false);
+ if (!canAccessLibrary)
+ return ApplicationErrors.Authorization.NotAuthorized;
+
+ // The artwork is stored under the library and artist segments, so their names are resolved to keep the location consistent with the scanned artwork.
+ Result getLibraryResult = await _unitOfWork.LibraryRepository.GetByIdAsync(existingArtist.LibraryId, cancellationToken: cancellationToken).ConfigureAwait(false);
+ if (getLibraryResult.IsFailure)
+ return getLibraryResult.Errors;
+ if (getLibraryResult.Value is null)
+ return DomainErrors.Library.LibraryNotFound;
+ string libraryName = getLibraryResult.Value.Title;
+
+ // The existing cover of the artist is looked up, so that the previous file can be replaced as a whole instead of being left orphaned on disk.
+ Result> getArtworkResult = await _unitOfWork.MusicArtworkRepository.GetByOwnerAsync(MusicArtworkOwnerType.Artist, artistId, cancellationToken).ConfigureAwait(false);
+ if (getArtworkResult.IsFailure)
+ return getArtworkResult.Errors;
+ string? existingCoverPath = getArtworkResult.Value
+ .Where(artwork => artwork.ArtworkType == ArtworkType.Cover)
+ .Select(artwork => artwork.FileName)
+ .FirstOrDefault();
+
+ Result storeArtworkResult = await _musicArtworkService.SaveArtistArtworkAsync(
+ existingArtist.LibraryId,
+ libraryName,
+ existingArtist.Name,
+ command.Cover!,
+ command.FileName!,
+ cancellationToken).ConfigureAwait(false);
+ if (storeArtworkResult.IsFailure)
+ return storeArtworkResult.Errors;
+
+ // The stored cover of the artist is replaced as a whole: when the new cover is stored under a different name than the previous one
+ // (for example a png replacing a jpg), the previous file is removed, so that no orphaned artwork is left on disk without a reference.
+ if (!string.IsNullOrWhiteSpace(existingCoverPath) && existingCoverPath != storeArtworkResult.Value)
+ {
+ Result deleteResult = _musicArtworkService.DeleteStoredArtwork(existingCoverPath);
+ if (deleteResult.IsFailure)
+ return deleteResult.Errors;
+ }
+
+ // Map the newly stored cover image onto the artwork of the artist, replacing the existing cover or adding a new one.
+ Result upsertResult = await _unitOfWork.MusicArtworkRepository.UpsertCoverAsync(
+ MusicArtworkOwnerType.Artist, artistId, storeArtworkResult.Value, cancellationToken).ConfigureAwait(false);
+ if (upsertResult.IsFailure)
+ return upsertResult.Errors;
+
+ Result saveChangesResult = await _unitOfWork.SaveChangesAsync(cancellationToken).ConfigureAwait(false);
+ if (saveChangesResult.IsFailure)
+ return saveChangesResult.Errors;
+
+ return new UpdateArtistCoverResponse(storeArtworkResult.Value);
+ }
+}
diff --git a/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/UpdateArtistCover/UpdateArtistCoverCommandValidator.cs b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/UpdateArtistCover/UpdateArtistCoverCommandValidator.cs
new file mode 100644
index 00000000..384522da
--- /dev/null
+++ b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/UpdateArtistCover/UpdateArtistCoverCommandValidator.cs
@@ -0,0 +1,50 @@
+#region ========================================================================= USING =====================================================================================
+using Lumina.Application.Common.Infrastructure.Validation;
+using Lumina.Application.Common.Utilities;
+using Lumina.Domain.Common.Errors;
+using System;
+#endregion
+
+namespace Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artists.Commands.UpdateArtistCover;
+
+///
+/// Validates the needed validation rules for .
+///
+public class UpdateArtistCoverCommandValidator : AbstractValidator
+{
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public UpdateArtistCoverCommandValidator()
+ {
+ // Validates the identifier of the media library the artist belongs to, taken from the route.
+ RuleFor(command => command.LibraryId)
+ .NotEmpty()
+ .WithError(Errors.Library.LibraryIdCannotBeEmpty);
+
+ RuleFor(command => command.LibraryId)
+ .Must(libraryId => Guid.TryParse(libraryId, out Guid parsedLibraryId) && parsedLibraryId != Guid.Empty)
+ .When(command => command.LibraryId is not null && command.LibraryId.Length > 0)
+ .WithError(Errors.Library.LibraryIdCannotBeEmpty);
+
+ // Validates the identifier of the artist whose cover image is updated, taken from the route.
+ RuleFor(command => command.ArtistId)
+ .NotEmpty()
+ .WithError(Errors.Music.ArtistIdCannotBeEmpty);
+
+ RuleFor(command => command.ArtistId)
+ .Must(artistId => Guid.TryParse(artistId, out Guid parsedArtistId) && parsedArtistId != Guid.Empty)
+ .When(command => command.ArtistId is not null && command.ArtistId.Length > 0)
+ .WithError(Errors.Music.ArtistIdCannotBeEmpty);
+
+ // Validates the uploaded cover image.
+ RuleFor(command => command.Cover)
+ .NotNull()
+ .WithError(Errors.Music.CoverCannotBeNull);
+
+ RuleFor(command => command.FileName)
+ .NotEmpty()
+ .When(command => command.Cover is not null)
+ .WithError(Errors.FileSystemManagement.FileNameCannotBeEmpty);
+ }
+}
diff --git a/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtist/GetArtistQueryHandler.cs b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtist/GetArtistQueryHandler.cs
index 6f712640..b9d0c4f5 100644
--- a/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtist/GetArtistQueryHandler.cs
+++ b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtist/GetArtistQueryHandler.cs
@@ -11,8 +11,11 @@ using Lumina.Application.Common.Mapping.MediaLibrary.AudioLibrary.MusicLibrary.A
using Lumina.Contracts.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Artists;
using Lumina.Domain.Common.Errors;
using Lumina.Domain.Common.Primitives;
+using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary;
+using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary;
using System;
using System.Collections.Generic;
+using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using ApplicationErrors = Lumina.Application.Common.Errors.Errors;
@@ -87,6 +90,15 @@ public class GetArtistQueryHandler : IQueryHandler> getArtworkResult = await _unitOfWork.MusicArtworkRepository.GetByOwnerAsync(MusicArtworkOwnerType.Artist, artistId, cancellationToken).ConfigureAwait(false);
+ if (getArtworkResult.IsFailure)
+ return getArtworkResult.Errors;
+ string? coverPath = getArtworkResult.Value
+ .Where(artwork => artwork.ArtworkType == ArtworkType.Cover)
+ .Select(artwork => artwork.FileName)
+ .FirstOrDefault();
+
+ return existingArtist.ToResponse(coverPath);
}
}
diff --git a/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtistsLite/GetArtistsLiteQuery.cs b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtistsLite/GetArtistsLiteQuery.cs
index 53533ad6..04bc19e2 100644
--- a/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtistsLite/GetArtistsLiteQuery.cs
+++ b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtistsLite/GetArtistsLiteQuery.cs
@@ -1,6 +1,7 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Application.Common.CQRS;
using Lumina.Application.Common.DTO.Pagination;
+using Lumina.Domain.SharedKernel.Common.Enums.Common;
using System.Diagnostics;
#endregion
@@ -12,9 +13,17 @@ namespace Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artists
/// The unique identifier of the media library whose artists are retrieved, taken from the route.
/// The object containing the requested pagination data.
/// The search term used to filter the artists by name.
+/// The alpha key used to filter the artists by the first character of their name.
+/// Whether the leading "The " prefix of a name should be ignored when computing the alpha key, or not.
+/// The name of the field by which to sort the results.
+/// The direction in which to sort the results.
[DebuggerDisplay("LibraryId: {LibraryId}")]
public record GetArtistsLiteQuery(
string? LibraryId,
PaginationDataDto? PaginationData,
- string? SearchTerm
+ string? SearchTerm,
+ string? FilterAlphaKey,
+ bool ShouldIgnoreThePrefixForAlphaPicker,
+ string? SortBy,
+ SortOrder? SortOrder
) : IQuery;
diff --git a/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtistsLite/GetArtistsLiteQueryHandler.cs b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtistsLite/GetArtistsLiteQueryHandler.cs
index 01a281e2..5915245c 100644
--- a/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtistsLite/GetArtistsLiteQueryHandler.cs
+++ b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtistsLite/GetArtistsLiteQueryHandler.cs
@@ -78,12 +78,16 @@ public class GetArtistsLiteQueryHandler : IQueryHandler> getArtistsResult = await _unitOfWork.ArtistRepository.GetAllLiteAsync(
query.PaginationData,
- filterModel: filter,
+ query.SortBy,
+ query.SortOrder,
+ filter,
cancellationToken: cancellationToken).ConfigureAwait(false);
return getArtistsResult.Match(value => Result.From(value.ToResponses()), errors => errors);
}
diff --git a/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtistsLite/GetArtistsLiteQueryValidator.cs b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtistsLite/GetArtistsLiteQueryValidator.cs
index 3955889e..5825d84a 100644
--- a/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtistsLite/GetArtistsLiteQueryValidator.cs
+++ b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtistsLite/GetArtistsLiteQueryValidator.cs
@@ -1,4 +1,5 @@
#region ========================================================================= USING =====================================================================================
+using Lumina.Application.Common.DTO.Filtering;
using Lumina.Application.Common.Infrastructure.Validation;
using Lumina.Application.Common.Utilities;
using Lumina.Domain.Common.Errors;
@@ -26,5 +27,14 @@ public class GetArtistsLiteQueryValidator : AbstractValidator Guid.TryParse(libraryId, out Guid parsedLibraryId) && parsedLibraryId != Guid.Empty)
.When(query => query.LibraryId is not null && query.LibraryId.Length > 0)
.WithError(Errors.Library.LibraryIdCannotBeEmpty);
+
+ // The alpha key must be exactly one of the three picker bucket kinds, so that the filter specification can
+ // derive the key of a name unambiguously: no filter, a number bucket, a symbol bucket, or a single ASCII letter.
+ RuleFor(query => query.FilterAlphaKey)
+ .Must(alphaKey => alphaKey is null
+ || alphaKey == LibraryItemAlphaKeys.NUMBER
+ || alphaKey == LibraryItemAlphaKeys.SYMBOL
+ || (alphaKey.Length == 1 && char.IsAsciiLetter(alphaKey[0])))
+ .WithError(Errors.Library.InvalidFilterAlphaKey);
}
}
diff --git a/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artwork/IMusicArtworkCleanupService.cs b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artwork/IMusicArtworkCleanupService.cs
new file mode 100644
index 00000000..7da9ca4f
--- /dev/null
+++ b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artwork/IMusicArtworkCleanupService.cs
@@ -0,0 +1,38 @@
+#region ========================================================================= USING =====================================================================================
+using Lumina.Domain.Common.Primitives;
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+#endregion
+
+namespace Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artwork;
+
+///
+/// Interface for the service that removes the artwork records and the stored artwork files of a music library item, together with the artwork of its children.
+///
+public interface IMusicArtworkCleanupService
+{
+ ///
+ /// Removes the artwork records and the stored artwork files of the artist identified by , together with the artwork of its albums and tracks.
+ ///
+ /// The Id of the artist whose artwork is removed.
+ /// Cancellation token that can be used to stop the execution.
+ /// An representing either a successful operation, or an error.
+ Task> DeleteArtistArtworkAsync(Guid artistId, CancellationToken cancellationToken);
+
+ ///
+ /// Removes the artwork records and the stored artwork files of the album identified by , together with the artwork of its tracks.
+ ///
+ /// The Id of the album whose artwork is removed.
+ /// Cancellation token that can be used to stop the execution.
+ /// An representing either a successful operation, or an error.
+ Task> DeleteAlbumArtworkAsync(Guid albumId, CancellationToken cancellationToken);
+
+ ///
+ /// Removes the artwork records and the stored artwork files of the track identified by .
+ ///
+ /// The Id of the track whose artwork is removed.
+ /// Cancellation token that can be used to stop the execution.
+ /// An representing either a successful operation, or an error.
+ Task> DeleteTrackArtworkAsync(Guid trackId, CancellationToken cancellationToken);
+}
diff --git a/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artwork/IMusicArtworkService.cs b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artwork/IMusicArtworkService.cs
index 1754343c..3c1690e6 100644
--- a/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artwork/IMusicArtworkService.cs
+++ b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artwork/IMusicArtworkService.cs
@@ -2,6 +2,7 @@
using Lumina.Contracts.DTO.Common;
using Lumina.Domain.Common.Primitives;
using System;
+using System.IO;
using System.Threading;
using System.Threading.Tasks;
#endregion
@@ -22,10 +23,25 @@ public interface IMusicArtworkService
/// The name of the artist of the album.
/// The title of the album.
/// The artwork to store.
+ /// The name of the release type directory the album is stored under on disk, used to group the artwork of the different releases of an artist. When , no release type segment is added.
/// Cancellation token that can be used to stop the execution.
- /// The name of the release type directory the album is stored under on disk, used to group the artwork of the different releases of an artist. When omitted, no release type segment is added.
/// An containing either the relative path of the stored artwork, or an error.
- Task> SaveAlbumArtworkAsync(Guid libraryId, Guid albumId, string libraryName, string artistName, string albumTitle, ArtworkDto artwork, CancellationToken cancellationToken, string? releaseTypeName = null);
+ Task> SaveAlbumArtworkAsync(Guid libraryId, Guid albumId, string libraryName, string artistName, string albumTitle, ArtworkDto artwork, string? releaseTypeName, CancellationToken cancellationToken);
+
+ ///
+ /// Stores the uploaded of the album into the internal media directory, and returns the relative path of the stored artwork.
+ ///
+ /// The Id of the media library the album belongs to.
+ /// The Id of the album.
+ /// The name of the media library the album belongs to.
+ /// The name of the artist of the album.
+ /// The title of the album.
+ /// The stream of the uploaded artwork to store.
+ /// The name of the uploaded artwork file.
+ /// The name of the release type directory the album is stored under on disk, used to group the artwork of the different releases of an artist. When , no release type segment is added.
+ /// Cancellation token that can be used to stop the execution.
+ /// An containing either the relative path of the stored artwork, or an error.
+ Task> SaveAlbumArtworkAsync(Guid libraryId, Guid albumId, string libraryName, string artistName, string albumTitle, Stream artwork, string fileName, string? releaseTypeName, CancellationToken cancellationToken);
///
/// Deletes the stored artwork of the album from the internal media directory.
@@ -50,6 +66,18 @@ public interface IMusicArtworkService
/// An containing either the relative path of the stored artwork, or an error.
Task> SaveArtistArtworkAsync(Guid libraryId, string libraryName, string artistName, ArtworkDto artwork, CancellationToken cancellationToken);
+ ///
+ /// Stores the uploaded of the artist into the internal media directory, and returns the relative path of the stored artwork.
+ ///
+ /// The Id of the media library the artist belongs to.
+ /// The name of the media library the artist belongs to.
+ /// The name of the artist.
+ /// The stream of the uploaded artwork to store.
+ /// The name of the uploaded artwork file.
+ /// Cancellation token that can be used to stop the execution.
+ /// An containing either the relative path of the stored artwork, or an error.
+ Task> SaveArtistArtworkAsync(Guid libraryId, string libraryName, string artistName, Stream artwork, string fileName, CancellationToken cancellationToken);
+
///
/// Deletes the stored artwork of the artist from the internal media directory.
///
@@ -58,4 +86,11 @@ public interface IMusicArtworkService
/// The name of the artist.
/// An representing either a successful operation, or an error.
Result DeleteArtistArtwork(Guid libraryId, string libraryName, string artistName);
+
+ ///
+ /// Deletes the stored artwork file at from the internal media directory, when it still exists.
+ ///
+ /// The relative path of the stored artwork file.
+ /// An representing either a successful operation, or an error.
+ Result DeleteStoredArtwork(string artworkRelativePath);
}
diff --git a/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artwork/MusicArtworkCleanupService.cs b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artwork/MusicArtworkCleanupService.cs
new file mode 100644
index 00000000..42864d01
--- /dev/null
+++ b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artwork/MusicArtworkCleanupService.cs
@@ -0,0 +1,119 @@
+#region ========================================================================= USING =====================================================================================
+using Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary;
+using Lumina.Application.Common.DataAccess.UoW;
+using Lumina.Domain.Common.Primitives;
+using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary;
+using System;
+using System.Collections.Generic;
+using System.Threading;
+using System.Threading.Tasks;
+#endregion
+
+namespace Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artwork;
+
+///
+/// Service that removes the artwork records and the stored artwork files of a music library item, together with the artwork of its children.
+/// The artwork table is shared by all the music library item types and references its owners by a plain id, so the artwork of an item does not
+/// cascade when the item is removed, and is removed explicitly instead, from the innermost children outwards.
+///
+internal sealed class MusicArtworkCleanupService : IMusicArtworkCleanupService
+{
+ private readonly IUnitOfWork _unitOfWork;
+ private readonly IMusicArtworkService _musicArtworkService;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Injected unit of work for interacting with the data access layer repositories.
+ /// Injected service for removing the stored artwork files of a music library item.
+ public MusicArtworkCleanupService(IUnitOfWork unitOfWork, IMusicArtworkService musicArtworkService)
+ {
+ _unitOfWork = unitOfWork;
+ _musicArtworkService = musicArtworkService;
+ }
+
+ ///
+ /// Removes the artwork records and the stored artwork files of the artist identified by , together with the artwork of its albums and tracks.
+ ///
+ /// The Id of the artist whose artwork is removed.
+ /// Cancellation token that can be used to stop the execution.
+ /// An representing either a successful operation, or an error.
+ public async Task> DeleteArtistArtworkAsync(Guid artistId, CancellationToken cancellationToken)
+ {
+ // The albums and the tracks of the artist are removed by the database through the cascading foreign keys, so only the artwork of the
+ // children has to be collected here, and it has to be removed before the artwork of the artist itself, from the innermost children outwards.
+ Result> getAlbumsResult = await _unitOfWork.AlbumRepository.GetByArtistIdAsync(artistId, cancellationToken).ConfigureAwait(false);
+ if (getAlbumsResult.IsFailure)
+ return getAlbumsResult.Errors;
+
+ foreach (AlbumEntity album in getAlbumsResult.Value)
+ {
+ Result deleteAlbumArtworkResult = await DeleteAlbumArtworkAsync(album.Id, cancellationToken).ConfigureAwait(false);
+ if (deleteAlbumArtworkResult.IsFailure)
+ return deleteAlbumArtworkResult.Errors;
+ }
+
+ return await DeleteOwnerArtworkAsync(MusicArtworkOwnerType.Artist, artistId, cancellationToken).ConfigureAwait(false);
+ }
+
+ ///
+ /// Removes the artwork records and the stored artwork files of the album identified by , together with the artwork of its tracks.
+ ///
+ /// The Id of the album whose artwork is removed.
+ /// Cancellation token that can be used to stop the execution.
+ /// An representing either a successful operation, or an error.
+ public async Task> DeleteAlbumArtworkAsync(Guid albumId, CancellationToken cancellationToken)
+ {
+ // The tracks of the album are removed by the database through the cascading foreign keys, so only their artwork has to be removed here,
+ // before the artwork of the album itself.
+ Result> getTracksResult = await _unitOfWork.TrackRepository.GetByAlbumIdAsync(albumId, cancellationToken).ConfigureAwait(false);
+ if (getTracksResult.IsFailure)
+ return getTracksResult.Errors;
+
+ foreach (TrackEntity track in getTracksResult.Value)
+ {
+ Result deleteTrackArtworkResult = await DeleteTrackArtworkAsync(track.Id, cancellationToken).ConfigureAwait(false);
+ if (deleteTrackArtworkResult.IsFailure)
+ return deleteTrackArtworkResult.Errors;
+ }
+
+ return await DeleteOwnerArtworkAsync(MusicArtworkOwnerType.Album, albumId, cancellationToken).ConfigureAwait(false);
+ }
+
+ ///
+ /// Removes the artwork records and the stored artwork files of the track identified by .
+ ///
+ /// The Id of the track whose artwork is removed.
+ /// Cancellation token that can be used to stop the execution.
+ /// An representing either a successful operation, or an error.
+ public Task> DeleteTrackArtworkAsync(Guid trackId, CancellationToken cancellationToken)
+ {
+ return DeleteOwnerArtworkAsync(MusicArtworkOwnerType.Track, trackId, cancellationToken);
+ }
+
+ ///
+ /// Removes the artwork records and the stored artwork files of the single music library item identified by and .
+ ///
+ /// The type of the music library item whose artwork is removed.
+ /// The Id of the music library item whose artwork is removed.
+ /// Cancellation token that can be used to stop the execution.
+ /// An representing either a successful operation, or an error.
+ private async Task> DeleteOwnerArtworkAsync(MusicArtworkOwnerType ownerType, Guid ownerId, CancellationToken cancellationToken)
+ {
+ Result> getArtworkResult = await _unitOfWork.MusicArtworkRepository.GetByOwnerAsync(ownerType, ownerId, cancellationToken).ConfigureAwait(false);
+ if (getArtworkResult.IsFailure)
+ return getArtworkResult.Errors;
+
+ // The stored files do not cascade from their records either, so every stored file is removed before its record is; the artwork whose file has not been resolved yet has no file to remove.
+ foreach (MusicArtworkEntity artwork in getArtworkResult.Value)
+ {
+ if (string.IsNullOrWhiteSpace(artwork.FileName))
+ continue;
+ Result deleteStoredArtworkResult = _musicArtworkService.DeleteStoredArtwork(artwork.FileName);
+ if (deleteStoredArtworkResult.IsFailure)
+ return deleteStoredArtworkResult.Errors;
+ }
+
+ return await _unitOfWork.MusicArtworkRepository.DeleteByOwnerAsync(ownerType, ownerId, cancellationToken).ConfigureAwait(false);
+ }
+}
diff --git a/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/Commands/DeleteTrack/DeleteTrackCommandHandler.cs b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/Commands/DeleteTrack/DeleteTrackCommandHandler.cs
index 8237a549..5f7dfd3f 100644
--- a/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/Commands/DeleteTrack/DeleteTrackCommandHandler.cs
+++ b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/Commands/DeleteTrack/DeleteTrackCommandHandler.cs
@@ -8,6 +8,7 @@ using Lumina.Application.Common.Infrastructure.Authorization;
using Lumina.Application.Common.Infrastructure.Authorization.Policies.LibraryOwnership;
using Lumina.Application.Common.Infrastructure.Validation;
using Lumina.Application.Common.Mapping.MediaLibrary.AudioLibrary.MusicLibrary.Artists;
+using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artwork;
using Lumina.Domain.Common.Primitives;
using Lumina.Domain.Core.BoundedContexts.AudioLibraryBoundedContext.MusicLibraryAggregate;
using Lumina.Domain.Core.BoundedContexts.AudioLibraryBoundedContext.MusicLibraryAggregate.Entities;
@@ -28,6 +29,7 @@ namespace Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Tracks.
public class DeleteTrackCommandHandler : ICommandHandler>
{
private readonly IUnitOfWork _unitOfWork;
+ private readonly IMusicArtworkCleanupService _musicArtworkCleanupService;
private readonly IAuthorizationService _authorizationService;
private readonly ICurrentUserService _currentUserService;
private readonly IValidator _validator;
@@ -36,12 +38,14 @@ public class DeleteTrackCommandHandler : ICommandHandler class.
///
/// Injected unit of work for interacting with the data access layer repositories.
+ /// Injected service for removing the artwork of a music library item and of its children.
/// Injected service for authorization related functionality.
/// Injected service to retrieve the current user information.
/// Injected validator for application validation rules.
- public DeleteTrackCommandHandler(IUnitOfWork unitOfWork, IAuthorizationService authorizationService, ICurrentUserService currentUserService, IValidator validator)
+ public DeleteTrackCommandHandler(IUnitOfWork unitOfWork, IMusicArtworkCleanupService musicArtworkCleanupService, IAuthorizationService authorizationService, ICurrentUserService currentUserService, IValidator validator)
{
_unitOfWork = unitOfWork;
+ _musicArtworkCleanupService = musicArtworkCleanupService;
_authorizationService = authorizationService;
_currentUserService = currentUserService;
_validator = validator;
@@ -122,6 +126,12 @@ public class DeleteTrackCommandHandler : ICommandHandler deleteArtworkResult = await _musicArtworkCleanupService.DeleteTrackArtworkAsync(trackId, cancellationToken).ConfigureAwait(false);
+ if (deleteArtworkResult.IsFailure)
+ return deleteArtworkResult.Errors;
+
Result updateResult = await _unitOfWork.ArtistRepository.UpdateAsync(artistResult.Value.ToRepositoryEntity(), cancellationToken).ConfigureAwait(false);
if (updateResult.IsFailure)
return updateResult.Errors;
diff --git a/src/Lumina.Application/Core/MediaLibrary/Management/Events/LibraryDeletedDomainEventHandler.cs b/src/Lumina.Application/Core/MediaLibrary/Management/Events/LibraryDeletedDomainEventHandler.cs
index 17beb518..571372f6 100644
--- a/src/Lumina.Application/Core/MediaLibrary/Management/Events/LibraryDeletedDomainEventHandler.cs
+++ b/src/Lumina.Application/Core/MediaLibrary/Management/Events/LibraryDeletedDomainEventHandler.cs
@@ -1,7 +1,8 @@
#region ========================================================================= USING =====================================================================================
-using Lumina.Domain.Common.Primitives;
+using Lumina.Application.Common.DataAccess.UoW;
using Lumina.Application.Common.Infrastructure.Models.DTO.Configuration;
using Lumina.Domain.Common.Exceptions;
+using Lumina.Domain.Common.Primitives;
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Services;
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Strategies.Environment;
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.ValueObjects;
@@ -20,6 +21,7 @@ namespace Lumina.Application.Core.MediaLibrary.Management.Events;
///
public class LibraryDeletedDomainEventHandler : IDomainEventHandler
{
+ private readonly IUnitOfWork _unitOfWork;
private readonly IEnvironmentContext _environmentContext;
private readonly IPathService _pathService;
private readonly MediaSettingsDto _mediaSettingsModel;
@@ -27,11 +29,13 @@ public class LibraryDeletedDomainEventHandler : IDomainEventHandler
/// Initializes a new instance of the class.
///
+ /// Injected unit of work for interacting with the data access layer repositories.
/// Injected facade service for environment contextual services.
/// Injected service for handling file system paths.
/// Injected service for retrieving .
- public LibraryDeletedDomainEventHandler(IEnvironmentContext environmentContext, IPathService pathService, IOptions mediaSettingsModelOptions)
+ public LibraryDeletedDomainEventHandler(IUnitOfWork unitOfWork, IEnvironmentContext environmentContext, IPathService pathService, IOptions mediaSettingsModelOptions)
{
+ _unitOfWork = unitOfWork;
_environmentContext = environmentContext;
_pathService = pathService;
_mediaSettingsModel = mediaSettingsModelOptions.Value;
@@ -42,47 +46,80 @@ public class LibraryDeletedDomainEventHandler : IDomainEventHandler
/// The domain event to be handled.
/// Cancellation token that can be used to stop the execution.
- public ValueTask HandleAsync(LibraryDeletedDomainEvent domainEvent, CancellationToken cancellationToken)
+ public async ValueTask HandleAsync(LibraryDeletedDomainEvent domainEvent, CancellationToken cancellationToken)
{
- // delete the media library directory in the internal location for media library files
- Result libraryPathResult = GetLibraryPath(domainEvent.Library.Id.Value);
- if (libraryPathResult.IsFailure)
- throw new EventualConsistencyException(libraryPathResult.FirstError, libraryPathResult.Errors);
+ Guid libraryId = domainEvent.Library.Id.Value;
- Result newLibraryPathIdResult = FileSystemPathId.Create(libraryPathResult.Value);
- if (newLibraryPathIdResult.IsFailure)
- throw new EventualConsistencyException(newLibraryPathIdResult.FirstError, newLibraryPathIdResult.Errors);
+ // The media items of the library and their artwork do not cascade from the library row, because they reference it by a plain id,
+ // so they are removed first, otherwise they would be orphaned in the database. The artwork is removed before its owners, so that
+ // its owners are still present when the artwork is looked up.
+ Result deleteMusicArtworkResult = await _unitOfWork.MusicArtworkRepository.DeleteByLibraryIdAsync(libraryId, cancellationToken).ConfigureAwait(false);
+ if (deleteMusicArtworkResult.IsFailure)
+ throw new EventualConsistencyException(deleteMusicArtworkResult.FirstError, deleteMusicArtworkResult.Errors);
- Result deleteLibraryDirectoryResult = _environmentContext.DirectoryProviderService.DeleteDirectory(newLibraryPathIdResult.Value);
- if (deleteLibraryDirectoryResult.IsFailure)
- throw new EventualConsistencyException(deleteLibraryDirectoryResult.FirstError, deleteLibraryDirectoryResult.Errors);
-
- return ValueTask.CompletedTask;
+ // Deleting the artists removes their albums, tracks and their related data, through the cascading foreign keys.
+ Result deleteArtistsResult = await _unitOfWork.ArtistRepository.DeleteByLibraryIdAsync(libraryId, cancellationToken).ConfigureAwait(false);
+ if (deleteArtistsResult.IsFailure)
+ throw new EventualConsistencyException(deleteArtistsResult.FirstError, deleteArtistsResult.Errors);
+
+ // Deleting the books removes their artwork and their related data, through the cascading foreign keys.
+ Result deleteBooksResult = await _unitOfWork.BookRepository.DeleteByLibraryIdAsync(libraryId, cancellationToken).ConfigureAwait(false);
+ if (deleteBooksResult.IsFailure)
+ throw new EventualConsistencyException(deleteBooksResult.FirstError, deleteBooksResult.Errors);
+
+ // The staged music metadata of the library does not cascade from the library row either, so it is removed as well.
+ Result deleteStagedMusicMetadataResult = await _unitOfWork.MusicLibraryScanItemMetadataRepository.DeleteByLibraryIdAsync(libraryId, cancellationToken).ConfigureAwait(false);
+ if (deleteStagedMusicMetadataResult.IsFailure)
+ throw new EventualConsistencyException(deleteStagedMusicMetadataResult.FirstError, deleteStagedMusicMetadataResult.Errors);
+
+ // The cover image of the library is stored under the libraries directory, under a directory named after the library id,
+ // while the artwork of the media items of the library is stored under the per-media-type directories, under directories
+ // named after the library, so all of them must be removed when the library is deleted. All the media item files of a library
+ // live inside these directories, so removing them removes the library's stored media without touching the user's own files.
+ DeleteLibraryDirectory(_mediaSettingsModel.LibrariesDirectory, libraryId.ToString());
+
+ Result librarySegmentResult = _pathService.SanitizeSegment($"{domainEvent.Library.Title}-{libraryId}");
+ if (librarySegmentResult.IsFailure)
+ throw new EventualConsistencyException(librarySegmentResult.FirstError, librarySegmentResult.Errors);
+ DeleteLibraryDirectory(_mediaSettingsModel.BooksDirectory, librarySegmentResult.Value.Name);
+ DeleteLibraryDirectory(_mediaSettingsModel.MusicDirectory, librarySegmentResult.Value.Name);
}
///
- /// Gets the file system path of a media library identified by .
+ /// Deletes the directory of a media library from the internal media location of the provided media type.
///
- /// The id of the media library for which to regtrieve the file system path.
- ///
- /// An containing either the file system path of the media library, or an error message.
- ///
- private Result GetLibraryPath(Guid libraryId)
+ /// The name of the media type subdirectory the library directory is stored under.
+ /// The name of the directory of the media library.
+ private void DeleteLibraryDirectory(string mediaTypeDirectory, string libraryDirectoryName)
{
- // root directory for media
+ // Root directory for media.
Result rootPathResult = _pathService.CombinePath(AppContext.BaseDirectory, _mediaSettingsModel.RootDirectory);
if (rootPathResult.IsFailure)
- return rootPathResult.Errors;
+ throw new EventualConsistencyException(rootPathResult.FirstError, rootPathResult.Errors);
- // libraries directory
- Result librariesPathResult = _pathService.CombinePath(rootPathResult.Value, _mediaSettingsModel.LibrariesDirectory);
- if (librariesPathResult.IsFailure)
- return librariesPathResult.Errors;
+ // Media type directory.
+ Result mediaTypePathResult = _pathService.CombinePath(rootPathResult.Value, mediaTypeDirectory);
+ if (mediaTypePathResult.IsFailure)
+ throw new EventualConsistencyException(mediaTypePathResult.FirstError, mediaTypePathResult.Errors);
- // this new particular library' directory
- Result libraryPathResult = _pathService.CombinePath(librariesPathResult.Value, libraryId.ToString());
+ // This particular library's directory.
+ Result libraryPathResult = _pathService.CombinePath(mediaTypePathResult.Value, libraryDirectoryName);
if (libraryPathResult.IsFailure)
- return libraryPathResult.Errors;
- return libraryPathResult.Value;
+ throw new EventualConsistencyException(libraryPathResult.FirstError, libraryPathResult.Errors);
+
+ Result libraryPathIdResult = FileSystemPathId.Create(libraryPathResult.Value);
+ if (libraryPathIdResult.IsFailure)
+ throw new EventualConsistencyException(libraryPathIdResult.FirstError, libraryPathIdResult.Errors);
+
+ // The directory only exists when the library actually stored something under this media type, so a missing directory is not an error.
+ Result directoryExistsResult = _environmentContext.DirectoryProviderService.DirectoryExists(libraryPathIdResult.Value);
+ if (directoryExistsResult.IsFailure)
+ throw new EventualConsistencyException(directoryExistsResult.FirstError, directoryExistsResult.Errors);
+ if (!directoryExistsResult.Value)
+ return;
+
+ Result deleteLibraryDirectoryResult = _environmentContext.DirectoryProviderService.DeleteDirectory(libraryPathIdResult.Value);
+ if (deleteLibraryDirectoryResult.IsFailure)
+ throw new EventualConsistencyException(deleteLibraryDirectoryResult.FirstError, deleteLibraryDirectoryResult.Errors);
}
}
diff --git a/src/Lumina.Contracts/DTO/Common/MediaArtworkDto.cs b/src/Lumina.Contracts/DTO/Common/MediaArtworkDto.cs
new file mode 100644
index 00000000..7edd6862
--- /dev/null
+++ b/src/Lumina.Contracts/DTO/Common/MediaArtworkDto.cs
@@ -0,0 +1,19 @@
+#region ========================================================================= USING =====================================================================================
+using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary;
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Contracts.DTO.Common;
+
+///
+/// Data transfer object for a stored piece of artwork of a media item.
+///
+/// The type of the artwork, like the cover or the back of the media item.
+/// The ordinal of the artwork within its type, so that multiple artworks of the same type can be ordered.
+/// The relative path of the stored artwork file.
+[DebuggerDisplay("Type: {Type}, Ordinal: {Ordinal}, Path: {Path}")]
+public sealed record MediaArtworkDto(
+ ArtworkType Type,
+ int Ordinal,
+ string Path
+);
diff --git a/src/Lumina.Contracts/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Artists/GetArtistsLiteRequest.cs b/src/Lumina.Contracts/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Artists/GetArtistsLiteRequest.cs
index c4ff7444..82c4ca82 100644
--- a/src/Lumina.Contracts/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Artists/GetArtistsLiteRequest.cs
+++ b/src/Lumina.Contracts/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Artists/GetArtistsLiteRequest.cs
@@ -1,4 +1,5 @@
#region ========================================================================= USING =====================================================================================
+using Lumina.Domain.SharedKernel.Common.Enums.Common;
using System.Diagnostics;
#endregion
@@ -10,9 +11,21 @@ namespace Lumina.Contracts.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Artis
/// The page of results to retrieve. Optional.
/// The maximum number of artists to retrieve per page. Optional.
/// The search term used to filter the artists by name. Optional.
+///
+/// The alpha key used to filter the results by the first character of their name, for the alpha picker. Optional.
+/// Can be 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.
+///
+/// Whether the leading "The " prefix of a name should be ignored when computing the alpha key, or not. Optional.
+/// The name of the field by which to sort the results. Optional.
+/// The direction in which to sort the results. Optional.
[DebuggerDisplay("SearchTerm: {SearchTerm}")]
public record GetArtistsLiteRequest(
int? CurrentPage,
int? PerPage,
- string? SearchTerm
+ string? SearchTerm,
+ string? FilterAlphaKey,
+ bool ShouldIgnoreThePrefixForAlphaPicker,
+ string? SortBy,
+ SortOrder? SortOrder
);
diff --git a/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumLiteResponse.cs b/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumLiteResponse.cs
index ac6aa364..87411bb1 100644
--- a/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumLiteResponse.cs
+++ b/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumLiteResponse.cs
@@ -1,5 +1,7 @@
#region ========================================================================= USING =====================================================================================
+using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary;
using System;
+using System.Collections.Generic;
using System.Diagnostics;
#endregion
@@ -11,9 +13,15 @@ namespace Lumina.Contracts.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Albu
/// The Id of the album.
/// The title of the album.
/// The number of tracks of the release.
+/// The path of the image representing the album, if available.
+/// The release year of the album (the re-release year, if available, or the original release year), if known.
+/// The set of types of the release.
[DebuggerDisplay("Title: {Title}")]
public record AlbumLiteResponse(
Guid Id,
string Title,
- int TotalTracks
+ int TotalTracks,
+ string? CoverPath,
+ int? ReleaseYear,
+ List? ReleaseTypes
);
diff --git a/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumResponse.cs b/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumResponse.cs
index 84760c8f..cd72e94a 100644
--- a/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumResponse.cs
+++ b/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumResponse.cs
@@ -1,4 +1,5 @@
#region ========================================================================= USING =====================================================================================
+using Lumina.Contracts.DTO.Common;
using Lumina.Contracts.DTO.MediaContributors;
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary;
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
@@ -32,6 +33,8 @@ namespace Lumina.Contracts.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Albu
/// The list of references to the media contributors that performed on the album, each with the role they played.
/// The list of ratings for this album.
/// The list of tracks of the album.
+/// The path of the image representing the album, if available.
+/// The stored artwork of the album, in display order, so that all of its pieces can be presented, not just the cover.
[DebuggerDisplay("Title: {Metadata.Title}")]
public record AlbumResponse(
Guid Id,
@@ -51,5 +54,7 @@ public record AlbumResponse(
DateTime? UpdatedOnUtc,
List? Contributors,
List? Ratings,
- List? Tracks
+ List? Tracks,
+ string? CoverPath,
+ IReadOnlyList Artwork
);
diff --git a/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCoverResponse.cs b/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCoverResponse.cs
new file mode 100644
index 00000000..eb6ca6a4
--- /dev/null
+++ b/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCoverResponse.cs
@@ -0,0 +1,14 @@
+#region ========================================================================= USING =====================================================================================
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Contracts.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Albums;
+
+///
+/// Represents a response of an update album cover operation.
+///
+/// The relative path of the stored cover image.
+[DebuggerDisplay("CoverPath: {CoverPath}")]
+public record UpdateAlbumCoverResponse(
+ string CoverPath
+);
diff --git a/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistLiteResponse.cs b/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistLiteResponse.cs
index aa4b7faf..f5cc8ea7 100644
--- a/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistLiteResponse.cs
+++ b/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistLiteResponse.cs
@@ -10,8 +10,10 @@ namespace Lumina.Contracts.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Arti
///
/// The Id of the artist.
/// The name of the artist.
+/// The path of the image representing the artist, if available.
[DebuggerDisplay("Name: {Name}")]
public record ArtistLiteResponse(
Guid Id,
- string Name
+ string Name,
+ string? CoverPath
);
diff --git a/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistResponse.cs b/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistResponse.cs
index ec147700..9a51928c 100644
--- a/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistResponse.cs
+++ b/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistResponse.cs
@@ -25,6 +25,7 @@ namespace Lumina.Contracts.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Arti
/// The list of references to the media contributors that make up the artist, each with the role they played.
/// The list of ratings for this artist.
/// The list of albums of the artist, each with its own list of tracks.
+/// The path of the image representing the artist, if available.
[DebuggerDisplay("Name: {Metadata.Name}")]
public record ArtistResponse(
Guid Id,
@@ -38,5 +39,6 @@ public record ArtistResponse(
DateTime? UpdatedOnUtc,
List? Contributors,
List? Ratings,
- List? Albums
+ List? Albums,
+ string? CoverPath
);
diff --git a/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Artists/UpdateArtistCoverResponse.cs b/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Artists/UpdateArtistCoverResponse.cs
new file mode 100644
index 00000000..dc45d9f9
--- /dev/null
+++ b/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Artists/UpdateArtistCoverResponse.cs
@@ -0,0 +1,14 @@
+#region ========================================================================= USING =====================================================================================
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Contracts.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Artists;
+
+///
+/// Represents a response of an update artist cover operation.
+///
+/// The relative path of the stored cover image.
+[DebuggerDisplay("CoverPath: {CoverPath}")]
+public record UpdateArtistCoverResponse(
+ string CoverPath
+);
diff --git a/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/TrackLiteResponse.cs b/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/TrackLiteResponse.cs
index 263b3669..071776ea 100644
--- a/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/TrackLiteResponse.cs
+++ b/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/TrackLiteResponse.cs
@@ -12,10 +12,12 @@ namespace Lumina.Contracts.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Trac
/// The title of the track.
/// The number of the track on its disc.
/// The number of the disc the track belongs to, if applicable.
+/// The duration of the track in seconds.
[DebuggerDisplay("Title: {Title}")]
public record TrackLiteResponse(
Guid Id,
string Title,
int TrackNumber,
- int? DiscNumber
+ int? DiscNumber,
+ int DurationInSeconds
);
diff --git a/src/Lumina.DataAccess/Core/Repositories/BookLibrary/BookRepository.cs b/src/Lumina.DataAccess/Core/Repositories/BookLibrary/BookRepository.cs
index b1490003..9269db51 100644
--- a/src/Lumina.DataAccess/Core/Repositories/BookLibrary/BookRepository.cs
+++ b/src/Lumina.DataAccess/Core/Repositories/BookLibrary/BookRepository.cs
@@ -462,6 +462,21 @@ internal sealed class BookRepository : IBookRepository
return Result.Updated;
}
+ ///
+ /// Deletes all the books of the media library identified by , together with their artwork and their related data.
+ ///
+ /// The Id of the media library whose books are deleted.
+ /// Cancellation token that can be used to stop the execution.
+ /// An representing either a successful operation, or an error.
+ public async Task> DeleteByLibraryIdAsync(Guid libraryId, CancellationToken cancellationToken)
+ {
+ // The artwork and the related data of the books are removed by the database, through the cascading foreign keys.
+ await _luminaDbContext.Books
+ .Where(book => book.LibraryId == libraryId)
+ .ExecuteDeleteAsync(cancellationToken).ConfigureAwait(false);
+ return Result.Deleted;
+ }
+
///
/// Gets the display names of the author of the books identified by the provided ,
/// keyed by the Id of the book, or when a book has no author.
diff --git a/src/Lumina.DataAccess/Core/Repositories/BookLibrary/Specifications/BookAlphaFilterSpecification.cs b/src/Lumina.DataAccess/Core/Repositories/BookLibrary/Specifications/BookAlphaFilterSpecification.cs
index 790cd379..f84fa553 100644
--- a/src/Lumina.DataAccess/Core/Repositories/BookLibrary/Specifications/BookAlphaFilterSpecification.cs
+++ b/src/Lumina.DataAccess/Core/Repositories/BookLibrary/Specifications/BookAlphaFilterSpecification.cs
@@ -42,7 +42,7 @@ internal sealed class BookAlphaFilterSpecification : FilterSpecificationAn expression tree that can be used to evaluate whether a satisfies the specification criteria.
public override Expression> ToExpression()
{
- // when no alpha key was requested, every book matches
+ // When no alpha key was requested, every book matches.
if (_filterAlphaKey is null)
return book => true;
@@ -55,7 +55,7 @@ internal sealed class BookAlphaFilterSpecification : FilterSpecification releaseType.ReleaseType).ToList(),
+ // The cover of the album is the cover artwork stored for it, if any, and it is exposed so that the clients can display it without loading the whole album.
+ CoverPath = _luminaDbContext.MusicArtwork
+ .Where(artwork => artwork.OwnerType == MusicArtworkOwnerType.Album && artwork.OwnerId == album.Id && artwork.ArtworkType == ArtworkType.Cover)
+ .Select(artwork => artwork.FileName)
+ .FirstOrDefault()
});
if (paginationData is null)
diff --git a/src/Lumina.DataAccess/Core/Repositories/MusicLibrary/ArtistRepository.cs b/src/Lumina.DataAccess/Core/Repositories/MusicLibrary/ArtistRepository.cs
index fea91e76..ff9a8e08 100644
--- a/src/Lumina.DataAccess/Core/Repositories/MusicLibrary/ArtistRepository.cs
+++ b/src/Lumina.DataAccess/Core/Repositories/MusicLibrary/ArtistRepository.cs
@@ -18,6 +18,8 @@ using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Linq.Expressions;
+using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
#endregion
@@ -29,6 +31,10 @@ namespace Lumina.DataAccess.Core.Repositories.MusicLibrary;
///
internal sealed class ArtistRepository : IArtistRepository
{
+ private static readonly MethodInfo s_toLowerMethod = typeof(string).GetMethod(nameof(string.ToLower), Type.EmptyTypes)!;
+ private static readonly MethodInfo s_startsWithMethod = typeof(string).GetMethod(nameof(string.StartsWith), [typeof(string)])!;
+ private static readonly MethodInfo s_substringMethod = typeof(string).GetMethod(nameof(string.Substring), [typeof(int)])!;
+
private readonly LuminaDbContext _luminaDbContext;
private readonly IAlbumRepository _albumRepository;
private readonly ITrackRepository _trackRepository;
@@ -488,7 +494,7 @@ internal sealed class ArtistRepository : IArtistRepository
if (filterSpecification is not null)
artistsQuery = artistsQuery.Where(filterSpecification.ToExpression());
- IQueryable orderedArtistsQuery = ApplySorting(artistsQuery, sortBy, sortOrder ?? SortOrder.Ascending);
+ IQueryable orderedArtistsQuery = ApplySorting(artistsQuery, sortBy, sortOrder ?? SortOrder.Ascending, libraryFilter.ShouldIgnoreThePrefixForAlphaPicker);
// If no pagination was requested, return all the artists of the library.
if (paginationData is null)
@@ -559,11 +565,16 @@ internal sealed class ArtistRepository : IArtistRepository
if (filterSpecification is not null)
artistsQuery = artistsQuery.Where(filterSpecification.ToExpression());
- IQueryable liteRowsQuery = ApplySorting(artistsQuery, sortBy, sortOrder ?? SortOrder.Ascending)
+ IQueryable liteRowsQuery = ApplySorting(artistsQuery, sortBy, sortOrder ?? SortOrder.Ascending, libraryFilter.ShouldIgnoreThePrefixForAlphaPicker)
.Select(artist => new ArtistLiteRow
{
Id = artist.Id,
- Name = artist.Name
+ Name = artist.Name,
+ // The cover of the artist is the cover artwork stored for it, if any, and it is exposed so that the clients can display it without loading the whole artist.
+ CoverPath = _luminaDbContext.MusicArtwork
+ .Where(artwork => artwork.OwnerType == MusicArtworkOwnerType.Artist && artwork.OwnerId == artist.Id && artwork.ArtworkType == ArtworkType.Cover)
+ .Select(artwork => artwork.FileName)
+ .FirstOrDefault()
});
// If no pagination was requested, return all the artists of the library.
@@ -607,11 +618,22 @@ internal sealed class ArtistRepository : IArtistRepository
/// A filter specification that can be used to query artists matching the provided criteria.
private static FilterSpecification? BuildFilterSpecification(LibraryFilterDto libraryFilter)
{
+ FilterSpecification? filterSpecification = null;
+
// Include the search term filter, if provided.
if (!string.IsNullOrWhiteSpace(libraryFilter.SearchTerm))
- return new ArtistSearchSpecification(libraryFilter.SearchTerm);
+ filterSpecification = new ArtistSearchSpecification(libraryFilter.SearchTerm);
- return null;
+ // Include the alpha key filter, if provided.
+ if (libraryFilter.FilterAlphaKey is not null)
+ {
+ ArtistAlphaFilterSpecification alphaFilterSpecification = new(libraryFilter.FilterAlphaKey, libraryFilter.ShouldIgnoreThePrefixForAlphaPicker);
+ filterSpecification = filterSpecification is null
+ ? alphaFilterSpecification
+ : filterSpecification.And(alphaFilterSpecification);
+ }
+
+ return filterSpecification;
}
///
@@ -620,8 +642,8 @@ internal sealed class ArtistRepository : IArtistRepository
/// The query to sort.
/// The field to sort by (case-insensitive).
/// The direction of the sorting.
- /// An ordered artists query.
- private static IOrderedQueryable ApplySorting(IQueryable artistsQuery, string? sortBy, SortOrder sortOrder)
+ /// Whether a leading "the " prefix of a name is ignored when deriving the name sort key, or not.
+ private static IOrderedQueryable ApplySorting(IQueryable artistsQuery, string? sortBy, SortOrder sortOrder, bool shouldIgnoreThePrefixForAlphaPicker)
{
return sortBy?.ToLowerInvariant() switch
{
@@ -638,11 +660,41 @@ internal sealed class ArtistRepository : IArtistRepository
? artistsQuery.OrderByDescending(artist => artist.UpdatedOnUtc).ThenBy(artist => artist.Id)
: artistsQuery.OrderBy(artist => artist.UpdatedOnUtc).ThenBy(artist => artist.Id),
_ => sortOrder == SortOrder.Descending
- ? artistsQuery.OrderByDescending(artist => artist.Name).ThenBy(artist => artist.Id)
- : artistsQuery.OrderBy(artist => artist.Name).ThenBy(artist => artist.Id),
+ ? artistsQuery.OrderByDescending(BuildNameSortKey(shouldIgnoreThePrefixForAlphaPicker)).ThenBy(artist => artist.Id)
+ : artistsQuery.OrderBy(BuildNameSortKey(shouldIgnoreThePrefixForAlphaPicker)).ThenBy(artist => artist.Id),
};
}
+ ///
+ /// Builds the expression that derives the name sort key of an artist, matching the effective name used by the alpha filter:
+ /// the name lowercased, falling back to an empty string when the name is , and optionally
+ /// stripped of a leading "the " prefix.
+ ///
+ /// Whether a leading "the " prefix of a name is ignored when deriving the name sort key, or not.
+ /// An expression that evaluates to the name sort key of an artist.
+ private static Expression> BuildNameSortKey(bool shouldIgnoreThePrefixForAlphaPicker)
+ {
+ ParameterExpression artist = Expression.Parameter(typeof(ArtistEntity), "artist");
+
+ Expression nameProperty = Expression.Property(artist, nameof(ArtistEntity.Name));
+
+ // The raw name: the name, unless it is null, in which case an empty string is used.
+ Expression rawName = Expression.Coalesce(nameProperty, Expression.Constant(string.Empty));
+
+ MethodCallExpression lowerName = Expression.Call(rawName, s_toLowerMethod);
+
+ // When ignoring the "The " prefix, strip a leading "the " from the lowercased name.
+ Expression effectiveName = lowerName;
+ if (shouldIgnoreThePrefixForAlphaPicker)
+ {
+ MethodCallExpression startsWithThe = Expression.Call(lowerName, s_startsWithMethod, Expression.Constant("the "));
+ MethodCallExpression strippedName = Expression.Call(lowerName, s_substringMethod, Expression.Constant(4));
+ effectiveName = Expression.Condition(startsWithThe, strippedName, lowerName);
+ }
+
+ return Expression.Lambda>(effectiveName, artist);
+ }
+
///
/// Gets the artist of the library identified by that has the provided .
///
@@ -793,4 +845,19 @@ internal sealed class ArtistRepository : IArtistRepository
.ExecuteUpdateAsync(setters => setters.SetProperty(artist => artist.MetadataStatus, MetadataStatus.Pending), cancellationToken).ConfigureAwait(false);
return Result.Updated;
}
+
+ ///
+ /// Deletes all the artists of the media library identified by , together with their albums and tracks and their related data.
+ ///
+ /// The Id of the media library whose artists are deleted.
+ /// Cancellation token that can be used to stop the execution.
+ /// An representing either a successful operation, or an error.
+ public async Task> DeleteByLibraryIdAsync(Guid libraryId, CancellationToken cancellationToken)
+ {
+ // The albums, tracks and the related data of the artists are removed by the database, through the cascading foreign keys.
+ await _luminaDbContext.Artists
+ .Where(artist => artist.LibraryId == libraryId)
+ .ExecuteDeleteAsync(cancellationToken).ConfigureAwait(false);
+ return Result.Deleted;
+ }
}
diff --git a/src/Lumina.DataAccess/Core/Repositories/MusicLibrary/MusicArtworkRepository.cs b/src/Lumina.DataAccess/Core/Repositories/MusicLibrary/MusicArtworkRepository.cs
index ceb8f38e..f9f56768 100644
--- a/src/Lumina.DataAccess/Core/Repositories/MusicLibrary/MusicArtworkRepository.cs
+++ b/src/Lumina.DataAccess/Core/Repositories/MusicLibrary/MusicArtworkRepository.cs
@@ -85,25 +85,84 @@ internal sealed class MusicArtworkRepository : IMusicArtworkRepository
/// An representing either a successful operation, or an error.
public async Task> ResetStatusForLibraryAsync(Guid libraryId, CancellationToken cancellationToken)
{
- // The artwork table is shared by all the music library item types, so the owners of the artwork of this library are collected per type.
- List artistIds = await _luminaDbContext.Artists
- .Where(artist => artist.LibraryId == libraryId)
- .Select(artist => artist.Id)
- .ToListAsync(cancellationToken).ConfigureAwait(false);
- List albumIds = await _luminaDbContext.Albums
- .Where(album => album.LibraryId == libraryId)
- .Select(album => album.Id)
- .ToListAsync(cancellationToken).ConfigureAwait(false);
- List trackIds = await _luminaDbContext.Tracks
- .Where(track => track.LibraryId == libraryId)
- .Select(track => track.Id)
- .ToListAsync(cancellationToken).ConfigureAwait(false);
-
+ // The artwork table is shared by all the music library item types, so the owner of a piece of artwork is matched by its type against the
+ // corresponding table, and the database resolves the membership of the owner in the library by a correlated subquery. Collecting the ids
+ // of every artist, album and track of the library in memory first would make the cost of the operation grow with the size of the library.
await _luminaDbContext.MusicArtwork
- .Where(musicArtwork => (musicArtwork.OwnerType == MusicArtworkOwnerType.Artist && artistIds.Contains(musicArtwork.OwnerId))
- || (musicArtwork.OwnerType == MusicArtworkOwnerType.Album && albumIds.Contains(musicArtwork.OwnerId))
- || (musicArtwork.OwnerType == MusicArtworkOwnerType.Track && trackIds.Contains(musicArtwork.OwnerId)))
+ .Where(musicArtwork => (musicArtwork.OwnerType == MusicArtworkOwnerType.Artist
+ && _luminaDbContext.Artists.Any(artist => artist.Id == musicArtwork.OwnerId && artist.LibraryId == libraryId))
+ || (musicArtwork.OwnerType == MusicArtworkOwnerType.Album
+ && _luminaDbContext.Albums.Any(album => album.Id == musicArtwork.OwnerId && album.LibraryId == libraryId))
+ || (musicArtwork.OwnerType == MusicArtworkOwnerType.Track
+ && _luminaDbContext.Tracks.Any(track => track.Id == musicArtwork.OwnerId && track.LibraryId == libraryId)))
.ExecuteUpdateAsync(setters => setters.SetProperty(musicArtwork => musicArtwork.Status, ArtworkStatus.Pending), cancellationToken).ConfigureAwait(false);
return Result.Updated;
}
+
+ ///
+ /// Deletes all the pieces of artwork owned by the artists, albums and tracks of the media library identified by .
+ ///
+ /// The Id of the media library whose artwork is deleted.
+ /// Cancellation token that can be used to stop the execution.
+ /// An representing either a successful operation, or an error.
+ public async Task> DeleteByLibraryIdAsync(Guid libraryId, CancellationToken cancellationToken)
+ {
+ // The artwork table is shared by all the music library item types, so the owner of a piece of artwork is matched by its type against the
+ // corresponding table, and the database resolves the membership of the owner in the library by a correlated subquery. Collecting the ids
+ // of every artist, album and track of the library in memory first would make the cost of the operation grow with the size of the library.
+ await _luminaDbContext.MusicArtwork
+ .Where(musicArtwork => (musicArtwork.OwnerType == MusicArtworkOwnerType.Artist
+ && _luminaDbContext.Artists.Any(artist => artist.Id == musicArtwork.OwnerId && artist.LibraryId == libraryId))
+ || (musicArtwork.OwnerType == MusicArtworkOwnerType.Album
+ && _luminaDbContext.Albums.Any(album => album.Id == musicArtwork.OwnerId && album.LibraryId == libraryId))
+ || (musicArtwork.OwnerType == MusicArtworkOwnerType.Track
+ && _luminaDbContext.Tracks.Any(track => track.Id == musicArtwork.OwnerId && track.LibraryId == libraryId)))
+ .ExecuteDeleteAsync(cancellationToken).ConfigureAwait(false);
+ return Result.Deleted;
+ }
+
+ ///
+ /// Stores the cover image of the music library item of the provided identified by .
+ ///
+ /// The type of the music library item that owns the artwork.
+ /// The Id of the music library item that owns the artwork.
+ /// The relative file name of the stored cover image.
+ /// Cancellation token that can be used to stop the execution.
+ /// An representing either a successful operation, or an error.
+ public async Task> UpsertCoverAsync(MusicArtworkOwnerType ownerType, Guid ownerId, string fileName, CancellationToken cancellationToken)
+ {
+ // The existing cover is matched the same way the callers that resolve it do, by owner and artwork type only, so that a cover stored
+ // with an ordinal other than zero is replaced in place instead of a second cover row being inserted next to it.
+ MusicArtworkEntity? existingCover = await _luminaDbContext.MusicArtwork
+ .FirstOrDefaultAsync(musicArtwork => musicArtwork.OwnerType == ownerType
+ && musicArtwork.OwnerId == ownerId
+ && musicArtwork.ArtworkType == ArtworkType.Cover, cancellationToken).ConfigureAwait(false);
+
+ DateTime now = DateTime.UtcNow;
+ if (existingCover is null)
+ {
+ _luminaDbContext.MusicArtwork.Add(new MusicArtworkEntity
+ {
+ Id = Guid.NewGuid(),
+ OwnerType = ownerType,
+ OwnerId = ownerId,
+ ArtworkType = ArtworkType.Cover,
+ Ordinal = 0,
+ FileName = fileName,
+ Status = ArtworkStatus.Enriched,
+ CreatedOnUtc = now,
+ CreatedBy = Guid.Empty,
+ // The audit columns are owned by the auditing interceptor, which stamps only the rows that actually changed, so they are never mapped here.
+ UpdatedOnUtc = null,
+ UpdatedBy = null
+ });
+ }
+ else
+ {
+ existingCover.FileName = fileName;
+ existingCover.Status = ArtworkStatus.Enriched;
+ existingCover.LastUpdateUtc = now;
+ }
+ return Result.Updated;
+ }
}
diff --git a/src/Lumina.DataAccess/Core/Repositories/MusicLibrary/MusicLibraryScanItemMetadataRepository.cs b/src/Lumina.DataAccess/Core/Repositories/MusicLibrary/MusicLibraryScanItemMetadataRepository.cs
index f2810e93..9ca1d53d 100644
--- a/src/Lumina.DataAccess/Core/Repositories/MusicLibrary/MusicLibraryScanItemMetadataRepository.cs
+++ b/src/Lumina.DataAccess/Core/Repositories/MusicLibrary/MusicLibraryScanItemMetadataRepository.cs
@@ -71,4 +71,18 @@ internal sealed class MusicLibraryScanItemMetadataRepository : IMusicLibraryScan
.ExecuteDeleteAsync(cancellationToken).ConfigureAwait(false);
return Result.Deleted;
}
+
+ ///
+ /// Deletes all the staged music metadata items of the media library identified by .
+ ///
+ /// The Id of the media library whose staged music metadata is deleted.
+ /// Cancellation token that can be used to stop the execution.
+ /// An representing either a successful operation, or an error.
+ public async Task> DeleteByLibraryIdAsync(Guid libraryId, CancellationToken cancellationToken)
+ {
+ await _luminaDbContext.MusicLibraryScanItemMetadata
+ .Where(musicMetadata => musicMetadata.LibraryId == libraryId)
+ .ExecuteDeleteAsync(cancellationToken).ConfigureAwait(false);
+ return Result.Deleted;
+ }
}
diff --git a/src/Lumina.DataAccess/Core/Repositories/MusicLibrary/Specifications/ArtistAlphaFilterSpecification.cs b/src/Lumina.DataAccess/Core/Repositories/MusicLibrary/Specifications/ArtistAlphaFilterSpecification.cs
new file mode 100644
index 00000000..c178cafe
--- /dev/null
+++ b/src/Lumina.DataAccess/Core/Repositories/MusicLibrary/Specifications/ArtistAlphaFilterSpecification.cs
@@ -0,0 +1,127 @@
+#region ========================================================================= USING =====================================================================================
+using Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary;
+using Lumina.Application.Common.DTO.Filtering;
+using Lumina.Application.Common.Specifications;
+using Microsoft.EntityFrameworkCore;
+using System;
+using System.Linq.Expressions;
+using System.Reflection;
+#endregion
+
+namespace Lumina.DataAccess.Core.Repositories.MusicLibrary.Specifications;
+
+///
+/// Represents a filter specification for filtering artists by the alpha key of their name, for the alpha picker.
+/// The alpha key is the first character of the name, lowercased, and optionally computed after ignoring a leading "The " prefix.
+///
+internal sealed class ArtistAlphaFilterSpecification : FilterSpecification
+{
+ private static readonly MethodInfo s_toLowerMethod = typeof(string).GetMethod(nameof(string.ToLower), Type.EmptyTypes)!;
+ private static readonly MethodInfo s_startsWithMethod = typeof(string).GetMethod(nameof(string.StartsWith), [typeof(string)])!;
+ private static readonly MethodInfo s_substringMethod = typeof(string).GetMethod(nameof(string.Substring), [typeof(int)])!;
+ private static readonly MethodInfo s_globMethod = typeof(SqliteDbFunctionsExtensions)
+ .GetMethod(nameof(SqliteDbFunctionsExtensions.Glob), [typeof(DbFunctions), typeof(string), typeof(string)])!;
+
+ private readonly string? _filterAlphaKey;
+ private readonly bool _shouldIgnoreThePrefixForAlphaPicker;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The alpha key to filter by. A single ASCII letter, , or .
+ /// Whether the leading "The " prefix of a name should be ignored when computing the alpha key, or not.
+ public ArtistAlphaFilterSpecification(string? filterAlphaKey, bool shouldIgnoreThePrefixForAlphaPicker)
+ {
+ _filterAlphaKey = filterAlphaKey;
+ _shouldIgnoreThePrefixForAlphaPicker = shouldIgnoreThePrefixForAlphaPicker;
+ }
+
+ ///
+ /// Creates a LINQ expression that represents the predicate defined by the current specification.
+ ///
+ /// An expression tree that can be used to evaluate whether an satisfies the specification criteria.
+ public override Expression> ToExpression()
+ {
+ // When no alpha key was requested, every artist matches.
+ if (_filterAlphaKey is null)
+ return artist => true;
+
+ ParameterExpression artist = Expression.Parameter(typeof(ArtistEntity), "artist");
+ Expression effectiveName = BuildEffectiveName(artist);
+
+ if (_filterAlphaKey == LibraryItemAlphaKeys.NUMBER)
+ return BuildGlobPredicate(artist, effectiveName, "[0-9]*");
+
+ if (_filterAlphaKey == LibraryItemAlphaKeys.SYMBOL)
+ return BuildSymbolPredicate(artist, effectiveName);
+
+ // The alpha key is a single ASCII letter.
+ string globPattern = char.ToLowerInvariant(_filterAlphaKey[0]) + "*";
+ return BuildGlobPredicate(artist, effectiveName, globPattern);
+ }
+
+ ///
+ /// Builds the expression representing the lowercased name used to derive the alpha key, falling back to an empty string
+ /// when the name is or empty, and optionally stripped of a leading "the " prefix.
+ ///
+ /// The parameter representing the artist entity.
+ /// The expression of the effective name.
+ private Expression BuildEffectiveName(ParameterExpression artist)
+ {
+ Expression nameProperty = Expression.Property(artist, nameof(ArtistEntity.Name));
+
+ // The raw name is the name, unless it is null, in which case an empty string is used.
+ Expression rawName = Expression.Coalesce(nameProperty, Expression.Constant(string.Empty));
+
+ MethodCallExpression lowerName = Expression.Call(rawName, s_toLowerMethod);
+
+ // When ignoring the "The " prefix, a leading "the " is stripped from the lowercased name.
+ Expression effectiveName = lowerName;
+ if (_shouldIgnoreThePrefixForAlphaPicker)
+ {
+ MethodCallExpression startsWithThe = Expression.Call(lowerName, s_startsWithMethod, Expression.Constant("the "));
+ MethodCallExpression strippedName = Expression.Call(lowerName, s_substringMethod, Expression.Constant(4));
+ effectiveName = Expression.Condition(startsWithThe, strippedName, lowerName);
+ }
+
+ return effectiveName;
+ }
+
+ ///
+ /// Builds a predicate that is satisfied when the effective name starts with a glob pattern.
+ ///
+ /// The parameter representing the artist entity.
+ /// The expression of the effective name.
+ /// The glob pattern the effective name must match.
+ /// The built predicate.
+ private static Expression> BuildGlobPredicate(ParameterExpression artist, Expression effectiveName, string globPattern)
+ {
+ MethodCallExpression glob = BuildGlobCall(effectiveName, globPattern);
+ return Expression.Lambda>(glob, artist);
+ }
+
+ ///
+ /// Builds a predicate that is satisfied when the first character of the effective name is neither a letter nor a digit.
+ ///
+ /// The parameter representing the artist entity.
+ /// The expression of the effective name.
+ /// The built predicate.
+ private static Expression> BuildSymbolPredicate(ParameterExpression artist, Expression effectiveName)
+ {
+ Expression notLetter = Expression.Not(BuildGlobCall(effectiveName, "[a-z]*"));
+ Expression notDigit = Expression.Not(BuildGlobCall(effectiveName, "[0-9]*"));
+ return Expression.Lambda>(Expression.AndAlso(notLetter, notDigit), artist);
+ }
+
+ ///
+ /// Builds the call to for the effective name and the provided glob pattern.
+ ///
+ /// The expression of the effective name.
+ /// The glob pattern the effective name must match.
+ /// The built method call.
+ private static MethodCallExpression BuildGlobCall(Expression effectiveName, string globPattern)
+ {
+ Expression functions = Expression.Property(null, typeof(EF), nameof(EF.Functions));
+ return Expression.Call(s_globMethod, functions, effectiveName, Expression.Constant(globPattern));
+ }
+}
diff --git a/src/Lumina.DataAccess/Core/Repositories/MusicLibrary/TrackRepository.cs b/src/Lumina.DataAccess/Core/Repositories/MusicLibrary/TrackRepository.cs
index 4837ccf2..a4bbe4ad 100644
--- a/src/Lumina.DataAccess/Core/Repositories/MusicLibrary/TrackRepository.cs
+++ b/src/Lumina.DataAccess/Core/Repositories/MusicLibrary/TrackRepository.cs
@@ -242,7 +242,7 @@ internal sealed class TrackRepository : ITrackRepository
.Include(track => track.Contributors)
.AsSplitQuery()
.Where(track => track.AlbumId == albumId)
- .OrderBy(track => track.DiscNumber)
+ .OrderBy(track => track.DiscNumber ?? 1) // some releases don't have a disc number, assume 1
.ThenBy(track => track.TrackNumber)
.ThenBy(track => track.Id)
.ToListAsync(cancellationToken).ConfigureAwait(false);
@@ -262,7 +262,7 @@ internal sealed class TrackRepository : ITrackRepository
IQueryable liteRowsQuery = _luminaDbContext.Tracks
.AsNoTracking()
.Where(track => track.AlbumId == albumId)
- .OrderBy(track => track.DiscNumber)
+ .OrderBy(track => track.DiscNumber ?? 1) // some releases don't have a disc number, assume 1
.ThenBy(track => track.TrackNumber)
.ThenBy(track => track.Id)
.Select(track => new TrackLiteRow
@@ -270,7 +270,8 @@ internal sealed class TrackRepository : ITrackRepository
Id = track.Id,
Title = track.Title,
TrackNumber = track.TrackNumber,
- DiscNumber = track.DiscNumber
+ DiscNumber = track.DiscNumber,
+ DurationInSeconds = track.DurationInSeconds
});
if (paginationData is null)
diff --git a/src/Lumina.Domain/Common/Errors/Errors.Music.cs b/src/Lumina.Domain/Common/Errors/Errors.Music.cs
index d4cca16a..b636930d 100644
--- a/src/Lumina.Domain/Common/Errors/Errors.Music.cs
+++ b/src/Lumina.Domain/Common/Errors/Errors.Music.cs
@@ -65,5 +65,6 @@ public static partial class Errors
public static Error IsniValueCannotBeEmpty => Error.Validation(description: nameof(IsniValueCannotBeEmpty));
public static Error IsniValueMustBeMaximum20CharactersLong => Error.Validation(description: nameof(IsniValueMustBeMaximum20CharactersLong));
public static Error WorkTitleCannotBeEmpty => Error.Validation(description: nameof(WorkTitleCannotBeEmpty));
+ public static Error CoverCannotBeNull => Error.Validation(description: nameof(CoverCannotBeNull));
}
}
diff --git a/src/Lumina.Domain/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/Artist.cs b/src/Lumina.Domain/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/Artist.cs
index 62baa2ee..5a5043f2 100644
--- a/src/Lumina.Domain/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/Artist.cs
+++ b/src/Lumina.Domain/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/Artist.cs
@@ -644,6 +644,7 @@ public sealed class Artist : AggregateRoot
/// The track to update.
/// The file system path of the track.
/// The audio metadata of the track.
+ /// The optional disambiguation comment of the track.
/// The number of the track on its disc.
/// The optional number of the disc the track belongs to.
/// The optional script used by the language of the track.
@@ -663,6 +664,7 @@ public sealed class Artist : AggregateRoot
Track track,
string path,
AudioMetadata metadata,
+ Optional disambiguation,
int trackNumber,
Optional discNumber,
Optional script,
@@ -686,6 +688,7 @@ public sealed class Artist : AggregateRoot
track.UpdateDetails(
path,
metadata,
+ disambiguation,
trackNumber,
discNumber,
script,
diff --git a/src/Lumina.Domain/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/Entities/Track.cs b/src/Lumina.Domain/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/Entities/Track.cs
index 09c42e2c..0f3842a4 100644
--- a/src/Lumina.Domain/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/Entities/Track.cs
+++ b/src/Lumina.Domain/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/Entities/Track.cs
@@ -347,6 +347,7 @@ public sealed class Track : Entity
///
/// The file system path of the track.
/// The audio metadata of the track.
+ /// The optional disambiguation comment of the track.
/// The number of the track on its disc.
/// The optional number of the disc the track belongs to.
/// The optional script used by the language of the track.
@@ -360,6 +361,7 @@ public sealed class Track : Entity
internal Result UpdateDetails(
string path,
AudioMetadata metadata,
+ Optional disambiguation,
int trackNumber,
Optional discNumber,
Optional script,
@@ -372,6 +374,7 @@ public sealed class Track : Entity
{
Path = path;
Metadata = metadata;
+ Disambiguation = disambiguation;
TrackNumber = trackNumber;
DiscNumber = discNumber;
Script = script;
diff --git a/src/Lumina.Infrastructure/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artwork/MusicArtworkService.cs b/src/Lumina.Infrastructure/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artwork/MusicArtworkService.cs
index 28ccb723..a2c4866a 100644
--- a/src/Lumina.Infrastructure/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artwork/MusicArtworkService.cs
+++ b/src/Lumina.Infrastructure/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artwork/MusicArtworkService.cs
@@ -58,10 +58,10 @@ internal sealed class MusicArtworkService : IMusicArtworkService
/// The name of the artist of the album.
/// The title of the album.
/// The artwork to store.
+ /// The name of the release type directory the album is stored under on disk, used to group the artwork of the different releases of an artist. When , no release type segment is added.
/// Cancellation token that can be used to stop the execution.
- /// The name of the release type directory the album is stored under on disk, used to group the artwork of the different releases of an artist. When omitted, no release type segment is added.
/// An containing either the relative path of the stored artwork, or an error.
- public async Task> SaveAlbumArtworkAsync(Guid libraryId, Guid albumId, string libraryName, string artistName, string albumTitle, ArtworkDto artwork, CancellationToken cancellationToken, string? releaseTypeName = null)
+ public async Task> SaveAlbumArtworkAsync(Guid libraryId, Guid albumId, string libraryName, string artistName, string albumTitle, ArtworkDto artwork, string? releaseTypeName, CancellationToken cancellationToken)
{
Result artworkDirectoryPathResult = BuildAlbumArtworkDirectoryPath(libraryId, albumId, libraryName, artistName, albumTitle, releaseTypeName);
if (artworkDirectoryPathResult.IsFailure)
@@ -86,6 +86,106 @@ internal sealed class MusicArtworkService : IMusicArtworkService
return await SaveArtworkAsync(artworkDirectoryPathResult.Value, artwork, cancellationToken).ConfigureAwait(false);
}
+ ///
+ /// Stores the uploaded of the album into the internal media directory, and returns the relative path of the stored artwork.
+ ///
+ /// The Id of the media library the album belongs to.
+ /// The Id of the album.
+ /// The name of the media library the album belongs to.
+ /// The name of the artist of the album.
+ /// The title of the album.
+ /// The stream of the uploaded artwork to store.
+ /// The name of the uploaded artwork file.
+ /// The name of the release type directory the album is stored under on disk, used to group the artwork of the different releases of an artist. When , no release type segment is added.
+ /// Cancellation token that can be used to stop the execution.
+ /// An containing either the relative path of the stored artwork, or an error.
+ public async Task> SaveAlbumArtworkAsync(Guid libraryId, Guid albumId, string libraryName, string artistName, string albumTitle, Stream artwork, string fileName, string? releaseTypeName, CancellationToken cancellationToken)
+ {
+ // The uploaded bytes are persisted to a temporary file first, so that the storage pipeline can treat the upload like any other local artwork source and clean it up afterwards.
+ string temporaryPath = BuildTemporaryUploadPath(fileName);
+ try
+ {
+ await WriteUploadedArtworkAsync(artwork, temporaryPath, cancellationToken).ConfigureAwait(false);
+ return await SaveAlbumArtworkAsync(libraryId, albumId, libraryName, artistName, albumTitle, new ArtworkDto(ArtworkType.Cover, 0, temporaryPath, null, IsTemporary: true), releaseTypeName, cancellationToken).ConfigureAwait(false);
+ }
+ finally
+ {
+ DeleteTemporaryFile(temporaryPath);
+ }
+ }
+
+ ///
+ /// Stores the uploaded of the artist into the internal media directory, and returns the relative path of the stored artwork.
+ ///
+ /// The Id of the media library the artist belongs to.
+ /// The name of the media library the artist belongs to.
+ /// The name of the artist.
+ /// The stream of the uploaded artwork to store.
+ /// The name of the uploaded artwork file.
+ /// Cancellation token that can be used to stop the execution.
+ /// An containing either the relative path of the stored artwork, or an error.
+ public async Task> SaveArtistArtworkAsync(Guid libraryId, string libraryName, string artistName, Stream artwork, string fileName, CancellationToken cancellationToken)
+ {
+ // The uploaded bytes are persisted to a temporary file first, so that the storage pipeline can treat the upload like any other local artwork source and clean it up afterwards.
+ string temporaryPath = BuildTemporaryUploadPath(fileName);
+ try
+ {
+ await WriteUploadedArtworkAsync(artwork, temporaryPath, cancellationToken).ConfigureAwait(false);
+ return await SaveArtistArtworkAsync(libraryId, libraryName, artistName, new ArtworkDto(ArtworkType.Cover, 0, temporaryPath, null, IsTemporary: true), cancellationToken).ConfigureAwait(false);
+ }
+ finally
+ {
+ DeleteTemporaryFile(temporaryPath);
+ }
+ }
+
+ ///
+ /// Builds the path of the temporary file an uploaded artwork is buffered into, keeping the extension of the uploaded file so that its content can be probed by name.
+ ///
+ /// The name of the uploaded artwork file.
+ /// The file system path of the temporary file.
+ private static string BuildTemporaryUploadPath(string fileName)
+ {
+ string extension = Path.GetExtension(fileName);
+ if (string.IsNullOrWhiteSpace(extension))
+ extension = ".img";
+ return Path.Combine(Path.GetTempPath(), $"lumina-upload-{Guid.NewGuid():N}{extension}");
+ }
+
+ ///
+ /// Copies the uploaded stream into the temporary file at .
+ ///
+ /// The stream of the uploaded artwork.
+ /// The file system path of the temporary file.
+ /// Cancellation token that can be used to stop the execution.
+ private static async Task WriteUploadedArtworkAsync(Stream artwork, string temporaryPath, CancellationToken cancellationToken)
+ {
+ await using FileStream fileStream = new(temporaryPath, FileMode.Create, FileAccess.Write, FileShare.None, bufferSize: 81920, useAsync: true);
+ await artwork.CopyToAsync(fileStream, cancellationToken).ConfigureAwait(false);
+ }
+
+ ///
+ /// Deletes the temporary file at , ignoring the failures that must not mask the result of the operation.
+ ///
+ /// The file system path of the temporary file.
+ private static void DeleteTemporaryFile(string temporaryPath)
+ {
+ if (!File.Exists(temporaryPath))
+ return;
+ try
+ {
+ File.Delete(temporaryPath);
+ }
+ catch (IOException)
+ {
+ // A failed cleanup of the temporary file must not mask the result of the operation.
+ }
+ catch (UnauthorizedAccessException)
+ {
+ // A failed cleanup of the temporary file must not mask the result of the operation.
+ }
+ }
+
///
/// Resolves the local source of the , stores it into , and cleans up the temporary download of a remote artwork.
///
@@ -159,6 +259,32 @@ internal sealed class MusicArtworkService : IMusicArtworkService
return DeleteArtworkInDirectory(artworkDirectoryPathResult.Value);
}
+ ///
+ /// Deletes the stored artwork file at from the internal media directory, when it still exists.
+ ///
+ /// The relative path of the stored artwork file.
+ /// An representing either a successful operation, or an error.
+ public Result DeleteStoredArtwork(string artworkRelativePath)
+ {
+ if (string.IsNullOrWhiteSpace(artworkRelativePath))
+ return Result.Deleted;
+
+ // The stored path is relative to the application's base directory, so it is rooted back to the absolute path of the file to delete.
+ string absolutePath = Path.Combine(AppContext.BaseDirectory, artworkRelativePath.TrimStart(_pathService.PathSeparator));
+ Result filePathIdResult = FileSystemPathId.Create(absolutePath);
+ if (filePathIdResult.IsFailure)
+ return filePathIdResult.Errors;
+
+ Result fileExistsResult = _environmentContext.FileProviderService.FileExists(filePathIdResult.Value);
+ if (fileExistsResult.IsFailure)
+ return fileExistsResult.Errors;
+ if (!fileExistsResult.Value)
+ return Result.Deleted;
+
+ _environmentContext.FileProviderService.DeleteFile(filePathIdResult.Value);
+ return Result.Deleted;
+ }
+
///
/// Deletes the files directly contained in , leaving the subdirectories, such as the album directories of an artist, untouched.
///
diff --git a/src/Lumina.Infrastructure/Core/MediaLibrary/Management/Scanning/Jobs/Audio/Music/MusicLibraryPathStructure.cs b/src/Lumina.Infrastructure/Core/MediaLibrary/Management/Scanning/Jobs/Audio/Music/MusicLibraryPathStructure.cs
index 714a60f4..da99d9f6 100644
--- a/src/Lumina.Infrastructure/Core/MediaLibrary/Management/Scanning/Jobs/Audio/Music/MusicLibraryPathStructure.cs
+++ b/src/Lumina.Infrastructure/Core/MediaLibrary/Management/Scanning/Jobs/Audio/Music/MusicLibraryPathStructure.cs
@@ -52,12 +52,14 @@ internal sealed class MusicLibraryPathStructure
///
/// Gets the name of the on-disk release type directory of the track stored at , when the structure of the library
- /// uses one. The directory is the parent of the album directory, and it is only used when its name is a known release type, so that the artist
- /// directory of a flat library is not mistaken for a release type.
+ /// uses one. The directory is the parent of the album directory, and it is only used when its name is a known release type and it is not the
+ /// directory of , because the parent of the album directory of a library that has no release type directory is
+ /// the artist directory, which must not be mistaken for a release type.
///
/// The file system path of the track whose release type directory is retrieved.
+ /// The name of the artist of the track, or when it is not known.
/// The name of the on-disk release type directory, or when the library does not use one.
- public string? GetReleaseTypeDirectoryName(string trackPath)
+ public string? GetReleaseTypeDirectoryName(string trackPath, string? artistName = null)
{
string albumDirectory = GetAlbumDirectory(trackPath);
string? releaseTypeDirectory = GetParentDirectoryPath(albumDirectory);
@@ -65,7 +67,16 @@ internal sealed class MusicLibraryPathStructure
return null;
string releaseTypeName = GetLastSegment(releaseTypeDirectory);
- return Enum.TryParse(releaseTypeName, ignoreCase: true, out MusicReleaseType _) ? releaseTypeName : null;
+ // A numeric directory name parses to an enumeration member that is not defined, so it is rejected explicitly, together with any other
+ // name that is not a known release type.
+ if (!Enum.TryParse(releaseTypeName, ignoreCase: true, out MusicReleaseType releaseType) || !Enum.IsDefined(releaseType))
+ return null;
+
+ // The artist directory of a library that has no release type directory is the parent of the album directory, so it is not a release type.
+ if (!string.IsNullOrWhiteSpace(artistName) && string.Equals(releaseTypeName, artistName, StringComparison.OrdinalIgnoreCase))
+ return null;
+
+ return releaseTypeName;
}
///
diff --git a/src/Lumina.Infrastructure/Core/MediaLibrary/Management/Scanning/Jobs/Audio/Music/MusicMediaLibraryScanArtworkEnricher.cs b/src/Lumina.Infrastructure/Core/MediaLibrary/Management/Scanning/Jobs/Audio/Music/MusicMediaLibraryScanArtworkEnricher.cs
index 17ff4a58..8697d40d 100644
--- a/src/Lumina.Infrastructure/Core/MediaLibrary/Management/Scanning/Jobs/Audio/Music/MusicMediaLibraryScanArtworkEnricher.cs
+++ b/src/Lumina.Infrastructure/Core/MediaLibrary/Management/Scanning/Jobs/Audio/Music/MusicMediaLibraryScanArtworkEnricher.cs
@@ -370,7 +370,7 @@ internal sealed class MusicMediaLibraryScanArtworkEnricher : IMediaLibraryScanAr
// The release type directory groups the artwork of the releases of the artist that share a title, so the album, the single and the live release of the same songs do not collide.
// It is read from the file system, because the structure on disk is the source of truth of the release type of an album.
- string? releaseTypeName = _musicLibraryPathStructure.GetReleaseTypeDirectoryName(firstTrackPath);
+ string? releaseTypeName = _musicLibraryPathStructure.GetReleaseTypeDirectoryName(firstTrackPath, albumEntity.Artist?.Name);
return await EnrichArtworkAsync(
artworkLookup,
@@ -381,7 +381,7 @@ internal sealed class MusicMediaLibraryScanArtworkEnricher : IMediaLibraryScanAr
musicArtworkService,
fileHashService,
() => musicArtworkService!.DeleteAlbumArtwork(albumEntity.LibraryId, albumEntity.Id, libraryName, artistName, albumEntity.Title, releaseTypeName),
- (artwork, token) => musicArtworkService!.SaveAlbumArtworkAsync(albumEntity.LibraryId, albumEntity.Id, libraryName, artistName, albumEntity.Title, artwork, token, releaseTypeName),
+ (artwork, token) => musicArtworkService!.SaveAlbumArtworkAsync(albumEntity.LibraryId, albumEntity.Id, libraryName, artistName, albumEntity.Title, artwork, releaseTypeName, token),
shouldAggregateArtworkWhenMissing,
unitOfWork,
cancellationToken).ConfigureAwait(false);
diff --git a/src/Lumina.Infrastructure/Core/Themes/ThemeSynchronizer.cs b/src/Lumina.Infrastructure/Core/Themes/ThemeSynchronizer.cs
index 278e3175..3ce050ad 100644
--- a/src/Lumina.Infrastructure/Core/Themes/ThemeSynchronizer.cs
+++ b/src/Lumina.Infrastructure/Core/Themes/ThemeSynchronizer.cs
@@ -53,9 +53,17 @@ internal static class ThemeSynchronizer
ThemeEntity? existingTheme = themes.Where(theme => theme.ThemeId == manifestResult.Value.Id).FirstOrDefault();
- // A theme that was soft deleted by the user must not be reinstalled automatically; an installed bundled theme
- // whose files are present is already in sync, so only a bundled theme whose files went missing gets its files reinstalled.
- if (existingTheme is not null && (existingTheme.IsDeleted || existingTheme.InstallSource != ThemeInstallSource.Bundled || themeService.HasThemePack(existingTheme.ThemeId)))
+ // A theme that was soft deleted by the user must not be reinstalled automatically, and a theme installed from
+ // another source (like an uploaded pack) is never replaced by a bundled archive.
+ if (existingTheme is not null && (existingTheme.IsDeleted || existingTheme.InstallSource != ThemeInstallSource.Bundled))
+ continue;
+
+ // A bundled theme that is already installed is reinstalled when its files went missing, or when the shipped
+ // archive carries a new version, so that content updates of the bundled themes reach the installed packs.
+ bool isBundledThemeOutOfDate = existingTheme is not null
+ && (!themeService.HasThemePack(existingTheme.ThemeId)
+ || !string.Equals(existingTheme.Version, manifestResult.Value.Version, StringComparison.Ordinal));
+ if (existingTheme is not null && !isBundledThemeOutOfDate)
continue;
// Installing a bundled theme at startup is best effort: a file system failure here must never crash the host, because the default
@@ -70,9 +78,20 @@ internal static class ThemeSynchronizer
continue;
}
- // A known theme only gets its missing files reinstalled, so no new row is inserted.
+ // A known theme is refreshed in place, so its row is updated with the shipped version instead of a new row being inserted.
if (existingTheme is not null)
+ {
+ if (!string.Equals(existingTheme.Version, manifestResult.Value.Version, StringComparison.Ordinal))
+ {
+ existingTheme.Version = manifestResult.Value.Version;
+ existingTheme.UpdatedOnUtc = DateTime.UtcNow;
+ existingTheme.UpdatedBy = default;
+ Result updateResult = await unitOfWork.ThemeRepository.UpdateAsync(existingTheme, cancellationToken).ConfigureAwait(false);
+ if (updateResult.IsFailure)
+ logger.LogWarning("Failed to update the version of theme '{ThemeId}': {Error}", existingTheme.ThemeId, updateResult.FirstError.Description);
+ }
continue;
+ }
ThemeEntity themeEntity = new()
{
@@ -107,7 +126,7 @@ internal static class ThemeSynchronizer
}
await CleanUpMissingThemePacksAsync(themeService, unitOfWork, themes, logger, cancellationToken).ConfigureAwait(false);
- await EnsureCurrentThemeExistsAsync(themeService, unitOfWork, themes, cancellationToken).ConfigureAwait(false);
+ await EnsureCurrentThemeExistsAsync(themeService, unitOfWork, themes, logger, cancellationToken).ConfigureAwait(false);
Result saveChangesResult = await unitOfWork.SaveChangesAsync(cancellationToken).ConfigureAwait(false);
if (saveChangesResult.IsFailure)
@@ -189,8 +208,9 @@ internal static class ThemeSynchronizer
/// Injected service for the server-side storage and serving of theme packs.
/// The unit of work for interacting with the theme repository.
/// The installed themes read from the storage medium.
+ /// Injected logger used for logging.
/// Cancellation token that can be used to stop the execution.
- private static async Task EnsureCurrentThemeExistsAsync(IThemeService themeService, IUnitOfWork unitOfWork, IReadOnlyList themes, CancellationToken cancellationToken)
+ private static async Task EnsureCurrentThemeExistsAsync(IThemeService themeService, IUnitOfWork unitOfWork, IReadOnlyList themes, ILogger logger, CancellationToken cancellationToken)
{
if (themes.Any(theme => !theme.IsDeleted && theme.IsCurrent == true))
return;
@@ -209,6 +229,8 @@ internal static class ThemeSynchronizer
defaultTheme.IsCurrent = true;
defaultTheme.UpdatedOnUtc = DateTime.UtcNow;
defaultTheme.UpdatedBy = default;
- await unitOfWork.ThemeRepository.UpdateAsync(defaultTheme, cancellationToken).ConfigureAwait(false);
+ Result updateResult = await unitOfWork.ThemeRepository.UpdateAsync(defaultTheme, cancellationToken).ConfigureAwait(false);
+ if (updateResult.IsFailure)
+ logger.LogWarning("Failed to activate theme '{ThemeId}': {Error}", defaultTheme.ThemeId, updateResult.FirstError.Description);
}
}
diff --git a/src/Lumina.Presentation.Api/Common/Routes/Library/AudioLibrary/MusicLibrary/ApiRoutes.Albums.cs b/src/Lumina.Presentation.Api/Common/Routes/Library/AudioLibrary/MusicLibrary/ApiRoutes.Albums.cs
index dd1fafd4..2933c8f6 100644
--- a/src/Lumina.Presentation.Api/Common/Routes/Library/AudioLibrary/MusicLibrary/ApiRoutes.Albums.cs
+++ b/src/Lumina.Presentation.Api/Common/Routes/Library/AudioLibrary/MusicLibrary/ApiRoutes.Albums.cs
@@ -15,6 +15,7 @@ public static partial class ApiRoutes
public const string ADD_ALBUM = "/libraries/{libraryId}/artists/{artistId}/albums";
public const string GET_ALBUM_BY_ID = "/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 = "/libraries/{libraryId}/artists/{artistId}/albums/{albumId}/tracks";
public const string GET_ALBUM_TRACKS_LITE = "/libraries/{libraryId}/artists/{artistId}/albums/{albumId}/tracks/lite";
diff --git a/src/Lumina.Presentation.Api/Common/Routes/Library/AudioLibrary/MusicLibrary/ApiRoutes.Artists.cs b/src/Lumina.Presentation.Api/Common/Routes/Library/AudioLibrary/MusicLibrary/ApiRoutes.Artists.cs
index b3d50a4a..d8c1bd07 100644
--- a/src/Lumina.Presentation.Api/Common/Routes/Library/AudioLibrary/MusicLibrary/ApiRoutes.Artists.cs
+++ b/src/Lumina.Presentation.Api/Common/Routes/Library/AudioLibrary/MusicLibrary/ApiRoutes.Artists.cs
@@ -15,6 +15,7 @@ public static partial class ApiRoutes
public const string GET_ARTISTS_LITE = "/libraries/{libraryId}/artists/lite";
public const string ADD_ARTIST = "/libraries/{libraryId}/artists";
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}";
}
}
diff --git a/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/AddAlbum/AddAlbumEndpointSummary.cs b/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/AddAlbum/AddAlbumEndpointSummary.cs
index 26fc8125..fedd2b40 100644
--- a/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/AddAlbum/AddAlbumEndpointSummary.cs
+++ b/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/AddAlbum/AddAlbumEndpointSummary.cs
@@ -11,6 +11,7 @@ using Lumina.Contracts.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Tracks;
using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary;
using Lumina.Domain.SharedKernel.Common.Enums.Common;
using Lumina.Domain.SharedKernel.Common.Enums.MediaContributors;
+using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
@@ -372,6 +373,8 @@ public class AddAlbumEndpointSummary : Summary(r => r.Metadata!.Genres, "The list of genres associated with the album.");
ResponseParam(r => r.Metadata!.Tags, "The list of tags that further describe or categorize the album.");
ResponseParam(r => r.Tracks, "The list of tracks of the album.");
+ ResponseParam(r => r.CoverPath, "The path of the image representing the album, if available.");
+ ResponseParam(r => r.Artwork, "The stored artwork of the album, in display order, if applicable.");
Response(201, "The newly created album is returned.",
example: new AlbumResponse(
@@ -636,8 +639,9 @@ public class AddAlbumEndpointSummary : Summary
ResponseParam(r => r.Metadata!.Genres, "The list of genres associated with the album.");
ResponseParam(r => r.Metadata!.Tags, "The list of tags that further describe or categorize the album.");
ResponseParam(r => r.Tracks, "The list of tracks of the album.");
+ ResponseParam(r => r.CoverPath, "The path of the image representing the album, if available.");
+ ResponseParam(r => r.Artwork, "The stored artwork of the album, in display order, if applicable.");
Response(200, "The requested album is returned.",
example: new AlbumResponse(
@@ -142,8 +145,200 @@ public class GetAlbumEndpointSummary : Summary
],
CreatedOnUtc: new DateTime(2025, 1, 15, 10, 30, 0, DateTimeKind.Utc),
UpdatedOnUtc: new DateTime(2025, 1, 20, 14, 45, 0, DateTimeKind.Utc),
- Tracks: []
- )
+ Tracks:
+ [
+ new(
+ Id: Guid.NewGuid(),
+ AlbumId: Guid.NewGuid(),
+ LibraryId: Guid.NewGuid(),
+ Path: "/music/queen/a-night-at-the-opera/01-bohemian-rhapsody.flac",
+ Metadata: new(
+ Title: "Bohemian Rhapsody",
+ OriginalTitle: "Bohemian Rhapsody",
+ Description: "A song by the British rock band Queen. It was written by Freddie Mercury and originally released on the album A Night at the Opera in 1975.",
+ Disambiguation: "album version",
+ ReleaseInfo: new(
+ OriginalReleaseDate: new DateOnly(1975, 10, 31),
+ OriginalReleaseYear: 1975,
+ ReReleaseDate: new DateOnly(2011, 11, 21),
+ ReReleaseYear: 2011,
+ ReleaseCountry: ReleaseCountry.GB,
+ ReleaseVersion: "Original"
+ ),
+ Language: new(
+ LanguageCode: "en",
+ LanguageName: "English",
+ NativeName: "English"
+ ),
+ OriginalLanguage: new(
+ LanguageCode: "en",
+ LanguageName: "English",
+ NativeName: "English"
+ ),
+ Tags: [
+ new(Name: "classic"),
+ new(Name: "epic")
+ ],
+ Genres: [
+ new(Name: "Rock"),
+ new(Name: "Progressive Rock")
+ ],
+ DurationInSeconds: 354,
+ SampleRate: 44100,
+ Channels: 2,
+ BitDepth: 16,
+ AudioCodec: "FLAC",
+ Bitrate: 980,
+ IsVideo: false
+ ),
+ Script: "Latn",
+ Key: MusicKey.CMajor,
+ Bpm: 72,
+ Work: new MusicWorkDto(
+ MusicBrainzWorkId: Guid.NewGuid(),
+ Title: "Bohemian Rhapsody",
+ Type: "Song",
+ Languages: [new LanguageInfoDto(LanguageCode: "en", LanguageName: "English", NativeName: "English")],
+ Iswcs: ["T-010489707-6"]
+ ),
+ Isrcs: [
+ new(Value: "GBUM71029604")
+ ],
+ Moods: [
+ new(Name: "dramatic"),
+ new(Name: "anxious")
+ ],
+ MusicBrainzRecordingId: Guid.NewGuid(),
+ MusicBrainzTrackId: Guid.NewGuid(),
+ Contributors: [
+ new MediaContributorReferenceDto(
+ ContributorId: Guid.NewGuid(),
+ Role: MediaContributorRole.Vocals
+ ),
+ new MediaContributorReferenceDto(
+ ContributorId: Guid.NewGuid(),
+ Role: MediaContributorRole.Guitar
+ )
+ ],
+ Ratings: [
+ new(
+ Value: 4.5M,
+ MaxValue: 5,
+ Source: AudioRatingSource.MusicBrainz,
+ VoteCount: 2345
+ ),
+ new(
+ Value: 4.8M,
+ MaxValue: 5,
+ Source: AudioRatingSource.LastFm,
+ VoteCount: 1234
+ )
+ ],
+ TrackNumber: 1,
+ DiscNumber: 1,
+ CreatedOnUtc: new DateTime(2025, 1, 15, 10, 30, 0, DateTimeKind.Utc),
+ UpdatedOnUtc: new DateTime(2025, 1, 20, 14, 45, 0, DateTimeKind.Utc)
+ ),
+ new(
+ Id: Guid.NewGuid(),
+ AlbumId: Guid.NewGuid(),
+ LibraryId: Guid.NewGuid(),
+ Path: "/music/queen/a-night-at-the-opera/07-youre-my-best-friend.flac",
+ Metadata: new(
+ Title: "You're My Best Friend",
+ OriginalTitle: "You're My Best Friend",
+ Description: "A song by the British rock band Queen, written by bass guitarist John Deacon. It was originally released on the album A Night at the Opera in 1975 and as a single in 1976.",
+ Disambiguation: "album version",
+ ReleaseInfo: new(
+ OriginalReleaseDate: new DateOnly(1976, 6, 18),
+ OriginalReleaseYear: 1976,
+ ReReleaseDate: new DateOnly(2011, 11, 21),
+ ReReleaseYear: 2011,
+ ReleaseCountry: ReleaseCountry.GB,
+ ReleaseVersion: "Original"
+ ),
+ Language: new(
+ LanguageCode: "en",
+ LanguageName: "English",
+ NativeName: "English"
+ ),
+ OriginalLanguage: new(
+ LanguageCode: "en",
+ LanguageName: "English",
+ NativeName: "English"
+ ),
+ Tags: [
+ new(Name: "classic"),
+ new(Name: "love")
+ ],
+ Genres: [
+ new(Name: "Rock"),
+ new(Name: "Pop Rock")
+ ],
+ DurationInSeconds: 181,
+ SampleRate: 44100,
+ Channels: 2,
+ BitDepth: 16,
+ AudioCodec: "FLAC",
+ Bitrate: 912,
+ IsVideo: false
+ ),
+ Script: "Latn",
+ Key: MusicKey.BMajor,
+ Bpm: 118,
+ Work: new MusicWorkDto(
+ MusicBrainzWorkId: Guid.NewGuid(),
+ Title: "You're My Best Friend",
+ Type: "Song",
+ Languages: [new LanguageInfoDto(LanguageCode: "en", LanguageName: "English", NativeName: "English")],
+ Iswcs: ["T-010489707-6"]
+ ),
+ Isrcs: [
+ new(Value: "GBUM71029609")
+ ],
+ Moods: [
+ new(Name: "happy"),
+ new(Name: "warm")
+ ],
+ MusicBrainzRecordingId: Guid.NewGuid(),
+ MusicBrainzTrackId: Guid.NewGuid(),
+ Contributors: [
+ new MediaContributorReferenceDto(
+ ContributorId: Guid.NewGuid(),
+ Role: MediaContributorRole.Vocals
+ ),
+ new MediaContributorReferenceDto(
+ ContributorId: Guid.NewGuid(),
+ Role: MediaContributorRole.Guitar
+ )
+ ],
+ Ratings: [
+ new(
+ Value: 4.2M,
+ MaxValue: 5,
+ Source: AudioRatingSource.MusicBrainz,
+ VoteCount: 1234
+ ),
+ new(
+ Value: 4.4M,
+ MaxValue: 5,
+ Source: AudioRatingSource.LastFm,
+ VoteCount: 567
+ )
+ ],
+ TrackNumber: 7,
+ DiscNumber: 1,
+ CreatedOnUtc: new DateTime(2025, 1, 15, 10, 30, 0, DateTimeKind.Utc),
+ UpdatedOnUtc: new DateTime(2025, 1, 20, 14, 45, 0, DateTimeKind.Utc)
+ )
+ ],
+ CoverPath: "/media/music/Queen-3b3a19f3/A Night at the Opera-e8d52f7b/cover.jpg",
+ Artwork:
+ [
+ new MediaArtworkDto(ArtworkType.Cover, 0, "/media/music/Queen-3b3a19f3/A Night at the Opera-e8d52f7b/cover.jpg"),
+ new MediaArtworkDto(ArtworkType.Back, 0, "/media/music/Queen-3b3a19f3/A Night at the Opera-e8d52f7b/back.jpg"),
+ new MediaArtworkDto(ArtworkType.Booklet, 0, "/media/music/Queen-3b3a19f3/A Night at the Opera-e8d52f7b/booklet.jpg")
+ ])
);
Response(401, "Authentication required.", "application/problem+json",
diff --git a/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetAlbumTracksLite/GetAlbumTracksLiteEndpointSummary.cs b/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetAlbumTracksLite/GetAlbumTracksLiteEndpointSummary.cs
index 9d152542..ba444db1 100644
--- a/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetAlbumTracksLite/GetAlbumTracksLiteEndpointSummary.cs
+++ b/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetAlbumTracksLite/GetAlbumTracksLiteEndpointSummary.cs
@@ -36,6 +36,7 @@ public class GetAlbumTracksLiteEndpointSummary : Summary(r => r.Title, "The title of the track.");
ResponseParam(r => r.TrackNumber, "The number of the track on its disc.");
ResponseParam(r => r.DiscNumber, "The number of the disc the track belongs to, if applicable.");
+ ResponseParam(r => r.DurationInSeconds, "The duration of the track in seconds.");
Response(200, "The paginated list of the lightweight read models of the tracks of the album is returned.",
example: new PaginatedResponse
@@ -46,13 +47,15 @@ public class GetAlbumTracksLiteEndpointSummary : Summary(r => r.Metadata!.Genres, "The list of genres associated with the album.");
ResponseParam(r => r.Metadata!.Tags, "The list of tags that further describe or categorize the album.");
ResponseParam(r => r.Tracks, "The list of tracks of the album.");
+ ResponseParam(r => r.CoverPath, "The path of the image representing the album, if available.");
+ ResponseParam(r => r.Artwork, "The stored artwork of the album, in display order, if applicable.");
Response(200, "The updated album is returned.",
example: new AlbumResponse(
@@ -254,8 +257,195 @@ public class UpdateAlbumEndpointSummary : Summary
+/// API endpoint for the /libraries/{libraryId}/artists/{artistId}/albums/{albumId}/cover route.
+///
+public class UpdateAlbumCoverEndpoint : BaseEndpoint
+{
+ private readonly ICommandHandler> _updateAlbumCoverCommandHandler;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Injected service for handling update album cover commands.
+ public UpdateAlbumCoverEndpoint(ICommandHandler> updateAlbumCoverCommandHandler)
+ {
+ _updateAlbumCoverCommandHandler = updateAlbumCoverCommandHandler;
+ }
+
+ ///
+ /// Configures the API endpoint.
+ ///
+ public override void Configure()
+ {
+ Verbs(FastEndpoints.Http.PUT);
+ Routes(ApiRoutes.Albums.UPDATE_ALBUM_COVER);
+ Version(1);
+ DontCatchExceptions();
+ }
+
+ ///
+ /// Updates the cover image of the album with the image uploaded in the multipart form of the request.
+ ///
+ /// The request object.
+ /// Cancellation token that can be used to stop the execution.
+ public override async Task ExecuteAsync(FastEndpoints.EmptyRequest request, CancellationToken cancellationToken)
+ {
+ // Take the identifiers from the route.
+ string? libraryId = HttpContext.Request.RouteValues["libraryId"]?.ToString();
+ string? artistId = HttpContext.Request.RouteValues["artistId"]?.ToString();
+ string? albumId = HttpContext.Request.RouteValues["albumId"]?.ToString();
+
+ IFormFile? cover = null;
+ if (HttpContext.Request.HasFormContentType)
+ {
+ try
+ {
+ // The cover is the first file of the multipart form; a multipart body without any file cannot be parsed as a form,
+ // so a malformed upload is treated as a missing cover, which the command validator reports.
+ 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 handler stores the image, and is disposed as soon as the handler returns.
+ UpdateAlbumCoverCommand command = new(libraryId, artistId, albumId, cover?.OpenReadStream(), cover?.FileName);
+ try
+ {
+ Result result = await _updateAlbumCoverCommandHandler.HandleAsync(command, cancellationToken).ConfigureAwait(false);
+ return result.Match(success => TypedResults.Ok(success), Problem);
+ }
+ finally
+ {
+ command.Cover?.Dispose();
+ }
+ }
+}
diff --git a/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCover/UpdateAlbumCoverEndpointSummary.cs b/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCover/UpdateAlbumCoverEndpointSummary.cs
new file mode 100644
index 00000000..318c3267
--- /dev/null
+++ b/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCover/UpdateAlbumCoverEndpointSummary.cs
@@ -0,0 +1,108 @@
+#region ========================================================================= USING =====================================================================================
+using FastEndpoints;
+using Lumina.Contracts.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Albums;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+#endregion
+
+namespace Lumina.Presentation.Api.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.UpdateAlbumCover;
+
+///
+/// Class used for providing a textual description for the API endpoint, for OpenAPI.
+///
+[ExcludeFromCodeCoverage]
+public class UpdateAlbumCoverEndpointSummary : Summary
+{
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ 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 UpdateAlbumCoverResponse(
+ CoverPath: "/media/music/music-3f2504e0-4f89-41d3-9a0c-0305e82c3301/Queen-2b0e5f5a-0b3f-4b7e-8f4a-8c9e3d2f5a6b/A Night at the Opera-7c1d2e3f-4a5b-6c7d-8e9f-0a1b2c3d4e5f/cover.jpg"
+ )
+ );
+
+ Response(401, "Authentication required.", "application/problem+json",
+ example: new[]
+ {
+ new
+ {
+ type = "https://tools.ietf.org/html/rfc7235#section-3.1",
+ status = 401,
+ title = "Unauthorized",
+ detail = "Authentication failed",
+ instance = $"/api/v1/libraries/{Guid.NewGuid()}/artists/{Guid.NewGuid()}/albums/{Guid.NewGuid()}/cover"
+ }
+ }
+ );
+
+ Response(403, "The request failed because the user making the request is not an Admin, or the owner of the media library.", "application/problem+json",
+ example: new
+ {
+ type = "https://tools.ietf.org/html/rfc9110#section-15.5.4",
+ title = "General.Unauthorized",
+ status = 403,
+ detail = "NotAuthorized",
+ instance = $"/api/v1/libraries/{Guid.NewGuid()}/artists/{Guid.NewGuid()}/albums/{Guid.NewGuid()}/cover",
+ traceId = "00-a712bbf99ca8ab485f86a762ae5ae74d-b3a2eb78813b0a5d-00"
+ }
+ );
+
+ Response(404, "The request failed because the album or its media library does not exist.", "application/problem+json",
+ example: new[]
+ {
+ new
+ {
+ type = "https://tools.ietf.org/html/rfc9110#section-15.5.5",
+ title = "General.NotFound",
+ status = 404,
+ detail = "AlbumNotFound",
+ instance = $"/api/v1/libraries/{Guid.NewGuid()}/artists/{Guid.NewGuid()}/albums/{Guid.NewGuid()}/cover",
+ traceId = "00-57d15dadd702dbd4aeb5dc9b7cee68ee-9330237dbb2ce0e5-00"
+ },
+ new
+ {
+ type = "https://tools.ietf.org/html/rfc9110#section-15.5.5",
+ title = "General.NotFound",
+ status = 404,
+ detail = "LibraryNotFound",
+ instance = $"/api/v1/libraries/{Guid.NewGuid()}/artists/{Guid.NewGuid()}/albums/{Guid.NewGuid()}/cover",
+ traceId = "00-57d15dadd702dbd4aeb5dc9b7cee68ee-9330237dbb2ce0e5-00"
+ }
+ }
+ );
+
+ Response(422, "The request did not pass validation checks, either on the request itself or while storing the uploaded cover image.", "application/problem+json",
+ example: new
+ {
+ type = "https://tools.ietf.org/html/rfc4918#section-11.2",
+ title = "General.Validation",
+ status = 422,
+ detail = "OneOrMoreValidationErrorsOccurred",
+ instance = $"/api/v1/libraries/{Guid.NewGuid()}/artists/{Guid.NewGuid()}/albums/{Guid.NewGuid()}/cover",
+ errors = new Dictionary
+ {
+ {
+ "General.Validation", new[]
+ {
+ "LibraryIdCannotBeEmpty",
+ "ArtistIdCannotBeEmpty",
+ "AlbumIdCannotBeEmpty",
+ "CoverCannotBeNull",
+ "FileNameCannotBeEmpty",
+ "FileTooLarge",
+ "CoverFileMustBeAnImage"
+ }
+ }
+ },
+ traceId = "00-2470be4248a2a5a0c6f70579975a6954-b9c3ba9544a03500-00"
+ }
+ );
+ }
+}
diff --git a/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/AddArtist/AddArtistEndpointSummary.cs b/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/AddArtist/AddArtistEndpointSummary.cs
index 37a52bde..33ce2af1 100644
--- a/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/AddArtist/AddArtistEndpointSummary.cs
+++ b/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/AddArtist/AddArtistEndpointSummary.cs
@@ -13,6 +13,7 @@ using Lumina.Contracts.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Artists;
using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary;
using Lumina.Domain.SharedKernel.Common.Enums.Common;
using Lumina.Domain.SharedKernel.Common.Enums.MediaContributors;
+using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
@@ -454,6 +455,8 @@ public class AddArtistEndpointSummary : Summary(r => r.Albums![0].Contributors, "The list of references to the media contributors that performed on the album, each with the role they played.");
ResponseParam(r => r.Albums![0].Ratings, "The list of ratings for the album.");
ResponseParam(r => r.Albums![0].Tracks, "The list of tracks of the album.");
+ ResponseParam(r => r.Albums![0].CoverPath, "The path of the image representing the album, if available.");
+ ResponseParam(r => r.Albums![0].Artwork, "The stored artwork of the album, in display order, if applicable.");
ResponseParam(r => r.Albums![0].Tracks![0].Id, "The Id of the track.");
ResponseParam(r => r.Albums![0].Tracks![0].AlbumId, "The Id of the album the track belongs to.");
ResponseParam(r => r.Albums![0].Tracks![0].LibraryId, "The Id of the media library this track belongs to.");
@@ -502,6 +505,7 @@ public class AddArtistEndpointSummary : Summary(r => r.Albums![0].Tracks![0].Ratings, "The list of ratings for the track.");
ResponseParam(r => r.CreatedOnUtc, "The date and time when the artist was created.");
ResponseParam(r => r.UpdatedOnUtc, "The date and time when the artist was last updated, if applicable.");
+ ResponseParam(r => r.CoverPath, "The path of the image representing the artist, if available.");
Response(201, "The new artist is returned.",
example: new ArtistResponse(
@@ -820,9 +824,12 @@ public class AddArtistEndpointSummary : Summary
ResponseParam(r => r.Albums, "The list of albums of the artist, each with its own list of tracks.");
ResponseParam(r => r.CreatedOnUtc, "The date and time when the artist was created.");
ResponseParam(r => r.UpdatedOnUtc, "The date and time when the artist was last updated, if applicable.");
+ ResponseParam(r => r.CoverPath, "The path of the image representing the artist, if available.");
Response(200, "The requested artist is returned.",
example: new ArtistResponse(
@@ -161,9 +163,12 @@ public class GetArtistEndpointSummary : Summary
CreatedOnUtc: new DateTime(2025, 1, 15, 10, 30, 0, DateTimeKind.Utc),
UpdatedOnUtc: new DateTime(2025, 1, 20, 14, 45, 0, DateTimeKind.Utc)
)
- ]
+ ],
+ CoverPath: "/media/music/Queen-3b3a19f3/A Night at the Opera-e8d52f7b/cover.jpg",
+ Artwork: [new MediaArtworkDto(ArtworkType.Cover, 0, "/media/music/Queen-3b3a19f3/A Night at the Opera-e8d52f7b/cover.jpg")]
)
- ]
+ ],
+ CoverPath: "/media/music/Queen-3b3a19f3/cover.jpg"
)
);
diff --git a/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetArtistAlbums/GetArtistAlbumsEndpointSummary.cs b/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetArtistAlbums/GetArtistAlbumsEndpointSummary.cs
index a70cc6d0..4d4546b0 100644
--- a/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetArtistAlbums/GetArtistAlbumsEndpointSummary.cs
+++ b/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetArtistAlbums/GetArtistAlbumsEndpointSummary.cs
@@ -8,6 +8,7 @@ using Lumina.Contracts.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Albums;
using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary;
using Lumina.Domain.SharedKernel.Common.Enums.Common;
using Lumina.Domain.SharedKernel.Common.Enums.MediaContributors;
+using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
@@ -64,6 +65,8 @@ public class GetArtistAlbumsEndpointSummary : Summary(r => r.Metadata!.Genres, "The list of genres associated with the album.");
ResponseParam(r => r.Metadata!.Tags, "The list of tags that further describe or categorize the album.");
ResponseParam(r => r.Tracks, "The list of tracks of the album.");
+ ResponseParam(r => r.CoverPath, "The path of the image representing the album, if available.");
+ ResponseParam(r => r.Artwork, "The stored artwork of the album, in display order, if applicable.");
Response(200, "The list of albums of the artist is returned.",
example: new AlbumResponse[]
@@ -144,7 +147,103 @@ public class GetArtistAlbumsEndpointSummary : Summary(r => r.Id, "The Id of the album.");
ResponseParam(r => r.Title, "The title of the album.");
ResponseParam(r => r.TotalTracks, "The number of tracks of the release.");
+ ResponseParam(r => r.CoverPath, "The path of the image representing the album, if available.");
+ ResponseParam(r => r.ReleaseYear, "The release year of the album (the re-release year, if available, or the original release year), if known.");
+ ResponseParam(r => r.ReleaseTypes, "The set of types of the release.");
Response(200, "The paginated list of the lightweight read models of the albums of the artist is returned.",
example: new PaginatedResponse
@@ -44,12 +48,18 @@ public class GetArtistAlbumsLiteEndpointSummary : Summary(r => r.Albums, "The list of albums of the artist, each with its own list of tracks.");
ResponseParam(r => r.CreatedOnUtc, "The date and time when the artist was created.");
ResponseParam(r => r.UpdatedOnUtc, "The date and time when the artist was last updated, if applicable.");
+ ResponseParam(r => r.CoverPath, "The path of the image representing the artist, if available.");
Response(200, "The paginated list of the artists of the media library is returned.",
example: new PaginatedResponse
@@ -173,9 +175,12 @@ public class GetArtistsEndpointSummary : Summary 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 artists 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.");
ResponseParam(r => r.Id, "The Id of the artist.");
ResponseParam(r => r.Name, "The name of the artist.");
+ ResponseParam(r => r.CoverPath, "The path of the image representing the artist, if available.");
Response(200, "The paginated list of the lightweight read models of the artists is returned.",
example: new PaginatedResponse
@@ -44,11 +54,13 @@ public class GetArtistsLiteEndpointSummary : Summary(r => r.Albums![0].Contributors, "The list of references to the media contributors that performed on the album, each with the role they played.");
ResponseParam(r => r.Albums![0].Ratings, "The list of ratings for the album.");
ResponseParam(r => r.Albums![0].Tracks, "The list of tracks of the album.");
+ ResponseParam(r => r.Albums![0].CoverPath, "The path of the image representing the album, if available.");
+ ResponseParam(r => r.Albums![0].Artwork, "The stored artwork of the album, in display order, if applicable.");
ResponseParam(r => r.Albums![0].Tracks![0].Id, "The Id of the track.");
ResponseParam(r => r.Albums![0].Tracks![0].AlbumId, "The Id of the album the track belongs to.");
ResponseParam(r => r.Albums![0].Tracks![0].LibraryId, "The Id of the media library this track belongs to.");
@@ -501,6 +504,7 @@ public class UpdateArtistEndpointSummary : Summary(r => r.Albums![0].Tracks![0].Ratings, "The list of ratings for the track.");
ResponseParam(r => r.CreatedOnUtc, "The date and time when the artist was created.");
ResponseParam(r => r.UpdatedOnUtc, "The date and time when the artist was last updated, if applicable.");
+ ResponseParam(r => r.CoverPath, "The path of the image representing the artist, if available.");
Guid artistId = Guid.NewGuid();
Guid libraryId = Guid.NewGuid();
@@ -817,9 +821,12 @@ public class UpdateArtistEndpointSummary : Summary
+/// API endpoint for the /libraries/{libraryId}/artists/{artistId}/cover route.
+///
+public class UpdateArtistCoverEndpoint : BaseEndpoint
+{
+ private readonly ICommandHandler> _updateArtistCoverCommandHandler;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Injected service for handling update artist cover commands.
+ public UpdateArtistCoverEndpoint(ICommandHandler> updateArtistCoverCommandHandler)
+ {
+ _updateArtistCoverCommandHandler = updateArtistCoverCommandHandler;
+ }
+
+ ///
+ /// Configures the API endpoint.
+ ///
+ public override void Configure()
+ {
+ Verbs(FastEndpoints.Http.PUT);
+ Routes(ApiRoutes.Artists.UPDATE_ARTIST_COVER);
+ Version(1);
+ DontCatchExceptions();
+ }
+
+ ///
+ /// Updates the cover image of the artist with the image uploaded in the multipart form of the request.
+ ///
+ /// The request object.
+ /// Cancellation token that can be used to stop the execution.
+ public override async Task ExecuteAsync(FastEndpoints.EmptyRequest request, CancellationToken cancellationToken)
+ {
+ // Take the identifiers from the route.
+ string? libraryId = HttpContext.Request.RouteValues["libraryId"]?.ToString();
+ string? artistId = HttpContext.Request.RouteValues["artistId"]?.ToString();
+
+ IFormFile? cover = null;
+ if (HttpContext.Request.HasFormContentType)
+ {
+ try
+ {
+ // The cover is the first file of the multipart form; a multipart body without any file cannot be parsed as a form,
+ // so a malformed upload is treated as a missing cover, which the command validator reports.
+ 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 handler stores the image, and is disposed as soon as the handler returns.
+ UpdateArtistCoverCommand command = new(libraryId, artistId, cover?.OpenReadStream(), cover?.FileName);
+ try
+ {
+ Result result = await _updateArtistCoverCommandHandler.HandleAsync(command, cancellationToken).ConfigureAwait(false);
+ return result.Match(success => TypedResults.Ok(success), Problem);
+ }
+ finally
+ {
+ command.Cover?.Dispose();
+ }
+ }
+}
diff --git a/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtistCover/UpdateArtistCoverEndpointSummary.cs b/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtistCover/UpdateArtistCoverEndpointSummary.cs
new file mode 100644
index 00000000..c3a39e0a
--- /dev/null
+++ b/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtistCover/UpdateArtistCoverEndpointSummary.cs
@@ -0,0 +1,107 @@
+#region ========================================================================= USING =====================================================================================
+using FastEndpoints;
+using Lumina.Contracts.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Artists;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+#endregion
+
+namespace Lumina.Presentation.Api.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.UpdateArtistCover;
+
+///
+/// Class used for providing a textual description for the API endpoint, for OpenAPI.
+///
+[ExcludeFromCodeCoverage]
+public class UpdateArtistCoverEndpointSummary : Summary
+{
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ 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 UpdateArtistCoverResponse(
+ CoverPath: "/media/music/music-3f2504e0-4f89-41d3-9a0c-0305e82c3301/Queen-2b0e5f5a-0b3f-4b7e-8f4a-8c9e3d2f5a6b/cover.jpg"
+ )
+ );
+
+ Response(401, "Authentication required.", "application/problem+json",
+ example: new[]
+ {
+ new
+ {
+ type = "https://tools.ietf.org/html/rfc7235#section-3.1",
+ status = 401,
+ title = "Unauthorized",
+ detail = "Authentication failed",
+ instance = $"/api/v1/libraries/{Guid.NewGuid()}/artists/{Guid.NewGuid()}/cover"
+ }
+ }
+ );
+
+ Response(403, "The request failed because the user making the request is not an Admin, or the owner of the media library.", "application/problem+json",
+ example: new
+ {
+ type = "https://tools.ietf.org/html/rfc9110#section-15.5.4",
+ title = "General.Unauthorized",
+ status = 403,
+ detail = "NotAuthorized",
+ instance = $"/api/v1/libraries/{Guid.NewGuid()}/artists/{Guid.NewGuid()}/cover",
+ traceId = "00-a712bbf99ca8ab485f86a762ae5ae74d-b3a2eb78813b0a5d-00"
+ }
+ );
+
+ Response(404, "The request failed because the artist or its media library does not exist.", "application/problem+json",
+ example: new[]
+ {
+ new
+ {
+ type = "https://tools.ietf.org/html/rfc9110#section-15.5.5",
+ title = "General.NotFound",
+ status = 404,
+ detail = "ArtistNotFound",
+ instance = $"/api/v1/libraries/{Guid.NewGuid()}/artists/{Guid.NewGuid()}/cover",
+ traceId = "00-57d15dadd702dbd4aeb5dc9b7cee68ee-9330237dbb2ce0e5-00"
+ },
+ new
+ {
+ type = "https://tools.ietf.org/html/rfc9110#section-15.5.5",
+ title = "General.NotFound",
+ status = 404,
+ detail = "LibraryNotFound",
+ instance = $"/api/v1/libraries/{Guid.NewGuid()}/artists/{Guid.NewGuid()}/cover",
+ traceId = "00-57d15dadd702dbd4aeb5dc9b7cee68ee-9330237dbb2ce0e5-00"
+ }
+ }
+ );
+
+ Response(422, "The request did not pass validation checks, either on the request itself or while storing the uploaded cover image.", "application/problem+json",
+ example: new
+ {
+ type = "https://tools.ietf.org/html/rfc4918#section-11.2",
+ title = "General.Validation",
+ status = 422,
+ detail = "OneOrMoreValidationErrorsOccurred",
+ instance = $"/api/v1/libraries/{Guid.NewGuid()}/artists/{Guid.NewGuid()}/cover",
+ errors = new Dictionary
+ {
+ {
+ "General.Validation", new[]
+ {
+ "LibraryIdCannotBeEmpty",
+ "ArtistIdCannotBeEmpty",
+ "CoverCannotBeNull",
+ "FileNameCannotBeEmpty",
+ "FileTooLarge",
+ "CoverFileMustBeAnImage"
+ }
+ }
+ },
+ traceId = "00-2470be4248a2a5a0c6f70579975a6954-b9c3ba9544a03500-00"
+ }
+ );
+ }
+}
diff --git a/src/Lumina.Presentation.Api/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/AddBook/AddBookEndpointSummary.cs b/src/Lumina.Presentation.Api/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/AddBook/AddBookEndpointSummary.cs
index 0a52851f..39b1c63e 100644
--- a/src/Lumina.Presentation.Api/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/AddBook/AddBookEndpointSummary.cs
+++ b/src/Lumina.Presentation.Api/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/AddBook/AddBookEndpointSummary.cs
@@ -308,7 +308,7 @@ public class AddBookEndpointSummary : Summary
MetadataProvider: default,
CreatedOnUtc: DateTime.UtcNow,
UpdatedOnUtc: default,
- CoverPath: null
+ CoverPath: "/media/books/tolkien/the-fellowship-of-the-ring/cover.jpg"
)
);
diff --git a/src/Lumina.Presentation.Api/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetBooks/GetBooksEndpointSummary.cs b/src/Lumina.Presentation.Api/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetBooks/GetBooksEndpointSummary.cs
index 7db1af98..7fa8eba3 100644
--- a/src/Lumina.Presentation.Api/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetBooks/GetBooksEndpointSummary.cs
+++ b/src/Lumina.Presentation.Api/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetBooks/GetBooksEndpointSummary.cs
@@ -147,7 +147,7 @@ public class GetBooksEndpointSummary : Summary
-
diff --git a/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/AudioRatingDto.cs b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/AudioRatingDto.cs
new file mode 100644
index 00000000..eab82d05
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/AudioRatingDto.cs
@@ -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;
+
+///
+/// Data transfer object for the rating of an audio media element.
+///
+[DebuggerDisplay("Value: {Value}, MaxValue: {MaxValue}")]
+public class AudioRatingDto : RatingDto
+{
+ ///
+ /// Gets or sets the source of the audio rating (e.g., a specific website or platform).
+ ///
+ public AudioRatingSource? Source { get; set; }
+}
diff --git a/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/IsrcDto.cs b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/IsrcDto.cs
new file mode 100644
index 00000000..feb21604
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/IsrcDto.cs
@@ -0,0 +1,17 @@
+#region ========================================================================= USING =====================================================================================
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
+
+///
+/// Data transfer object for an ISRC (International Standard Recording Code) of a track.
+///
+[DebuggerDisplay("Value: {Value}")]
+public class IsrcDto
+{
+ ///
+ /// Gets or sets the value of the ISRC.
+ ///
+ public string? Value { get; set; }
+}
diff --git a/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicAlbumDto.cs b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicAlbumDto.cs
new file mode 100644
index 00000000..00e59bb0
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicAlbumDto.cs
@@ -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;
+
+///
+/// Data transfer object carrying the full details of an album, as stored in the media library.
+///
+[DebuggerDisplay("Title: {Metadata?.Title}")]
+public class MusicAlbumDto
+{
+ ///
+ /// Gets or sets the Id of the album.
+ ///
+ public Guid Id { get; set; }
+
+ ///
+ /// Gets or sets the Id of the artist the album belongs to.
+ ///
+ public Guid ArtistId { get; set; }
+
+ ///
+ /// Gets or sets the Id of the media library this album belongs to.
+ ///
+ public Guid LibraryId { get; set; }
+
+ ///
+ /// Gets or sets the path of the image representing the album, if available.
+ ///
+ public string? CoverPath { get; set; }
+
+ ///
+ /// 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.
+ ///
+ public List? Artwork { get; set; }
+
+ ///
+ /// Gets or sets the album metadata of the album.
+ ///
+ public MusicAlbumMetadataDto? Metadata { get; set; }
+
+ ///
+ /// Gets or sets the physical or digital medium of the album, if applicable.
+ ///
+ public MusicMediaFormat? MediaFormat { get; set; }
+
+ ///
+ /// Gets or sets the outermost physical packaging of the album, if applicable.
+ ///
+ public MusicReleasePackaging? Packaging { get; set; }
+
+ ///
+ /// Gets or sets the barcode of the album, if applicable.
+ ///
+ public string? Barcode { get; set; }
+
+ ///
+ /// Gets or sets the catalog numbers of the album, if applicable.
+ ///
+ public List? CatalogNumbers { get; set; }
+
+ ///
+ /// Gets or sets the name of the label that issued the album, if applicable.
+ ///
+ public string? Label { get; set; }
+
+ ///
+ /// Gets or sets the ASIN (Amazon Standard Identification Number) of the album, if applicable.
+ ///
+ public string? ASIN { get; set; }
+
+ ///
+ /// Gets or sets the MusicBrainz identifier of the release, if applicable.
+ ///
+ public Guid? MusicBrainzReleaseId { get; set; }
+
+ ///
+ /// Gets or sets the MusicBrainz identifier of the release group, if applicable.
+ ///
+ public Guid? MusicBrainzReleaseGroupId { get; set; }
+
+ ///
+ /// Gets or sets the MusicBrainz identifier of the release artist, if applicable.
+ ///
+ public Guid? MusicBrainzReleaseArtistId { get; set; }
+
+ ///
+ /// Gets or sets the date and time when the album was created.
+ ///
+ public DateTime CreatedOnUtc { get; set; }
+
+ ///
+ /// Gets or sets the optional date and time when the album was updated.
+ ///
+ public DateTime? UpdatedOnUtc { get; set; }
+
+ ///
+ /// Gets or sets the list of references to the media contributors that performed on the album, each with the role they played.
+ ///
+ public List? Contributors { get; set; }
+
+ ///
+ /// Gets or sets the list of ratings for this album.
+ ///
+ public List? Ratings { get; set; }
+
+ ///
+ /// Gets or sets the list of tracks of the album.
+ ///
+ public List? Tracks { get; set; }
+}
diff --git a/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicAlbumLiteDto.cs b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicAlbumLiteDto.cs
new file mode 100644
index 00000000..2d9ec6a4
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicAlbumLiteDto.cs
@@ -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;
+
+///
+/// Data transfer object for a lightweight album element, containing only the properties needed by the client for card-style navigation.
+///
+[DebuggerDisplay("Title: {Title}")]
+public class MusicAlbumLiteDto
+{
+ ///
+ /// Gets or sets the Id of the album.
+ ///
+ public Guid Id { get; set; }
+
+ ///
+ /// Gets or sets the title of the album.
+ ///
+ public string Title { get; set; } = string.Empty;
+
+ ///
+ /// Gets or sets the number of tracks of the release.
+ ///
+ public int TotalTracks { get; set; }
+
+ ///
+ /// Gets or sets the path of the image representing the album, if available.
+ ///
+ public string? CoverPath { get; set; }
+
+ ///
+ /// Gets or sets the release year of the album (the re-release year, if available, or the original release year), if known.
+ ///
+ public int? ReleaseYear { get; set; }
+
+ ///
+ /// Gets or sets the set of types of the release.
+ ///
+ public List? ReleaseTypes { get; set; }
+}
diff --git a/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicAlbumMetadataDto.cs b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicAlbumMetadataDto.cs
new file mode 100644
index 00000000..216f9370
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicAlbumMetadataDto.cs
@@ -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;
+
+///
+/// Data transfer object for the metadata of an album.
+///
+[DebuggerDisplay("Title: {Title}")]
+public class MusicAlbumMetadataDto
+{
+ ///
+ /// Gets or sets the title of the album.
+ ///
+ public string? Title { get; set; }
+
+ ///
+ /// Gets or sets the original title of the album, if different from the current title.
+ ///
+ public string? OriginalTitle { get; set; }
+
+ ///
+ /// Gets or sets a brief description or summary of the album.
+ ///
+ public string? Description { get; set; }
+
+ ///
+ /// Gets or sets the disambiguation comment of the album, used to distinguish albums with the same title.
+ ///
+ public string? Disambiguation { get; set; }
+
+ ///
+ /// Gets or sets the release information, including release date and other relevant details.
+ ///
+ public ReleaseInfoDto? ReleaseInfo { get; set; }
+
+ ///
+ /// Gets or sets the language of the album.
+ ///
+ public LanguageInfoDto? Language { get; set; }
+
+ ///
+ /// Gets or sets the original language of the album, if it has been translated.
+ ///
+ public LanguageInfoDto? OriginalLanguage { get; set; }
+
+ ///
+ /// Gets or sets the list of tags that further describe or categorize the album.
+ ///
+ public List? Tags { get; set; }
+
+ ///
+ /// Gets or sets the list of genres associated with the album.
+ ///
+ public List? Genres { get; set; }
+
+ ///
+ /// Gets or sets the script used by the language of the release of the album.
+ ///
+ public string? Script { get; set; }
+
+ ///
+ /// Gets or sets the set of types of the release.
+ ///
+ public List? ReleaseTypes { get; set; }
+
+ ///
+ /// Gets or sets the status of the release.
+ ///
+ public MusicReleaseStatus? ReleaseStatus { get; set; }
+
+ ///
+ /// Gets or sets the number of discs of the release.
+ ///
+ public int? TotalDiscs { get; set; }
+
+ ///
+ /// Gets or sets the number of tracks of the release.
+ ///
+ public int? TotalTracks { get; set; }
+
+ ///
+ /// Gets or sets the title of the specific release (edition) the album files match, if different from the release group title.
+ ///
+ public string? ReleaseTitle { get; set; }
+}
diff --git a/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicAreaDto.cs b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicAreaDto.cs
new file mode 100644
index 00000000..2db0c345
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicAreaDto.cs
@@ -0,0 +1,43 @@
+#region ========================================================================= USING =====================================================================================
+using System;
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
+
+///
+/// Data transfer object for a MusicBrainz area, the geographic area a music artist is associated with.
+///
+[DebuggerDisplay("Name: {Name}")]
+public class MusicAreaDto
+{
+ ///
+ /// Gets or sets the MusicBrainz identifier of the area.
+ ///
+ public Guid? MusicBrainzAreaId { get; set; }
+
+ ///
+ /// Gets or sets the name of the area.
+ ///
+ public string? Name { get; set; }
+
+ ///
+ /// Gets or sets the sort name of the area, if applicable.
+ ///
+ public string? SortName { get; set; }
+
+ ///
+ /// Gets or sets the disambiguation comment of the area, if applicable.
+ ///
+ public string? Disambiguation { get; set; }
+
+ ///
+ /// Gets or sets the MusicBrainz type of the area, if applicable.
+ ///
+ public string? Type { get; set; }
+
+ ///
+ /// Gets or sets the ISO 3166 code of the area, if applicable.
+ ///
+ public string? Iso3166Code { get; set; }
+}
diff --git a/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicArtistAliasDto.cs b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicArtistAliasDto.cs
new file mode 100644
index 00000000..05ae5a43
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicArtistAliasDto.cs
@@ -0,0 +1,53 @@
+#region ========================================================================= USING =====================================================================================
+using System;
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
+
+///
+/// Data transfer object for an alternative name of a music artist.
+///
+[DebuggerDisplay("Name: {Name}")]
+public class MusicArtistAliasDto
+{
+ ///
+ /// Gets or sets the name of the alias.
+ ///
+ public string? Name { get; set; }
+
+ ///
+ /// Gets or sets the sort name of the alias, if applicable.
+ ///
+ public string? SortName { get; set; }
+
+ ///
+ /// Gets or sets the type of the alias, if applicable.
+ ///
+ public string? Type { get; set; }
+
+ ///
+ /// Gets or sets the locale the alias is used in, if applicable.
+ ///
+ public string? Locale { get; set; }
+
+ ///
+ /// Gets or sets whether this is the primary alias of the artist.
+ ///
+ public bool IsPrimary { get; set; }
+
+ ///
+ /// Gets or sets the date the alias began being used, if applicable.
+ ///
+ public DateOnly? BeginDate { get; set; }
+
+ ///
+ /// Gets or sets the date the alias stopped being used, if applicable.
+ ///
+ public DateOnly? EndDate { get; set; }
+
+ ///
+ /// Gets or sets whether the alias is no longer used.
+ ///
+ public bool IsEnded { get; set; }
+}
diff --git a/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicArtistDto.cs b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicArtistDto.cs
new file mode 100644
index 00000000..edb8a763
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicArtistDto.cs
@@ -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;
+
+///
+/// Data transfer object carrying the full details of a music artist, as stored in the media library.
+///
+[DebuggerDisplay("Name: {Metadata?.Name}")]
+public class MusicArtistDto
+{
+ ///
+ /// Gets or sets the Id of the artist.
+ ///
+ public Guid Id { get; set; }
+
+ ///
+ /// Gets or sets the Id of the media library this artist belongs to.
+ ///
+ public Guid LibraryId { get; set; }
+
+ ///
+ /// Gets or sets the path of the image representing the artist, if available.
+ ///
+ public string? CoverPath { get; set; }
+
+ ///
+ /// Gets or sets the metadata of the artist.
+ ///
+ public MusicArtistMetadataDto? Metadata { get; set; }
+
+ ///
+ /// Gets or sets the website of the artist, if applicable.
+ ///
+ public string? Website { get; set; }
+
+ ///
+ /// Gets or sets the MusicBrainz identifier of the artist, if applicable.
+ ///
+ public Guid? MusicBrainzArtistId { get; set; }
+
+ ///
+ /// Gets or sets the list of IPI (Interested Party Information) codes of the artist.
+ ///
+ public List? Ipis { get; set; }
+
+ ///
+ /// Gets or sets the list of ISNI (International Standard Name Identifier) codes of the artist.
+ ///
+ public List? Isnis { get; set; }
+
+ ///
+ /// Gets or sets the date and time when the artist was created.
+ ///
+ public DateTime CreatedOnUtc { get; set; }
+
+ ///
+ /// Gets or sets the optional date and time when the artist was updated.
+ ///
+ public DateTime? UpdatedOnUtc { get; set; }
+
+ ///
+ /// Gets or sets the list of references to the media contributors that make up the artist, each with the role they played.
+ ///
+ public List? Contributors { get; set; }
+
+ ///
+ /// Gets or sets the list of ratings for this artist.
+ ///
+ public List? Ratings { get; set; }
+
+ ///
+ /// Gets or sets the list of albums of the artist, each with its own list of tracks.
+ ///
+ public List? Albums { get; set; }
+}
diff --git a/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicArtistLiteDto.cs b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicArtistLiteDto.cs
new file mode 100644
index 00000000..06e69234
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicArtistLiteDto.cs
@@ -0,0 +1,28 @@
+#region ========================================================================= USING =====================================================================================
+using System;
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
+
+///
+/// Data transfer object for a lightweight music artist element, containing only the properties needed by the client for card-style navigation.
+///
+[DebuggerDisplay("Name: {Name}")]
+public class MusicArtistLiteDto
+{
+ ///
+ /// Gets or sets the Id of the artist.
+ ///
+ public Guid Id { get; set; }
+
+ ///
+ /// Gets or sets the name of the artist.
+ ///
+ public string Name { get; set; } = string.Empty;
+
+ ///
+ /// Gets or sets the path of the image representing the artist, if available.
+ ///
+ public string? CoverPath { get; set; }
+}
diff --git a/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicArtistMetadataDto.cs b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicArtistMetadataDto.cs
new file mode 100644
index 00000000..556f84d6
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicArtistMetadataDto.cs
@@ -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;
+
+///
+/// Data transfer object for the metadata of a music artist.
+///
+[DebuggerDisplay("Name: {Name}")]
+public class MusicArtistMetadataDto
+{
+ ///
+ /// Gets or sets the name of the artist.
+ ///
+ public string? Name { get; set; }
+
+ ///
+ /// Gets or sets the sort name of the artist, a variant of the name used when sorting artists, if applicable.
+ ///
+ public string? SortName { get; set; }
+
+ ///
+ /// Gets or sets the disambiguation comment of the artist, used to distinguish artists with the same name, if applicable.
+ ///
+ public string? Disambiguation { get; set; }
+
+ ///
+ /// Gets or sets the type of the artist, if applicable.
+ ///
+ public MusicArtistType? Type { get; set; }
+
+ ///
+ /// Gets or sets the gender of the artist, applicable only to artists that are persons or characters, if applicable.
+ ///
+ public MusicArtistGender? Gender { get; set; }
+
+ ///
+ /// Gets or sets the ISO 3166-1 alpha-2 code of the country the artist is associated with, if applicable.
+ ///
+ public string? Country { get; set; }
+
+ ///
+ /// Gets or sets the area the artist is primarily identified with, if applicable.
+ ///
+ public MusicAreaDto? Area { get; set; }
+
+ ///
+ /// Gets or sets the area the artist began in, if applicable.
+ ///
+ public MusicAreaDto? BeginArea { get; set; }
+
+ ///
+ /// Gets or sets the area the artist ended in, if applicable.
+ ///
+ public MusicAreaDto? EndArea { get; set; }
+
+ ///
+ /// Gets or sets the date the artist started existing, if applicable.
+ ///
+ public DateOnly? LifeSpanBegin { get; set; }
+
+ ///
+ /// Gets or sets the date the artist stopped existing, if applicable.
+ ///
+ public DateOnly? LifeSpanEnd { get; set; }
+
+ ///
+ /// Gets or sets whether the artist no longer exists.
+ ///
+ public bool IsEnded { get; set; }
+
+ ///
+ /// Gets or sets the list of genres associated with the artist.
+ ///
+ public List? Genres { get; set; }
+
+ ///
+ /// Gets or sets the list of tags that further describe or categorize the artist.
+ ///
+ public List? Tags { get; set; }
+
+ ///
+ /// Gets or sets the list of alternative names of the artist.
+ ///
+ public List? Aliases { get; set; }
+}
diff --git a/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicTrackDto.cs b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicTrackDto.cs
new file mode 100644
index 00000000..d11657b9
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicTrackDto.cs
@@ -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;
+
+///
+/// Data transfer object carrying the full details of a track, as stored in the media library.
+///
+[DebuggerDisplay("Title: {Metadata?.Title}")]
+public class MusicTrackDto
+{
+ ///
+ /// Gets or sets the Id of the track.
+ ///
+ public Guid Id { get; set; }
+
+ ///
+ /// Gets or sets the Id of the album the track belongs to.
+ ///
+ public Guid AlbumId { get; set; }
+
+ ///
+ /// Gets or sets the Id of the media library this track belongs to.
+ ///
+ public Guid LibraryId { get; set; }
+
+ ///
+ /// Gets or sets the file system path of the track.
+ ///
+ public string Path { get; set; } = string.Empty;
+
+ ///
+ /// Gets or sets the audio metadata of the track.
+ ///
+ public MusicTrackMetadataDto? Metadata { get; set; }
+
+ ///
+ /// Gets or sets the number of the track on its disc.
+ ///
+ public int TrackNumber { get; set; }
+
+ ///
+ /// Gets or sets the number of the disc the track belongs to, if applicable.
+ ///
+ public int? DiscNumber { get; set; }
+
+ ///
+ /// Gets or sets the script used by the language of the track, if applicable.
+ ///
+ public string? Script { get; set; }
+
+ ///
+ /// Gets or sets the musical key of the track, if applicable.
+ ///
+ public MusicKey? Key { get; set; }
+
+ ///
+ /// Gets or sets the tempo of the track in beats per minute, if applicable.
+ ///
+ public int? Bpm { get; set; }
+
+ ///
+ /// Gets or sets the work the track is a recording of, if applicable.
+ ///
+ public MusicWorkDto? Work { get; set; }
+
+ ///
+ /// Gets or sets the MusicBrainz identifier of the recording, if applicable.
+ ///
+ public Guid? MusicBrainzRecordingId { get; set; }
+
+ ///
+ /// Gets or sets the MusicBrainz identifier of the track, if applicable.
+ ///
+ public Guid? MusicBrainzTrackId { get; set; }
+
+ ///
+ /// Gets or sets the date and time when the track was created.
+ ///
+ public DateTime CreatedOnUtc { get; set; }
+
+ ///
+ /// Gets or sets the optional date and time when the track was updated.
+ ///
+ public DateTime? UpdatedOnUtc { get; set; }
+
+ ///
+ /// Gets or sets the list of moods of the track.
+ ///
+ public List? Moods { get; set; }
+
+ ///
+ /// Gets or sets the list of ISRC (International Standard Recording Code) of the track.
+ ///
+ public List? Isrcs { get; set; }
+
+ ///
+ /// Gets or sets the list of references to the media contributors that performed on the track, each with the role they played.
+ ///
+ public List? Contributors { get; set; }
+
+ ///
+ /// Gets or sets the list of ratings for this track.
+ ///
+ public List? Ratings { get; set; }
+}
diff --git a/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicTrackLiteDto.cs b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicTrackLiteDto.cs
new file mode 100644
index 00000000..9e4a95f3
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicTrackLiteDto.cs
@@ -0,0 +1,38 @@
+#region ========================================================================= USING =====================================================================================
+using System;
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
+
+///
+/// Data transfer object for a lightweight track element, containing only the properties needed by the client to display the tracks of an album.
+///
+[DebuggerDisplay("Title: {Title}")]
+public class MusicTrackLiteDto
+{
+ ///
+ /// Gets or sets the Id of the track.
+ ///
+ public Guid Id { get; set; }
+
+ ///
+ /// Gets or sets the title of the track.
+ ///
+ public string Title { get; set; } = string.Empty;
+
+ ///
+ /// Gets or sets the number of the track on its disc.
+ ///
+ public int TrackNumber { get; set; }
+
+ ///
+ /// Gets or sets the number of the disc the track belongs to, if applicable.
+ ///
+ public int? DiscNumber { get; set; }
+
+ ///
+ /// Gets or sets the duration of the track in seconds.
+ ///
+ public int DurationInSeconds { get; set; }
+}
diff --git a/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicTrackMetadataDto.cs b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicTrackMetadataDto.cs
new file mode 100644
index 00000000..cfd7f619
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicTrackMetadataDto.cs
@@ -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;
+
+///
+/// Data transfer object for the audio metadata of a track.
+///
+[DebuggerDisplay("Title: {Title}")]
+public class MusicTrackMetadataDto
+{
+ ///
+ /// Gets or sets the title of the track.
+ ///
+ public string? Title { get; set; }
+
+ ///
+ /// Gets or sets the original title of the track, if different from the current title.
+ ///
+ public string? OriginalTitle { get; set; }
+
+ ///
+ /// Gets or sets a brief description or summary of the track.
+ ///
+ public string? Description { get; set; }
+
+ ///
+ /// Gets or sets the disambiguation comment of the track, used to distinguish tracks with the same title.
+ ///
+ public string? Disambiguation { get; set; }
+
+ ///
+ /// Gets or sets the release information, including release date and other relevant details.
+ ///
+ public ReleaseInfoDto? ReleaseInfo { get; set; }
+
+ ///
+ /// Gets or sets the language of the track.
+ ///
+ public LanguageInfoDto? Language { get; set; }
+
+ ///
+ /// Gets or sets the original language of the track, if it has been translated.
+ ///
+ public LanguageInfoDto? OriginalLanguage { get; set; }
+
+ ///
+ /// Gets or sets the list of tags that further describe or categorize the track.
+ ///
+ public List? Tags { get; set; }
+
+ ///
+ /// Gets or sets the list of genres associated with the track.
+ ///
+ public List? Genres { get; set; }
+
+ ///
+ /// Gets or sets whether the recording of the track is a video recording.
+ ///
+ public bool IsVideo { get; set; }
+
+ ///
+ /// Gets or sets the duration of the audio of the track in seconds.
+ ///
+ public int? DurationInSeconds { get; set; }
+
+ ///
+ /// Gets or sets the sample rate of the audio of the track in Hz.
+ ///
+ public int? SampleRate { get; set; }
+
+ ///
+ /// Gets or sets the number of audio channels of the track.
+ ///
+ public int? Channels { get; set; }
+
+ ///
+ /// Gets or sets the bit depth of the audio of the track.
+ ///
+ public int? BitDepth { get; set; }
+
+ ///
+ /// Gets or sets the audio codec used by the track.
+ ///
+ public string? AudioCodec { get; set; }
+
+ ///
+ /// Gets or sets the bitrate of the audio of the track in kbps.
+ ///
+ public int? Bitrate { get; set; }
+
+ ///
+ /// Gets or sets the AcoustID fingerprint identifier of the audio file of the track.
+ ///
+ public string? AcoustId { get; set; }
+
+ ///
+ /// Gets or sets the ReplayGain track gain of the track in decibels.
+ ///
+ public decimal? ReplayGainTrackGain { get; set; }
+
+ ///
+ /// Gets or sets the ReplayGain track peak of the track.
+ ///
+ public decimal? ReplayGainTrackPeak { get; set; }
+
+ ///
+ /// Gets or sets the ReplayGain album gain of the track in decibels.
+ ///
+ public decimal? ReplayGainAlbumGain { get; set; }
+
+ ///
+ /// Gets or sets the ReplayGain album peak of the track.
+ ///
+ public decimal? ReplayGainAlbumPeak { get; set; }
+}
diff --git a/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicWorkDto.cs b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicWorkDto.cs
new file mode 100644
index 00000000..deec7c85
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicWorkDto.cs
@@ -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;
+
+///
+/// Data transfer object for a MusicBrainz work, the musical composition a track is a recording of.
+///
+[DebuggerDisplay("Title: {Title}")]
+public class MusicWorkDto
+{
+ ///
+ /// Gets or sets the MusicBrainz identifier of the work.
+ ///
+ public Guid? MusicBrainzWorkId { get; set; }
+
+ ///
+ /// Gets or sets the title of the work.
+ ///
+ public string? Title { get; set; }
+
+ ///
+ /// Gets or sets the MusicBrainz type of the work, if applicable.
+ ///
+ public string? Type { get; set; }
+
+ ///
+ /// Gets or sets the list of languages of the work.
+ ///
+ public List? Languages { get; set; }
+
+ ///
+ /// Gets or sets the list of ISWC (International Standard Musical Work Code) of the work.
+ ///
+ public List? Iswcs { get; set; }
+}
diff --git a/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/PaginatedMusicAlbumLiteDto.cs b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/PaginatedMusicAlbumLiteDto.cs
new file mode 100644
index 00000000..19cfaa36
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/PaginatedMusicAlbumLiteDto.cs
@@ -0,0 +1,38 @@
+#region ========================================================================= USING =====================================================================================
+using System.Collections.Generic;
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
+
+///
+/// Data transfer object for a paginated collection of lightweight album elements, together with pagination metadata.
+///
+[DebuggerDisplay("CurrentPage: {CurrentPage}; Count: {Count}")]
+public class PaginatedMusicAlbumLiteDto
+{
+ ///
+ /// Gets or sets the collection of lightweight album elements associated with this instance.
+ ///
+ public IReadOnlyList Data { get; set; } = [];
+
+ ///
+ /// Gets or sets the current page number in a paginated collection.
+ ///
+ public int CurrentPage { get; set; }
+
+ ///
+ /// Gets or sets the number of items to include per page in paginated results.
+ ///
+ public int PerPage { get; set; }
+
+ ///
+ /// Gets or sets the total number of elements available in the paginated result set.
+ ///
+ public int Count { get; set; }
+
+ ///
+ /// Gets or sets the total number of pages based on elements available in the result set and per page.
+ ///
+ public int NumberOfPages { get; set; }
+}
diff --git a/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/PaginatedMusicArtistLiteDto.cs b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/PaginatedMusicArtistLiteDto.cs
new file mode 100644
index 00000000..780e6638
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/PaginatedMusicArtistLiteDto.cs
@@ -0,0 +1,38 @@
+#region ========================================================================= USING =====================================================================================
+using System.Collections.Generic;
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
+
+///
+/// Data transfer object for a paginated collection of lightweight music artist elements, together with pagination metadata.
+///
+[DebuggerDisplay("CurrentPage: {CurrentPage}; Count: {Count}")]
+public class PaginatedMusicArtistLiteDto
+{
+ ///
+ /// Gets or sets the collection of lightweight music artist elements associated with this instance.
+ ///
+ public IReadOnlyList Data { get; set; } = [];
+
+ ///
+ /// Gets or sets the current page number in a paginated collection.
+ ///
+ public int CurrentPage { get; set; }
+
+ ///
+ /// Gets or sets the number of items to include per page in paginated results.
+ ///
+ public int PerPage { get; set; }
+
+ ///
+ /// Gets or sets the total number of elements available in the paginated result set.
+ ///
+ public int Count { get; set; }
+
+ ///
+ /// Gets or sets the total number of pages based on elements available in the result set and per page.
+ ///
+ public int NumberOfPages { get; set; }
+}
diff --git a/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/PaginatedMusicTrackLiteDto.cs b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/PaginatedMusicTrackLiteDto.cs
new file mode 100644
index 00000000..6c112daa
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/PaginatedMusicTrackLiteDto.cs
@@ -0,0 +1,38 @@
+#region ========================================================================= USING =====================================================================================
+using System.Collections.Generic;
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
+
+///
+/// Data transfer object for a paginated collection of lightweight track elements, together with pagination metadata.
+///
+[DebuggerDisplay("CurrentPage: {CurrentPage}; Count: {Count}")]
+public class PaginatedMusicTrackLiteDto
+{
+ ///
+ /// Gets or sets the collection of lightweight track elements associated with this instance.
+ ///
+ public IReadOnlyList Data { get; set; } = [];
+
+ ///
+ /// Gets or sets the current page number in a paginated collection.
+ ///
+ public int CurrentPage { get; set; }
+
+ ///
+ /// Gets or sets the number of items to include per page in paginated results.
+ ///
+ public int PerPage { get; set; }
+
+ ///
+ /// Gets or sets the total number of elements available in the paginated result set.
+ ///
+ public int Count { get; set; }
+
+ ///
+ /// Gets or sets the total number of pages based on elements available in the result set and per page.
+ ///
+ public int NumberOfPages { get; set; }
+}
diff --git a/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/UpdateMusicCoverDto.cs b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/UpdateMusicCoverDto.cs
new file mode 100644
index 00000000..2c47c06a
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/UpdateMusicCoverDto.cs
@@ -0,0 +1,17 @@
+#region ========================================================================= USING =====================================================================================
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
+
+///
+/// Data transfer object for the response of an update music cover operation.
+///
+[DebuggerDisplay("CoverPath: {CoverPath}")]
+public class UpdateMusicCoverDto
+{
+ ///
+ /// Gets or sets the relative path of the stored cover image.
+ ///
+ public string? CoverPath { get; set; }
+}
diff --git a/src/Lumina.Presentation.Web/Common/DTO/Common/MediaArtworkDto.cs b/src/Lumina.Presentation.Web/Common/DTO/Common/MediaArtworkDto.cs
new file mode 100644
index 00000000..6bb1ced8
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/DTO/Common/MediaArtworkDto.cs
@@ -0,0 +1,28 @@
+#region ========================================================================= USING =====================================================================================
+using Lumina.Presentation.Web.Common.Enums.MediaLibrary;
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.DTO.Common;
+
+///
+/// Data transfer object for a stored piece of artwork of a media item.
+///
+[DebuggerDisplay("Type: {Type}, Ordinal: {Ordinal}, Path: {Path}")]
+public class MediaArtworkDto
+{
+ ///
+ /// Gets or sets the type of the artwork, like the cover or the back of the media item.
+ ///
+ public ArtworkType Type { get; set; }
+
+ ///
+ /// Gets or sets the ordinal of the artwork within its type, so that multiple artworks of the same type can be ordered.
+ ///
+ public int Ordinal { get; set; }
+
+ ///
+ /// Gets or sets the relative path of the stored artwork file.
+ ///
+ public string Path { get; set; } = string.Empty;
+}
diff --git a/src/Lumina.Presentation.Web/Common/DTO/Common/MoodDto.cs b/src/Lumina.Presentation.Web/Common/DTO/Common/MoodDto.cs
new file mode 100644
index 00000000..97bcce0b
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/DTO/Common/MoodDto.cs
@@ -0,0 +1,17 @@
+#region ========================================================================= USING =====================================================================================
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.DTO.Common;
+
+///
+/// Data transfer object for a mood of a media element.
+///
+[DebuggerDisplay("Name: {Name}")]
+public class MoodDto
+{
+ ///
+ /// Gets or sets the name of the mood.
+ ///
+ public string? Name { get; set; }
+}
diff --git a/src/Lumina.Presentation.Web/Common/DTO/MediaContributors/MediaContributorReferenceDto.cs b/src/Lumina.Presentation.Web/Common/DTO/MediaContributors/MediaContributorReferenceDto.cs
new file mode 100644
index 00000000..94f117ff
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/DTO/MediaContributors/MediaContributorReferenceDto.cs
@@ -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;
+
+///
+/// Data transfer object for the reference to a media contributor in a media item, carrying the role the contributor played.
+///
+[DebuggerDisplay("{ContributorId} - {Role}")]
+public class MediaContributorReferenceDto
+{
+ ///
+ /// Gets or sets the unique identifier of the media contributor.
+ ///
+ public Guid ContributorId { get; set; }
+
+ ///
+ /// Gets or sets the role the contributor played.
+ ///
+ public MediaContributorRole? Role { get; set; }
+}
diff --git a/src/Lumina.Presentation.Web/Common/Enums/AudioLibrary/MusicArtistGender.cs b/src/Lumina.Presentation.Web/Common/Enums/AudioLibrary/MusicArtistGender.cs
new file mode 100644
index 00000000..8339bc74
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Enums/AudioLibrary/MusicArtistGender.cs
@@ -0,0 +1,32 @@
+#region ========================================================================= USING =====================================================================================
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.Enums.AudioLibrary;
+
+///
+/// Enumeration for the gender of a music artist, applicable only to artists that are persons or characters.
+///
+[DebuggerDisplay("{ToString()}")]
+public enum MusicArtistGender
+{
+ ///
+ /// The artist identifies as male.
+ ///
+ Male,
+
+ ///
+ /// The artist identifies as female.
+ ///
+ Female,
+
+ ///
+ /// The artist identifies with a gender other than male or female.
+ ///
+ Other,
+
+ ///
+ /// The gender of the artist is not applicable, or is deliberately not stated.
+ ///
+ NotApplicable
+}
diff --git a/src/Lumina.Presentation.Web/Common/Enums/AudioLibrary/MusicArtistType.cs b/src/Lumina.Presentation.Web/Common/Enums/AudioLibrary/MusicArtistType.cs
new file mode 100644
index 00000000..68d21f09
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Enums/AudioLibrary/MusicArtistType.cs
@@ -0,0 +1,42 @@
+#region ========================================================================= USING =====================================================================================
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.Enums.AudioLibrary;
+
+///
+/// Enumeration for the type of a music artist, describing whether the artist is an individual, an ensemble, or something else.
+///
+[DebuggerDisplay("{ToString()}")]
+public enum MusicArtistType
+{
+ ///
+ /// The artist is an individual person.
+ ///
+ Person,
+
+ ///
+ /// The artist is a group of people that may or may not have a distinctive name.
+ ///
+ Group,
+
+ ///
+ /// The artist is an orchestra, a large instrumental ensemble.
+ ///
+ Orchestra,
+
+ ///
+ /// The artist is a choir or chorus, a large vocal ensemble.
+ ///
+ Choir,
+
+ ///
+ /// The artist is an individual fictional character.
+ ///
+ Character,
+
+ ///
+ /// The type of the artist does not fit into any of the known categories.
+ ///
+ Other
+}
diff --git a/src/Lumina.Presentation.Web/Common/Enums/AudioLibrary/MusicKey.cs b/src/Lumina.Presentation.Web/Common/Enums/AudioLibrary/MusicKey.cs
new file mode 100644
index 00000000..14d0fbc4
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Enums/AudioLibrary/MusicKey.cs
@@ -0,0 +1,132 @@
+#region ========================================================================= USING =====================================================================================
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.Enums.AudioLibrary;
+
+///
+/// Enumeration for the musical key of a track, describing the pitch and the major or minor mode of the key.
+///
+[DebuggerDisplay("{ToString()}")]
+public enum MusicKey
+{
+ ///
+ /// The musical key of C major.
+ ///
+ CMajor,
+
+ ///
+ /// The musical key of C sharp major.
+ ///
+ CSharpMajor,
+
+ ///
+ /// The musical key of D major.
+ ///
+ DMajor,
+
+ ///
+ /// The musical key of D sharp major.
+ ///
+ DSharpMajor,
+
+ ///
+ /// The musical key of E major.
+ ///
+ EMajor,
+
+ ///
+ /// The musical key of F major.
+ ///
+ FMajor,
+
+ ///
+ /// The musical key of F sharp major.
+ ///
+ FSharpMajor,
+
+ ///
+ /// The musical key of G major.
+ ///
+ GMajor,
+
+ ///
+ /// The musical key of G sharp major.
+ ///
+ GSharpMajor,
+
+ ///
+ /// The musical key of A major.
+ ///
+ AMajor,
+
+ ///
+ /// The musical key of A sharp major.
+ ///
+ ASharpMajor,
+
+ ///
+ /// The musical key of B major.
+ ///
+ BMajor,
+
+ ///
+ /// The musical key of C minor.
+ ///
+ CMinor,
+
+ ///
+ /// The musical key of C sharp minor.
+ ///
+ CSharpMinor,
+
+ ///
+ /// The musical key of D minor.
+ ///
+ DMinor,
+
+ ///
+ /// The musical key of D sharp minor.
+ ///
+ DSharpMinor,
+
+ ///
+ /// The musical key of E minor.
+ ///
+ EMinor,
+
+ ///
+ /// The musical key of F minor.
+ ///
+ FMinor,
+
+ ///
+ /// The musical key of F sharp minor.
+ ///
+ FSharpMinor,
+
+ ///
+ /// The musical key of G minor.
+ ///
+ GMinor,
+
+ ///
+ /// The musical key of G sharp minor.
+ ///
+ GSharpMinor,
+
+ ///
+ /// The musical key of A minor.
+ ///
+ AMinor,
+
+ ///
+ /// The musical key of A sharp minor.
+ ///
+ ASharpMinor,
+
+ ///
+ /// The musical key of B minor.
+ ///
+ BMinor
+}
diff --git a/src/Lumina.Presentation.Web/Common/Enums/AudioLibrary/MusicMediaFormat.cs b/src/Lumina.Presentation.Web/Common/Enums/AudioLibrary/MusicMediaFormat.cs
new file mode 100644
index 00000000..6090c575
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Enums/AudioLibrary/MusicMediaFormat.cs
@@ -0,0 +1,577 @@
+#region ========================================================================= USING =====================================================================================
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.Enums.AudioLibrary;
+
+///
+/// Enumeration for the physical or digital medium of a music release.
+///
+[DebuggerDisplay("{ToString()}")]
+public enum MusicMediaFormat
+{
+ ///
+ /// The release was distributed on a 10 inch acetate disc.
+ ///
+ Inch10Acetate,
+
+ ///
+ /// The release was distributed on a 10 inch shellac disc.
+ ///
+ Inch10Shellac,
+
+ ///
+ /// The release was distributed on a 10 inch vinyl record.
+ ///
+ Inch10Vinyl,
+
+ ///
+ /// The release was distributed on a 12 inch acetate disc.
+ ///
+ Inch12Acetate,
+
+ ///
+ /// The release was distributed on a 12 inch LaserDisc.
+ ///
+ Inch12LaserDisc,
+
+ ///
+ /// The release was distributed on a 12 inch shellac disc.
+ ///
+ Inch12Shellac,
+
+ ///
+ /// The release was distributed on a 12 inch vinyl record.
+ ///
+ Inch12Vinyl,
+
+ ///
+ /// The release was distributed on a 3 inch vinyl record.
+ ///
+ Inch3Vinyl,
+
+ ///
+ /// The release was distributed on a 3.5 inch floppy disk.
+ ///
+ Inch3_5FloppyDisk,
+
+ ///
+ /// The release was distributed on a 5.25 inch floppy disk.
+ ///
+ Inch5_25FloppyDisk,
+
+ ///
+ /// The release was distributed on a 7 inch acetate disc.
+ ///
+ Inch7Acetate,
+
+ ///
+ /// The release was distributed on a 7 inch flexi disc.
+ ///
+ Inch7FlexiDisc,
+
+ ///
+ /// The release was distributed on a 7 inch shellac disc.
+ ///
+ Inch7Shellac,
+
+ ///
+ /// The release was distributed on a 7 inch vinyl record.
+ ///
+ Inch7Vinyl,
+
+ ///
+ /// The release was distributed on an 8 inch LaserDisc.
+ ///
+ Inch8LaserDisc,
+
+ ///
+ /// The release was distributed on an 8-track cartridge.
+ ///
+ EightTrackCartridge,
+
+ ///
+ /// The release was distributed on an 8 cm compact disc.
+ ///
+ Cm8CD,
+
+ ///
+ /// The release was distributed on an 8 cm compact disc with graphics.
+ ///
+ Cm8CDPlusG,
+
+ ///
+ /// The release was distributed on an 8 cm recordable compact disc.
+ ///
+ Cm8CDMinusR,
+
+ ///
+ /// The release was distributed on an acetate disc.
+ ///
+ Acetate,
+
+ ///
+ /// The release was distributed on a Betacam SP videotape.
+ ///
+ BetacamSP,
+
+ ///
+ /// The release was distributed on a Betamax videocassette.
+ ///
+ Betamax,
+
+ ///
+ /// The release was distributed on a Blu-ray disc.
+ ///
+ BluRay,
+
+ ///
+ /// The release was distributed on a recordable Blu-ray disc.
+ ///
+ BluRayMinusR,
+
+ ///
+ /// The release was distributed on a Blu-spec compact disc.
+ ///
+ BluSpecCD,
+
+ ///
+ /// The release was distributed on a cartridge.
+ ///
+ Cartridge,
+
+ ///
+ /// The release was distributed on a compact cassette.
+ ///
+ Cassette,
+
+ ///
+ /// The release was distributed on a compact disc.
+ ///
+ CD,
+
+ ///
+ /// The release was distributed on a compact disc with graphics.
+ ///
+ CDPlusG,
+
+ ///
+ /// The release was distributed on a CD-i (compact disc interactive).
+ ///
+ CDMinusi,
+
+ ///
+ /// The release was distributed on a recordable compact disc.
+ ///
+ CDMinusR,
+
+ ///
+ /// The release was distributed on a CD Video.
+ ///
+ CDV,
+
+ ///
+ /// The release was distributed on a Capacitance Electronic Disc.
+ ///
+ CED,
+
+ ///
+ /// The release was distributed on a copy-controlled compact disc.
+ ///
+ CopyControlCD,
+
+ ///
+ /// The release was distributed on a Digital Audio Tape.
+ ///
+ DAT,
+
+ ///
+ /// The release was distributed on a compact disc used for data storage.
+ ///
+ DataCD,
+
+ ///
+ /// The release was distributed on a DVD used for data storage.
+ ///
+ DataDVD,
+
+ ///
+ /// The release was distributed on a recordable DVD used for data storage.
+ ///
+ DataDVDMinusR,
+
+ ///
+ /// The release was distributed on a DataPlay disc.
+ ///
+ DataPlay,
+
+ ///
+ /// The release was distributed on a Digital Compact Cassette.
+ ///
+ DCC,
+
+ ///
+ /// The release was distributed as a digital download or stream.
+ ///
+ DigitalMedia,
+
+ ///
+ /// The release was distributed on a download card.
+ ///
+ DownloadCard,
+
+ ///
+ /// The release was distributed on a DTS-compatible compact disc.
+ ///
+ DTSCD,
+
+ ///
+ /// The release was distributed on a DualDisc.
+ ///
+ DualDisc,
+
+ ///
+ /// The release was distributed on the CD side of a DualDisc.
+ ///
+ DualDiscCDSide,
+
+ ///
+ /// The release was distributed on the DVD side of a DualDisc.
+ ///
+ DualDiscDVDSide,
+
+ ///
+ /// The release was distributed on the DVD-audio side of a DualDisc.
+ ///
+ DualDiscDVDAudioSide,
+
+ ///
+ /// The release was distributed on the DVD-video side of a DualDisc.
+ ///
+ DualDiscDVDVideoSide,
+
+ ///
+ /// The release was distributed on a DVD.
+ ///
+ DVD,
+
+ ///
+ /// The release was distributed on a DVD-Audio.
+ ///
+ DVDAudio,
+
+ ///
+ /// The release was distributed on a recordable DVD used for video.
+ ///
+ DVDMinusRVideo,
+
+ ///
+ /// The release was distributed on a DVD-Video.
+ ///
+ DVDVideo,
+
+ ///
+ /// The release was distributed on a DVD+.
+ ///
+ DVDPlus,
+
+ ///
+ /// The release was distributed on the CD side of a DVD+.
+ ///
+ DVDPlusCDSide,
+
+ ///
+ /// The release was distributed on the DVD-audio side of a DVD+.
+ ///
+ DVDPlusDVDAudioSide,
+
+ ///
+ /// The release was distributed on the DVD-video side of a DVD+.
+ ///
+ DVDPlusDVDVideoSide,
+
+ ///
+ /// The release was distributed on an Edison Diamond Disc.
+ ///
+ EdisonDiamondDisc,
+
+ ///
+ /// The release was distributed on an enhanced compact disc.
+ ///
+ EnhancedCD,
+
+ ///
+ /// The release was distributed on a flexi disc.
+ ///
+ FlexiDisc,
+
+ ///
+ /// The release was distributed on a floppy disk.
+ ///
+ FloppyDisk,
+
+ ///
+ /// The release was distributed on an HD DVD.
+ ///
+ HDDVD,
+
+ ///
+ /// The release was distributed on a High Definition Compatible Digital compact disc.
+ ///
+ HDCD,
+
+ ///
+ /// The release was distributed on a HiPac.
+ ///
+ HiPac,
+
+ ///
+ /// The release was distributed on a High Quality compact disc.
+ ///
+ HQCD,
+
+ ///
+ /// The release was distributed on a hybrid Super Audio CD.
+ ///
+ HybridSACD,
+
+ ///
+ /// The release was distributed on the CD layer of a hybrid Super Audio CD.
+ ///
+ HybridSACDCDLayer,
+
+ ///
+ /// The release was distributed on the SACD layer of a hybrid Super Audio CD.
+ ///
+ HybridSACDSACDLayer,
+
+ ///
+ /// The release was distributed on the stereo SACD layer of a hybrid Super Audio CD.
+ ///
+ HybridSACDSACDLayer2Channels,
+
+ ///
+ /// The release was distributed on the multichannel SACD layer of a hybrid Super Audio CD.
+ ///
+ HybridSACDSACDLayerMultichannel,
+
+ ///
+ /// The release was distributed on a KiT album.
+ ///
+ KiTAlbum,
+
+ ///
+ /// The release was distributed on a LaserDisc.
+ ///
+ LaserDisc,
+
+ ///
+ /// The release was distributed on a microcassette.
+ ///
+ Microcassette,
+
+ ///
+ /// The release was distributed on a microSD card.
+ ///
+ MicroSD,
+
+ ///
+ /// The release was distributed on a MiniDisc.
+ ///
+ MiniDisc,
+
+ ///
+ /// The release was distributed on a mini DVD.
+ ///
+ MiniDVD,
+
+ ///
+ /// The release was distributed on a mini DVD-Audio.
+ ///
+ MiniDVDAudio,
+
+ ///
+ /// The release was distributed on a mini DVD-Video.
+ ///
+ MiniDVDVideo,
+
+ ///
+ /// The release was distributed on a MiniMax compact disc.
+ ///
+ MinimaxCD,
+
+ ///
+ /// The release was distributed on a MiniMax DVD.
+ ///
+ MinimaxDVD,
+
+ ///
+ /// The release was distributed on a MiniMax DVD-Audio.
+ ///
+ MinimaxDVDAudio,
+
+ ///
+ /// The release was distributed on a MiniMax DVD-Video.
+ ///
+ MinimaxDVDVideo,
+
+ ///
+ /// The release was distributed on a mixed-mode compact disc.
+ ///
+ MixedModeCD,
+
+ ///
+ /// The medium of the release does not fall into any of the known categories.
+ ///
+ Other,
+
+ ///
+ /// The release was distributed on a Pathe disc.
+ ///
+ PatheDisc,
+
+ ///
+ /// The release was distributed on a phonograph record.
+ ///
+ PhonographRecord,
+
+ ///
+ /// The release was distributed on a piano roll.
+ ///
+ PianoRoll,
+
+ ///
+ /// The release was distributed on a Playbutton.
+ ///
+ Playbutton,
+
+ ///
+ /// The release was distributed on a PlayTape.
+ ///
+ PlayTape,
+
+ ///
+ /// The release was distributed on a reel-to-reel tape.
+ ///
+ ReelToReel,
+
+ ///
+ /// The release was distributed on a read-only memory cartridge.
+ ///
+ ROMCartridge,
+
+ ///
+ /// The release was distributed on a Super Audio CD.
+ ///
+ SACD,
+
+ ///
+ /// The release was distributed on a stereo Super Audio CD.
+ ///
+ SACD2Channels,
+
+ ///
+ /// The release was distributed on a multichannel Super Audio CD.
+ ///
+ SACDMultichannel,
+
+ ///
+ /// The release was distributed on an SD card.
+ ///
+ SDCard,
+
+ ///
+ /// The release was distributed on a shellac disc.
+ ///
+ Shellac,
+
+ ///
+ /// The release was distributed on a Super High Material compact disc.
+ ///
+ SHMCD,
+
+ ///
+ /// The release was distributed on a Super High Material Super Audio CD.
+ ///
+ SHMSACD,
+
+ ///
+ /// The release was distributed on a multichannel Super High Material Super Audio CD.
+ ///
+ SHMSACDMultichannel,
+
+ ///
+ /// The release was distributed on a slotMusic card.
+ ///
+ SlotMusic,
+
+ ///
+ /// The release was distributed on a Super Video CD.
+ ///
+ SVCD,
+
+ ///
+ /// The release was distributed on a Tefifon cartridge.
+ ///
+ Tefifon,
+
+ ///
+ /// The release was distributed on a Universal Media Disc.
+ ///
+ UMD,
+
+ ///
+ /// The release was distributed on a USB flash drive.
+ ///
+ USBFlashDrive,
+
+ ///
+ /// The release was distributed on a Video CD.
+ ///
+ VCD,
+
+ ///
+ /// The release was distributed on a Video High Density disc.
+ ///
+ VHD,
+
+ ///
+ /// The release was distributed on a VHS videocassette.
+ ///
+ VHS,
+
+ ///
+ /// The release was distributed on a vinyl record.
+ ///
+ Vinyl,
+
+ ///
+ /// The release was distributed on a VinylDisc.
+ ///
+ VinylDisc,
+
+ ///
+ /// The release was distributed on the CD side of a VinylDisc.
+ ///
+ VinylDiscCDSide,
+
+ ///
+ /// The release was distributed on the DVD side of a VinylDisc.
+ ///
+ VinylDiscDVDSide,
+
+ ///
+ /// The release was distributed on the vinyl side of a VinylDisc.
+ ///
+ VinylDiscVinylSide,
+
+ ///
+ /// The release was distributed on a wax cylinder.
+ ///
+ WaxCylinder,
+
+ ///
+ /// The release was distributed on a Zip disk.
+ ///
+ ZipDisk
+}
diff --git a/src/Lumina.Presentation.Web/Common/Enums/AudioLibrary/MusicReleasePackaging.cs b/src/Lumina.Presentation.Web/Common/Enums/AudioLibrary/MusicReleasePackaging.cs
new file mode 100644
index 00000000..d111e3a9
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Enums/AudioLibrary/MusicReleasePackaging.cs
@@ -0,0 +1,132 @@
+#region ========================================================================= USING =====================================================================================
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.Enums.AudioLibrary;
+
+///
+/// Enumeration for the outermost physical packaging of a music release.
+///
+[DebuggerDisplay("{ToString()}")]
+public enum MusicReleasePackaging
+{
+ ///
+ /// The release is a book with a sleeve containing a medium, usually a compact disc.
+ ///
+ Book,
+
+ ///
+ /// The release is a box with a lid or an opening that contains the medium and other packaging, like posters and a booklet.
+ ///
+ Box,
+
+ ///
+ /// The release is a sleeve made of paper, paperboard, or cardboard.
+ ///
+ CardboardPaperSleeve,
+
+ ///
+ /// The release is a regular plastic case for a cassette.
+ ///
+ CassetteCase,
+
+ ///
+ /// The release is a minimalistic plastic case where the back and the front are kept together by a small hinge.
+ ///
+ ClamshellCase,
+
+ ///
+ /// The release is a bounded booklet, usually in hardcover, with a sleeve bound to its spine that houses a compact disc.
+ ///
+ Digibook,
+
+ ///
+ /// The release is a folded cardboard compact disc packaging that has a small pocket on one side for the disc.
+ ///
+ Digifile,
+
+ ///
+ /// The release is a folded case, typically made of coated paperboard, with one or more plastic trays glued into it.
+ ///
+ Digipak,
+
+ ///
+ /// The release is a pouch-like package with an internal mechanism that pushes the contents out when the lid flap is opened.
+ ///
+ DiscboxSlider,
+
+ ///
+ /// The release is a double-sided, double-width jewel case normally holding two to four compact discs.
+ ///
+ Fatbox,
+
+ ///
+ /// The release is a cardboard sleeve that folds in halves, thirds, or more, and can hold multiple records, compact discs, booklets, or posters.
+ ///
+ GatefoldCover,
+
+ ///
+ /// The release is the traditional compact disc case, made of hard, brittle plastic.
+ ///
+ JewelCase,
+
+ ///
+ /// The release is the traditional DVD case, made of soft plastic with a thin transparent cover protecting the artwork.
+ ///
+ KeepCase,
+
+ ///
+ /// The release is a large cardboard box, often used to sell compact discs in North America so that they would fit vinyl racks.
+ ///
+ Longbox,
+
+ ///
+ /// The release is an often decorated metal tin containing one or more compact discs.
+ ///
+ MetalTin,
+
+ ///
+ /// The release is a sleeve made entirely of plastic that holds the medium and the other parts of the album.
+ ///
+ PlasticSleeve,
+
+ ///
+ /// The release is a box with openings at its two ends that contains a tray holding the medium.
+ ///
+ Slidepack,
+
+ ///
+ /// The release is a thinner jewel case, commonly used for compact disc singles.
+ ///
+ SlimJewelCase,
+
+ ///
+ /// The release is a four or five-sided box that surrounds a second inner package such as a jewel case.
+ ///
+ Slipcase,
+
+ ///
+ /// The release is a digipak-like case held together with a snapping plastic closure.
+ ///
+ SnapCase,
+
+ ///
+ /// The release is a cardboard jacket, commonly used for 8cm compact disc singles in Japan.
+ ///
+ SnapPack,
+
+ ///
+ /// The release is a case similar to the regular jewel case, but with rounded corners and a latch closing mechanism.
+ ///
+ SuperJewelBox,
+
+ ///
+ /// The packaging of the release does not fit into any of the known categories.
+ ///
+ Other,
+
+ ///
+ /// The release has no packaging at all, which is common for digital media.
+ ///
+ None
+}
diff --git a/src/Lumina.Presentation.Web/Common/Enums/AudioLibrary/MusicReleaseStatus.cs b/src/Lumina.Presentation.Web/Common/Enums/AudioLibrary/MusicReleaseStatus.cs
new file mode 100644
index 00000000..f5b871f4
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Enums/AudioLibrary/MusicReleaseStatus.cs
@@ -0,0 +1,47 @@
+#region ========================================================================= USING =====================================================================================
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.Enums.AudioLibrary;
+
+///
+/// Enumeration for the status of a music release, describing the officiality of the release.
+///
+[DebuggerDisplay("{ToString()}")]
+public enum MusicReleaseStatus
+{
+ ///
+ /// The release was distributed without the authorization of the artist or label.
+ ///
+ Bootleg,
+
+ ///
+ /// The release was announced but never distributed.
+ ///
+ Cancelled,
+
+ ///
+ /// The release was expunged from the catalog of the artist or label.
+ ///
+ Expunged,
+
+ ///
+ /// The release was released through official channels.
+ ///
+ Official,
+
+ ///
+ /// The release was distributed for promotional purposes only.
+ ///
+ Promotion,
+
+ ///
+ /// The release is a pseudo-release, not an actual release by the artist.
+ ///
+ PseudoRelease,
+
+ ///
+ /// The release was distributed but later withdrawn from circulation.
+ ///
+ Withdrawn
+}
diff --git a/src/Lumina.Presentation.Web/Common/Enums/AudioLibrary/MusicReleaseType.cs b/src/Lumina.Presentation.Web/Common/Enums/AudioLibrary/MusicReleaseType.cs
new file mode 100644
index 00000000..900d45fb
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Enums/AudioLibrary/MusicReleaseType.cs
@@ -0,0 +1,97 @@
+#region ========================================================================= USING =====================================================================================
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.Enums.AudioLibrary;
+
+///
+/// Enumeration for the type of a music release, describing the format of the release in terms of its content.
+///
+[DebuggerDisplay("{ToString()}")]
+public enum MusicReleaseType
+{
+ ///
+ /// A release consisting of a collection of tracks.
+ ///
+ Album,
+
+ ///
+ /// A release that was aired as a broadcast.
+ ///
+ Broadcast,
+
+ ///
+ /// A release that is longer than a single but shorter than an album.
+ ///
+ Ep,
+
+ ///
+ /// The type of the release does not fall into any of the known categories.
+ ///
+ Other,
+
+ ///
+ /// A release consisting of a small number of tracks.
+ ///
+ Single,
+
+ ///
+ /// A release containing a dramatized audio performance.
+ ///
+ AudioDrama,
+
+ ///
+ /// A release containing a recording of a book being read aloud.
+ ///
+ AudioBook,
+
+ ///
+ /// A release that gathers tracks from various sources or artists.
+ ///
+ Compilation,
+
+ ///
+ /// A release containing a continuous mix of tracks by a DJ.
+ ///
+ DjMix,
+
+ ///
+ /// A release of demo recordings, typically distributed before the official release.
+ ///
+ Demo,
+
+ ///
+ /// A release containing an audio recording made outside of a studio.
+ ///
+ FieldRecording,
+
+ ///
+ /// A release containing a recorded interview.
+ ///
+ Interview,
+
+ ///
+ /// A release recorded during a live performance.
+ ///
+ Live,
+
+ ///
+ /// A release containing a compilation of tracks, typically distributed outside of official channels.
+ ///
+ Mixtape,
+
+ ///
+ /// A release containing modified or reinterpreted versions of original recordings.
+ ///
+ Remix,
+
+ ///
+ /// A release containing music written for a motion picture or television program.
+ ///
+ Soundtrack,
+
+ ///
+ /// A release containing spoken word content.
+ ///
+ SpokenWord
+}
diff --git a/src/Lumina.Presentation.Web/Common/Enums/MediaContributors/MediaContributorRole.cs b/src/Lumina.Presentation.Web/Common/Enums/MediaContributors/MediaContributorRole.cs
index 85935017..e0c2c77d 100644
--- a/src/Lumina.Presentation.Web/Common/Enums/MediaContributors/MediaContributorRole.cs
+++ b/src/Lumina.Presentation.Web/Common/Enums/MediaContributors/MediaContributorRole.cs
@@ -171,5 +171,10 @@ public enum MediaContributorRole
///
/// The contributor orchestrated the music of the media item.
///
- Orchestrator
+ Orchestrator,
+
+ ///
+ /// The contributor performed the media item, without a more specific role being known.
+ ///
+ Performer
}
diff --git a/src/Lumina.Presentation.Web/Common/Enums/MediaLibrary/ArtworkType.cs b/src/Lumina.Presentation.Web/Common/Enums/MediaLibrary/ArtworkType.cs
new file mode 100644
index 00000000..d152e291
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Enums/MediaLibrary/ArtworkType.cs
@@ -0,0 +1,92 @@
+namespace Lumina.Presentation.Web.Common.Enums.MediaLibrary;
+
+///
+/// Enumeration for the type of artwork of a media library item.
+///
+public enum ArtworkType
+{
+ ///
+ /// The main artwork of the media library item, like the cover of a book.
+ ///
+ Cover,
+
+ ///
+ /// The front of the artwork of the media library item, when it is stored separately from the cover.
+ ///
+ Front,
+
+ ///
+ /// The back of the artwork of the media library item.
+ ///
+ Back,
+
+ ///
+ /// A page of the booklet of the media library item.
+ ///
+ Booklet,
+
+ ///
+ /// The artwork printed on the medium of the media library item, like a disc label.
+ ///
+ Medium,
+
+ ///
+ /// The artwork printed on the tray of the media library item.
+ ///
+ Tray,
+
+ ///
+ /// The artwork printed on the spine of the media library item.
+ ///
+ Spine,
+
+ ///
+ /// The obi strip of the media library item.
+ ///
+ Obi,
+
+ ///
+ /// The sticker of the media library item.
+ ///
+ Sticker,
+
+ ///
+ /// The poster of the media library item.
+ ///
+ Poster,
+
+ ///
+ /// The liner notes of the media library item.
+ ///
+ Liner,
+
+ ///
+ /// A watermark carried by the artwork of the media library item.
+ ///
+ Watermark,
+
+ ///
+ /// The backdrop, or fanart, of the media library item.
+ ///
+ Backdrop,
+
+ ///
+ /// The banner of the media library item.
+ ///
+ Banner,
+
+ ///
+ /// The logo of the media library item.
+ ///
+ Logo,
+
+ ///
+ /// The thumbnail of the media library item.
+ ///
+ Thumb,
+
+ ///
+ /// Any other artwork of the media library item.
+ ///
+ Other,
+}
diff --git a/src/Lumina.Presentation.Web/Common/Requests/Authorization/GetUserPermissionsRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Authorization/GetUserPermissionsRequest.cs
index 25758d63..6f40ed38 100644
--- a/src/Lumina.Presentation.Web/Common/Requests/Authorization/GetUserPermissionsRequest.cs
+++ b/src/Lumina.Presentation.Web/Common/Requests/Authorization/GetUserPermissionsRequest.cs
@@ -6,7 +6,7 @@ using System.Diagnostics;
namespace Lumina.Presentation.Web.Common.Requests.Authorization;
///
-/// Represents the request model for retrieving the authorization permissions of a user identified by .
+/// Represents a request for retrieving the authorization permissions of a user identified by .
///
/// The unique identifier of the user for whom to get the authorization permissions. Required.
[DebuggerDisplay("UserId: {UserId}")]
diff --git a/src/Lumina.Presentation.Web/Common/Requests/Authorization/GetUserRoleRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Authorization/GetUserRoleRequest.cs
index 6080ba49..2a771045 100644
--- a/src/Lumina.Presentation.Web/Common/Requests/Authorization/GetUserRoleRequest.cs
+++ b/src/Lumina.Presentation.Web/Common/Requests/Authorization/GetUserRoleRequest.cs
@@ -6,7 +6,7 @@ using System.Diagnostics;
namespace Lumina.Presentation.Web.Common.Requests.Authorization;
///
-/// Represents the request model for retrieving the authorization role of a user identified by .
+/// Represents a request for retrieving the authorization role of a user identified by .
///
/// The unique identifier of the user for whom to get the authorization role. Required.
[DebuggerDisplay("UserId: {UserId}")]
diff --git a/src/Lumina.Presentation.Web/Common/Requests/FileSystemManagement/Path/GetPathParentRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/FileSystemManagement/Path/GetPathParentRequest.cs
index 2adf85a3..3e807c44 100644
--- a/src/Lumina.Presentation.Web/Common/Requests/FileSystemManagement/Path/GetPathParentRequest.cs
+++ b/src/Lumina.Presentation.Web/Common/Requests/FileSystemManagement/Path/GetPathParentRequest.cs
@@ -5,7 +5,7 @@ using System.Diagnostics;
namespace Lumina.Presentation.Web.Common.Requests.FileSystemManagement.Path;
///
-/// Represents the request for retrieving the parent path of a file system path.
+/// Represents a request for retrieving the parent path of a file system path.
///
/// The path for which the parent path is retrieved. Required.
[DebuggerDisplay("Path: {Path}")]
diff --git a/src/Lumina.Presentation.Web/Common/Requests/Libraries/GetBooksLiteRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Libraries/GetBooksLiteRequest.cs
index ea5c1b47..a487c67a 100644
--- a/src/Lumina.Presentation.Web/Common/Requests/Libraries/GetBooksLiteRequest.cs
+++ b/src/Lumina.Presentation.Web/Common/Requests/Libraries/GetBooksLiteRequest.cs
@@ -9,48 +9,26 @@ namespace Lumina.Presentation.Web.Common.Requests.Libraries;
///
/// Represents a request to get the lightweight details of the books of a media library.
///
+/// The Id of the media library whose books are retrieved. Required.
+/// The page of results to retrieve. Optional.
+/// The maximum number of books to retrieve per page. Optional.
+/// The search term used to filter results. Optional.
+///
+/// The alpha key used to filter the results by the first character of their title, for the alpha picker. Optional.
+/// Can be to disable alpha filtering, a single ASCII letter (case-insensitive) to filter by that letter,
+/// "#" to filter by titles whose first character is a digit, or "*" to filter by titles whose first character is neither a letter nor a digit.
+///
+/// Whether the leading "The " prefix of a title is ignored when computing the alpha key, or not. Optional.
+/// The name of the field by which to sort the results. Optional.
+/// The direction in which to sort the results. Optional.
[DebuggerDisplay("LibraryId: {LibraryId}")]
-public class GetBooksLiteRequest
-{
- ///
- /// Gets or sets the Id of the media library whose books are retrieved.
- ///
- public Guid LibraryId { get; set; }
-
- ///
- /// Gets or sets the page of results to retrieve.
- ///
- public int? CurrentPage { get; set; }
-
- ///
- /// Gets or sets the maximum number of books to retrieve per page.
- ///
- public int? PerPage { get; set; }
-
- ///
- /// Gets or sets the search term used to filter results.
- ///
- public string? SearchTerm { get; set; }
-
- ///
- /// Gets or sets the alpha key used to filter the results by the first character of their title, for the alpha picker.
- /// Can be to disable alpha filtering, a single ASCII letter (case-insensitive) to filter by that letter,
- /// "#" to filter by titles whose first character is a digit, or "*" to filter by titles whose first character is neither a letter nor a digit.
- ///
- public string? FilterAlphaKey { get; set; }
-
- ///
- /// Gets or sets whether the leading "The " prefix of a title is ignored when computing the alpha key, or not.
- ///
- public bool ShouldIgnoreThePrefixForAlphaPicker { get; set; }
-
- ///
- /// Gets or sets the name of the field by which to sort the results.
- ///
- public string? SortBy { get; set; }
-
- ///
- /// Gets or sets the direction in which to sort the results.
- ///
- public SortOrder? SortOrder { get; set; }
-}
+public record GetBooksLiteRequest(
+ Guid LibraryId,
+ int? CurrentPage,
+ int? PerPage,
+ string? SearchTerm,
+ string? FilterAlphaKey,
+ bool ShouldIgnoreThePrefixForAlphaPicker,
+ string? SortBy,
+ SortOrder? SortOrder
+);
diff --git a/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Albums/GetArtistAlbumsLiteRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Albums/GetArtistAlbumsLiteRequest.cs
new file mode 100644
index 00000000..71b7b956
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Albums/GetArtistAlbumsLiteRequest.cs
@@ -0,0 +1,21 @@
+#region ========================================================================= USING =====================================================================================
+using System;
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Albums;
+
+///
+/// Represents a request to get the lightweight details of the albums of a music artist.
+///
+/// The unique identifier of the artist whose albums are retrieved, taken from the route. Required.
+/// The unique identifier of the media library the artist belongs to. Required.
+/// The page of results to retrieve. Optional.
+/// The maximum number of albums to retrieve per page. Optional.
+[DebuggerDisplay("ArtistId: {ArtistId}")]
+public record GetArtistAlbumsLiteRequest(
+ string ArtistId,
+ Guid LibraryId,
+ int? CurrentPage,
+ int? PerPage
+);
diff --git a/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Albums/GetMusicAlbumViewRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Albums/GetMusicAlbumViewRequest.cs
new file mode 100644
index 00000000..dd8d1a95
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Albums/GetMusicAlbumViewRequest.cs
@@ -0,0 +1,19 @@
+#region ========================================================================= USING =====================================================================================
+using System;
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Albums;
+
+///
+/// Represents a request for displaying the details of an album of a music artist.
+///
+/// The unique identifier of the artist the album belongs to, taken from the route. Required.
+/// The unique identifier of the album whose details are displayed, taken from the route. Required.
+/// The Id of the media library the album belongs to. Required.
+[DebuggerDisplay("AlbumId: {AlbumId}")]
+public record GetMusicAlbumViewRequest(
+ string ArtistId,
+ string AlbumId,
+ Guid LibraryId
+);
diff --git a/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Albums/UpdateMusicAlbumRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Albums/UpdateMusicAlbumRequest.cs
new file mode 100644
index 00000000..b66ed2aa
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Albums/UpdateMusicAlbumRequest.cs
@@ -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;
+
+///
+/// Represents a request to update an existing album of a music artist.
+///
+/// The album metadata of the album. Required.
+/// The physical or digital medium of the album. Optional.
+/// The outermost physical packaging of the album. Optional.
+/// The barcode of the album. Optional.
+/// The catalog numbers of the album. Optional.
+/// The name of the label that issued the album. Optional.
+/// The ASIN (Amazon Standard Identification Number) of the album. Optional.
+/// The MusicBrainz identifier of the release. Optional.
+/// The MusicBrainz identifier of the release group. Optional.
+/// The MusicBrainz identifier of the release artist. Optional.
+/// The list of media contributors that performed on the album. Required.
+/// The list of ratings for this album. Required.
+[DebuggerDisplay("Title: {Metadata?.Title}")]
+public record UpdateMusicAlbumRequest(
+ MusicAlbumMetadataDto? Metadata,
+ MusicMediaFormat? MediaFormat,
+ MusicReleasePackaging? Packaging,
+ string? Barcode,
+ List? CatalogNumbers,
+ string? Label,
+ string? ASIN,
+ Guid? MusicBrainzReleaseId,
+ Guid? MusicBrainzReleaseGroupId,
+ Guid? MusicBrainzReleaseArtistId,
+ List? Contributors,
+ List? Ratings
+);
diff --git a/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtistViewRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtistViewRequest.cs
new file mode 100644
index 00000000..76277f04
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtistViewRequest.cs
@@ -0,0 +1,17 @@
+#region ========================================================================= USING =====================================================================================
+using System;
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists;
+
+///
+/// Represents a request for displaying the details of a music artist.
+///
+/// The unique identifier of the artist whose details are displayed, taken from the route. Required.
+/// The Id of the media library the artist belongs to. Required.
+[DebuggerDisplay("ArtistId: {ArtistId}")]
+public record GetMusicArtistViewRequest(
+ string ArtistId,
+ Guid LibraryId
+);
diff --git a/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtistsLiteRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtistsLiteRequest.cs
new file mode 100644
index 00000000..3c4da161
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtistsLiteRequest.cs
@@ -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;
+
+///
+/// Represents a request to get the lightweight details of the artists of a media library.
+///
+/// The unique identifier of the media library whose artists are retrieved. Required.
+/// The page of results to retrieve. Optional.
+/// The maximum number of artists to retrieve per page. Optional.
+/// The search term used to filter the artists by name. Optional.
+///
+/// The alpha key used to filter the results by the first character of their name, for the alpha picker. Optional.
+/// Can be 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.
+///
+/// Whether the leading "The " prefix of a name is ignored when computing the alpha key, or not. Optional.
+/// The name of the field by which to sort the results. Optional.
+/// The direction in which to sort the results. Optional.
+[DebuggerDisplay("LibraryId: {LibraryId}")]
+public record GetMusicArtistsLiteRequest(
+ Guid LibraryId,
+ int? CurrentPage,
+ int? PerPage,
+ string? SearchTerm,
+ string? FilterAlphaKey,
+ bool ShouldIgnoreThePrefixForAlphaPicker,
+ string? SortBy,
+ SortOrder? SortOrder
+);
diff --git a/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtistsViewRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtistsViewRequest.cs
new file mode 100644
index 00000000..9a8efa54
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtistsViewRequest.cs
@@ -0,0 +1,15 @@
+#region ========================================================================= USING =====================================================================================
+using System;
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists;
+
+///
+/// Represents a request for displaying the music artists browsing view.
+///
+/// The unique identifier of the media library whose artists are browsed. Optional.
+[DebuggerDisplay("LibraryId: {LibraryId}")]
+public record GetMusicArtistsViewRequest(
+ Guid? LibraryId
+);
diff --git a/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/UpdateMusicArtistAlbumRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/UpdateMusicArtistAlbumRequest.cs
new file mode 100644
index 00000000..4dbaaeaa
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/UpdateMusicArtistAlbumRequest.cs
@@ -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;
+
+///
+/// Represents a request to update an album of an artist, together with the tracks of the album, within an artist update.
+///
+/// The Id of the album, when the album already exists. Optional.
+/// The album metadata of the album. Required.
+/// The physical or digital medium of the album. Optional.
+/// The outermost physical packaging of the album. Optional.
+/// The barcode of the album. Optional.
+/// The catalog numbers of the album. Optional.
+/// The name of the label that issued the album. Optional.
+/// The ASIN (Amazon Standard Identification Number) of the album. Optional.
+/// The MusicBrainz identifier of the release. Optional.
+/// The MusicBrainz identifier of the release group. Optional.
+/// The MusicBrainz identifier of the release artist. Optional.
+/// The list of media contributors that performed on the album. Required.
+/// The list of ratings for this album. Required.
+/// The list of tracks of the album, each with the Id of the track when the track already exists. Required.
+[DebuggerDisplay("Title: {Metadata?.Title}")]
+public record UpdateMusicArtistAlbumRequest(
+ Guid? AlbumId,
+ MusicAlbumMetadataDto? Metadata,
+ MusicMediaFormat? MediaFormat,
+ MusicReleasePackaging? Packaging,
+ string? Barcode,
+ List? CatalogNumbers,
+ string? Label,
+ string? ASIN,
+ Guid? MusicBrainzReleaseId,
+ Guid? MusicBrainzReleaseGroupId,
+ Guid? MusicBrainzReleaseArtistId,
+ List? Contributors,
+ List? Ratings,
+ List? Tracks
+);
diff --git a/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/UpdateMusicArtistRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/UpdateMusicArtistRequest.cs
new file mode 100644
index 00000000..6acce614
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/UpdateMusicArtistRequest.cs
@@ -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;
+
+///
+/// Represents a request to update a music artist, together with the albums of the artist and the tracks of those albums.
+///
+/// The metadata of the artist. Required.
+/// The website of the artist. Optional.
+/// The MusicBrainz identifier of the artist. Optional.
+/// The list of IPI (Interested Party Information) codes of the artist. Optional.
+/// The list of ISNI (International Standard Name Identifier) codes of the artist. Optional.
+/// The list of media contributors that make up the artist. Required.
+/// The list of ratings for the artist. Required.
+/// The list of albums of the artist, each with its own list of tracks. Required.
+[DebuggerDisplay("Name: {Metadata?.Name}")]
+public record UpdateMusicArtistRequest(
+ MusicArtistMetadataDto? Metadata,
+ string? Website,
+ Guid? MusicBrainzArtistId,
+ List? Ipis,
+ List? Isnis,
+ List? Contributors,
+ List? Ratings,
+ List? Albums
+);
diff --git a/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/UpdateMusicArtistTrackRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/UpdateMusicArtistTrackRequest.cs
new file mode 100644
index 00000000..b9e0c36f
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/UpdateMusicArtistTrackRequest.cs
@@ -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;
+
+///
+/// Represents a request to update a track of an album of an artist, within an artist update.
+///
+/// The Id of the track, when the track already exists. Optional.
+/// The file system path of the track. Required.
+/// The audio metadata of the track. Required.
+/// The number of the track on its disc. Required.
+/// The number of the disc the track belongs to. Optional.
+/// The script used by the language of the track. Optional.
+/// The musical key of the track. Optional.
+/// The tempo of the track in beats per minute. Optional.
+/// The work the track is a recording of. Optional.
+/// The MusicBrainz identifier of the recording. Optional.
+/// The MusicBrainz identifier of the track. Optional.
+/// The list of moods of the track. Optional.
+/// The list of ISRC (International Standard Recording Code) of the track. Optional.
+/// The list of media contributors that performed on the track. Required.
+/// The list of ratings for this track. Required.
+[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? Moods,
+ List? Isrcs,
+ List? Contributors,
+ List? Ratings
+);
diff --git a/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Tracks/GetAlbumTracksLiteRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Tracks/GetAlbumTracksLiteRequest.cs
new file mode 100644
index 00000000..dbcaaf42
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Tracks/GetAlbumTracksLiteRequest.cs
@@ -0,0 +1,23 @@
+#region ========================================================================= USING =====================================================================================
+using System;
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Tracks;
+
+///
+/// Represents a request to get the lightweight details of the tracks of an album.
+///
+/// The unique identifier of the artist the album belongs to, taken from the route. Required.
+/// The unique identifier of the album whose tracks are retrieved, taken from the route. Required.
+/// The unique identifier of the media library the album belongs to. Required.
+/// The page of results to retrieve. Optional.
+/// The maximum number of tracks to retrieve per page. Optional.
+[DebuggerDisplay("AlbumId: {AlbumId}")]
+public record GetAlbumTracksLiteRequest(
+ string ArtistId,
+ string AlbumId,
+ Guid LibraryId,
+ int? CurrentPage,
+ int? PerPage
+);
diff --git a/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Tracks/GetMusicTrackViewRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Tracks/GetMusicTrackViewRequest.cs
new file mode 100644
index 00000000..8dd2341f
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Tracks/GetMusicTrackViewRequest.cs
@@ -0,0 +1,21 @@
+#region ========================================================================= USING =====================================================================================
+using System;
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Tracks;
+
+///
+/// Represents a request for displaying the details of a track of an album of a music artist.
+///
+/// The unique identifier of the artist the album belongs to, taken from the route. Required.
+/// The unique identifier of the album the track belongs to, taken from the route. Required.
+/// The unique identifier of the track whose details are displayed, taken from the route. Required.
+/// The Id of the media library the track belongs to. Required.
+[DebuggerDisplay("TrackId: {TrackId}")]
+public record GetMusicTrackViewRequest(
+ string ArtistId,
+ string AlbumId,
+ string TrackId,
+ Guid LibraryId
+);
diff --git a/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Tracks/UpdateMusicTrackRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Tracks/UpdateMusicTrackRequest.cs
new file mode 100644
index 00000000..aa98dfed
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Tracks/UpdateMusicTrackRequest.cs
@@ -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;
+
+///
+/// Represents a request to update an existing track of an album of a music artist.
+///
+/// The file system path of the track. Required.
+/// The audio metadata of the track. Required.
+/// The number of the track on its disc. Required.
+/// The number of the disc the track belongs to. Optional.
+/// The script used by the language of the track. Optional.
+/// The musical key of the track. Optional.
+/// The tempo of the track in beats per minute. Optional.
+/// The work the track is a recording of. Optional.
+/// The MusicBrainz identifier of the recording. Optional.
+/// The MusicBrainz identifier of the track. Optional.
+/// The list of moods of the track. Optional.
+/// The list of ISRC (International Standard Recording Code) of the track. Optional.
+/// The list of media contributors that performed on the track. Required.
+/// The list of ratings for this track. Required.
+[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? Moods,
+ List? Isrcs,
+ List? Contributors,
+ List? Ratings
+);
diff --git a/src/Lumina.Presentation.Web/Common/Requests/Library/Management/EditLibraryRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Library/Management/EditLibraryRequest.cs
index 7c84ab5c..36d42d7c 100644
--- a/src/Lumina.Presentation.Web/Common/Requests/Library/Management/EditLibraryRequest.cs
+++ b/src/Lumina.Presentation.Web/Common/Requests/Library/Management/EditLibraryRequest.cs
@@ -6,7 +6,7 @@ using System.Diagnostics;
namespace Lumina.Presentation.Web.Common.Requests.Library.Management;
///
-/// Represents the request for displaying the media library editing view.
+/// Represents a request for displaying the media library editing view.
///
/// The unique identifier of the media library to edit. Required.
[DebuggerDisplay("Id: {Id}")]
diff --git a/src/Lumina.Presentation.Web/Common/Requests/Library/Management/GetArtworkProvidersRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Library/Management/GetArtworkProvidersRequest.cs
index e7dc201a..f88a44bb 100644
--- a/src/Lumina.Presentation.Web/Common/Requests/Library/Management/GetArtworkProvidersRequest.cs
+++ b/src/Lumina.Presentation.Web/Common/Requests/Library/Management/GetArtworkProvidersRequest.cs
@@ -6,7 +6,7 @@ using System.Diagnostics;
namespace Lumina.Presentation.Web.Common.Requests.Library.Management;
///
-/// Represents the request for retrieving the artwork providers of a media library.
+/// Represents a request for retrieving the artwork providers of a media library.
///
/// The unique identifier of the media library whose artwork providers are retrieved. Required.
[DebuggerDisplay("LibraryId: {LibraryId}")]
diff --git a/src/Lumina.Presentation.Web/Common/Requests/Library/Management/GetBookReadersRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Library/Management/GetBookReadersRequest.cs
index 047c2905..fbbc09c8 100644
--- a/src/Lumina.Presentation.Web/Common/Requests/Library/Management/GetBookReadersRequest.cs
+++ b/src/Lumina.Presentation.Web/Common/Requests/Library/Management/GetBookReadersRequest.cs
@@ -6,7 +6,7 @@ using System.Diagnostics;
namespace Lumina.Presentation.Web.Common.Requests.Library.Management;
///
-/// Represents the request for retrieving the book readers of a media library.
+/// Represents a request for retrieving the book readers of a media library.
///
/// The unique identifier of the media library whose book readers are retrieved. Required.
[DebuggerDisplay("LibraryId: {LibraryId}")]
diff --git a/src/Lumina.Presentation.Web/Common/Requests/Library/Management/GetLibraryPathTemplatePartsRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Library/Management/GetLibraryPathTemplatePartsRequest.cs
index 978d481a..0f517693 100644
--- a/src/Lumina.Presentation.Web/Common/Requests/Library/Management/GetLibraryPathTemplatePartsRequest.cs
+++ b/src/Lumina.Presentation.Web/Common/Requests/Library/Management/GetLibraryPathTemplatePartsRequest.cs
@@ -5,7 +5,7 @@ using System.Diagnostics;
namespace Lumina.Presentation.Web.Common.Requests.Library.Management;
///
-/// Represents the request for retrieving the path parts available for a media library type.
+/// Represents a request for retrieving the path parts available for a media library type.
///
/// The media library type whose available path parts are retrieved. Required.
[DebuggerDisplay("LibraryType: {LibraryType}")]
diff --git a/src/Lumina.Presentation.Web/Common/Requests/Library/Management/GetMetadataProvidersRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Library/Management/GetMetadataProvidersRequest.cs
index 9b206b59..b2326924 100644
--- a/src/Lumina.Presentation.Web/Common/Requests/Library/Management/GetMetadataProvidersRequest.cs
+++ b/src/Lumina.Presentation.Web/Common/Requests/Library/Management/GetMetadataProvidersRequest.cs
@@ -6,7 +6,7 @@ using System.Diagnostics;
namespace Lumina.Presentation.Web.Common.Requests.Library.Management;
///
-/// Represents the request for retrieving the metadata providers of a media library.
+/// Represents a request for retrieving the metadata providers of a media library.
///
/// The unique identifier of the media library whose metadata providers are retrieved. Required.
[DebuggerDisplay("LibraryId: {LibraryId}")]
diff --git a/src/Lumina.Presentation.Web/Common/Requests/Library/WrittenContentLibrary/BookLibrary/Books/GetBooksViewRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Library/WrittenContentLibrary/BookLibrary/Books/GetBooksViewRequest.cs
index fc704c99..800ee09c 100644
--- a/src/Lumina.Presentation.Web/Common/Requests/Library/WrittenContentLibrary/BookLibrary/Books/GetBooksViewRequest.cs
+++ b/src/Lumina.Presentation.Web/Common/Requests/Library/WrittenContentLibrary/BookLibrary/Books/GetBooksViewRequest.cs
@@ -6,7 +6,7 @@ using System.Diagnostics;
namespace Lumina.Presentation.Web.Common.Requests.Library.WrittenContentLibrary.BookLibrary.Books;
///
-/// Represents the request for displaying the books browsing view.
+/// Represents a request for displaying the books browsing view.
///
/// The unique identifier of the media library whose books are browsed. Optional.
[DebuggerDisplay("LibraryId: {LibraryId}")]
diff --git a/src/Lumina.Presentation.Web/Common/Requests/Library/WrittenContentLibrary/BookLibrary/Books/Reading/ReadBookViewRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Library/WrittenContentLibrary/BookLibrary/Books/Reading/ReadBookViewRequest.cs
index 0db696f3..d689f41d 100644
--- a/src/Lumina.Presentation.Web/Common/Requests/Library/WrittenContentLibrary/BookLibrary/Books/Reading/ReadBookViewRequest.cs
+++ b/src/Lumina.Presentation.Web/Common/Requests/Library/WrittenContentLibrary/BookLibrary/Books/Reading/ReadBookViewRequest.cs
@@ -6,7 +6,7 @@ using System.Diagnostics;
namespace Lumina.Presentation.Web.Common.Requests.Library.WrittenContentLibrary.BookLibrary.Books.Reading;
///
-/// Represents the request for displaying the reading view of a book.
+/// Represents a request for displaying the reading view of a book.
///
/// The unique identifier of the book to read. Required.
/// The Id of the media library the book belongs to. Required.
diff --git a/src/Lumina.Presentation.Web/Common/Requests/Library/WrittenContentLibrary/BookLibrary/Books/UpdateBookRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Library/WrittenContentLibrary/BookLibrary/Books/UpdateBookRequest.cs
index ca5fb674..a3f9cf2c 100644
--- a/src/Lumina.Presentation.Web/Common/Requests/Library/WrittenContentLibrary/BookLibrary/Books/UpdateBookRequest.cs
+++ b/src/Lumina.Presentation.Web/Common/Requests/Library/WrittenContentLibrary/BookLibrary/Books/UpdateBookRequest.cs
@@ -13,101 +13,44 @@ namespace Lumina.Presentation.Web.Common.Requests.Library.WrittenContentLibrary.
///
/// Represents a request to update an existing book.
///
+/// The Id of the book to update, taken from the route. Required.
+/// The Id of the media library the book belongs to. Required.
+/// The written content metadata of the book. Required.
+/// The format of the book (e.g., Hardcover, Paperback). Optional.
+/// The edition of the book. Optional.
+/// The volume or book number in the series. Optional.
+/// The series the book is part of. Optional.
+/// The ASIN (Amazon Standard Identification Number) of the book. Optional.
+/// The Goodreads Id of the book. Optional.
+/// The Library of Congress Control Number (LCCN) of the book. Optional.
+/// The OCLC Number (WorldCat identifier) of the book. Optional.
+/// The Open Library Id of the book. Optional.
+/// The LibraryThing Id of the book. Optional.
+/// The Google Books Id of the book. Optional.
+/// The Barnes & Noble Id of the book. Optional.
+/// The Apple Books Id of the book. Optional.
+/// The list of ISBN (International Standard Book Number) of the book. Required.
+/// The list of media contributors of the book. Required.
+/// The list of ratings of the book. Required.
[DebuggerDisplay("Title: {Metadata?.Title}")]
-public class UpdateBookRequest
-{
- ///
- /// Gets or sets the Id of the book to update, taken from the route.
- ///
- public string? BookId { get; set; }
-
- ///
- /// Gets or sets the Id of the media library the book belongs to.
- ///
- public Guid LibraryId { get; set; }
-
- ///
- /// Gets or sets the written content metadata of the book.
- ///
- public WrittenContentMetadataDto? Metadata { get; set; }
-
- ///
- /// Gets or sets the format of the book (e.g., Hardcover, Paperback), if applicable.
- ///
- public BookFormat? Format { get; set; }
-
- ///
- /// Gets or sets the edition of the book, if applicable.
- ///
- public string? Edition { get; set; }
-
- ///
- /// Gets or sets the volume or book number in the series, if applicable.
- ///
- public float? VolumeNumber { get; set; }
-
- ///
- /// Gets or sets the series name, if the book is part of a series.
- ///
- public BookSeriesDto? Series { get; set; }
-
- ///
- /// Gets or sets the ASIN (Amazon Standard Identification Number) of the book, if applicable.
- ///
- public string? ASIN { get; set; }
-
- ///
- /// Gets or sets the Goodreads Id of the book, if applicable.
- ///
- public string? GoodreadsId { get; set; }
-
- ///
- /// Gets or sets the Library of Congress Control Number (LCCN) of the book, if applicable.
- ///
- public string? LCCN { get; set; }
-
- ///
- /// Gets or sets the OCLC Number (WorldCat identifier) of the book, if applicable.
- ///
- public string? OCLCNumber { get; set; }
-
- ///
- /// Gets or sets the Open Library Id of the book, if applicable.
- ///
- public string? OpenLibraryId { get; set; }
-
- ///
- /// Gets or sets the LibraryThing Id of the book, if applicable.
- ///
- public string? LibraryThingId { get; set; }
-
- ///
- /// Gets or sets the Google Books Id of the book, if applicable.
- ///
- public string? GoogleBooksId { get; set; }
-
- ///
- /// Gets or sets the Barnes & Noble Id of the book, if applicable.
- ///
- public string? BarnesAndNobleId { get; set; }
-
- ///
- /// Gets or sets the Apple Books Id of the book, if applicable.
- ///
- public string? AppleBooksId { get; set; }
-
- ///
- /// Gets or sets the list of ISBN (International Standard Book Number) of the book.
- ///
- public List? ISBNs { get; set; }
-
- ///
- /// Gets or sets the list of media contributors of the book. Required.
- ///
- public List? Contributors { get; set; }
-
- ///
- /// Gets or sets the list of ratings of the book.
- ///
- public List? Ratings { get; set; }
-}
+public record UpdateBookRequest(
+ string? BookId,
+ Guid LibraryId,
+ WrittenContentMetadataDto? Metadata,
+ BookFormat? Format,
+ string? Edition,
+ float? VolumeNumber,
+ BookSeriesDto? Series,
+ string? ASIN,
+ string? GoodreadsId,
+ string? LCCN,
+ string? OCLCNumber,
+ string? OpenLibraryId,
+ string? LibraryThingId,
+ string? GoogleBooksId,
+ string? BarnesAndNobleId,
+ string? AppleBooksId,
+ List? ISBNs,
+ List? Contributors,
+ List? Ratings
+);
diff --git a/src/Lumina.Presentation.Web/Common/Requests/Plugins/ReorderLibraryArtworkProvidersRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Plugins/ReorderLibraryArtworkProvidersRequest.cs
index 173bb1e2..86d84308 100644
--- a/src/Lumina.Presentation.Web/Common/Requests/Plugins/ReorderLibraryArtworkProvidersRequest.cs
+++ b/src/Lumina.Presentation.Web/Common/Requests/Plugins/ReorderLibraryArtworkProvidersRequest.cs
@@ -9,16 +9,10 @@ namespace Lumina.Presentation.Web.Common.Requests.Plugins;
///
/// Represents a request to reorder the artwork providers of a media library.
///
+/// The Id of the media library whose artwork providers are reordered. Required.
+/// The plugin Ids in the new order, from highest to lowest rank. Required.
[DebuggerDisplay("LibraryId: {LibraryId}")]
-public class ReorderLibraryArtworkProvidersRequest
-{
- ///
- /// Gets or sets the Id of the media library whose artwork providers are reordered.
- ///
- public Guid LibraryId { get; set; }
-
- ///
- /// Gets or sets the plugin Ids in the new order, from highest to lowest rank.
- ///
- public List PluginIds { get; set; } = [];
-}
+public record ReorderLibraryArtworkProvidersRequest(
+ Guid LibraryId,
+ List PluginIds
+);
diff --git a/src/Lumina.Presentation.Web/Common/Requests/Plugins/ReorderLibraryMetadataProvidersRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Plugins/ReorderLibraryMetadataProvidersRequest.cs
index a88953b3..a4048843 100644
--- a/src/Lumina.Presentation.Web/Common/Requests/Plugins/ReorderLibraryMetadataProvidersRequest.cs
+++ b/src/Lumina.Presentation.Web/Common/Requests/Plugins/ReorderLibraryMetadataProvidersRequest.cs
@@ -9,16 +9,10 @@ namespace Lumina.Presentation.Web.Common.Requests.Plugins;
///
/// Represents a request to reorder the metadata providers of a media library.
///
+/// The Id of the media library whose metadata providers are reordered. Required.
+/// The plugin Ids in the new order, from highest to lowest rank. Required.
[DebuggerDisplay("LibraryId: {LibraryId}")]
-public class ReorderLibraryMetadataProvidersRequest
-{
- ///
- /// Gets or sets the Id of the media library whose metadata providers are reordered.
- ///
- public Guid LibraryId { get; set; }
-
- ///
- /// Gets or sets the plugin Ids in the new order, from highest to lowest rank.
- ///
- public List PluginIds { get; set; } = [];
-}
+public record ReorderLibraryMetadataProvidersRequest(
+ Guid LibraryId,
+ List PluginIds
+);
diff --git a/src/Lumina.Presentation.Web/Common/Requests/Plugins/SetBookReaderEnabledRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Plugins/SetBookReaderEnabledRequest.cs
index 4098cf1e..9c934831 100644
--- a/src/Lumina.Presentation.Web/Common/Requests/Plugins/SetBookReaderEnabledRequest.cs
+++ b/src/Lumina.Presentation.Web/Common/Requests/Plugins/SetBookReaderEnabledRequest.cs
@@ -8,21 +8,12 @@ namespace Lumina.Presentation.Web.Common.Requests.Plugins;
///
/// Represents a request to enable or disable a book reader for a media library.
///
+/// The Id of the media library whose book reader is enabled or disabled. Required.
+/// The unique identifier of the plugin providing the book reader. Required.
+/// Whether the book reader should be enabled for the media library. Required.
[DebuggerDisplay("LibraryId: {LibraryId}, PluginId: {PluginId}")]
-public class SetBookReaderEnabledRequest
-{
- ///
- /// Gets or sets the Id of the media library whose book reader is enabled or disabled. Required.
- ///
- public Guid LibraryId { get; set; }
-
- ///
- /// Gets or sets the unique identifier of the plugin providing the book reader. Required.
- ///
- public Guid PluginId { get; set; }
-
- ///
- /// Gets or sets whether the book reader should be enabled for the media library. Required.
- ///
- public bool IsEnabled { get; set; }
-}
+public record SetBookReaderEnabledRequest(
+ Guid LibraryId,
+ Guid PluginId,
+ bool IsEnabled
+);
diff --git a/src/Lumina.Presentation.Web/Common/Requests/Plugins/SetLibraryArtworkProviderEnabledRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Plugins/SetLibraryArtworkProviderEnabledRequest.cs
index e5178468..aa55773d 100644
--- a/src/Lumina.Presentation.Web/Common/Requests/Plugins/SetLibraryArtworkProviderEnabledRequest.cs
+++ b/src/Lumina.Presentation.Web/Common/Requests/Plugins/SetLibraryArtworkProviderEnabledRequest.cs
@@ -8,21 +8,12 @@ namespace Lumina.Presentation.Web.Common.Requests.Plugins;
///
/// Represents a request to enable or disable an artwork provider for a media library.
///
+/// The Id of the media library whose artwork provider is enabled or disabled. Required.
+/// The unique identifier of the plugin providing the artwork. Required.
+/// Whether the artwork provider should be enabled for the media library. Required.
[DebuggerDisplay("LibraryId: {LibraryId}, PluginId: {PluginId}")]
-public class SetLibraryArtworkProviderEnabledRequest
-{
- ///
- /// Gets or sets the Id of the media library whose artwork provider is enabled or disabled.
- ///
- public Guid LibraryId { get; set; }
-
- ///
- /// Gets or sets the unique identifier of the plugin providing the artwork.
- ///
- public Guid PluginId { get; set; }
-
- ///
- /// Gets or sets whether the artwork provider should be enabled for the media library.
- ///
- public bool IsEnabled { get; set; }
-}
+public record SetLibraryArtworkProviderEnabledRequest(
+ Guid LibraryId,
+ Guid PluginId,
+ bool IsEnabled
+);
diff --git a/src/Lumina.Presentation.Web/Common/Requests/Plugins/SetLibraryMetadataProviderEnabledRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Plugins/SetLibraryMetadataProviderEnabledRequest.cs
index 38046da0..bf442946 100644
--- a/src/Lumina.Presentation.Web/Common/Requests/Plugins/SetLibraryMetadataProviderEnabledRequest.cs
+++ b/src/Lumina.Presentation.Web/Common/Requests/Plugins/SetLibraryMetadataProviderEnabledRequest.cs
@@ -1,6 +1,5 @@
#region ========================================================================= USING =====================================================================================
using System;
-using System.Collections.Generic;
using System.Diagnostics;
#endregion
@@ -9,21 +8,12 @@ namespace Lumina.Presentation.Web.Common.Requests.Plugins;
///
/// Represents a request to enable or disable a metadata provider for a media library.
///
+/// The Id of the media library whose metadata provider is enabled or disabled. Required.
+/// The unique identifier of the plugin providing the metadata. Required.
+/// Whether the metadata provider should be enabled for the media library. Required.
[DebuggerDisplay("LibraryId: {LibraryId}, PluginId: {PluginId}")]
-public class SetLibraryMetadataProviderEnabledRequest
-{
- ///
- /// Gets or sets the Id of the media library whose metadata provider is enabled or disabled.
- ///
- public Guid LibraryId { get; set; }
-
- ///
- /// Gets or sets the unique identifier of the plugin providing the metadata.
- ///
- public Guid PluginId { get; set; }
-
- ///
- /// Gets or sets whether the metadata provider should be enabled for the media library.
- ///
- public bool IsEnabled { get; set; }
-}
+public record SetLibraryMetadataProviderEnabledRequest(
+ Guid LibraryId,
+ Guid PluginId,
+ bool IsEnabled
+);
diff --git a/src/Lumina.Presentation.Web/Common/Requests/Plugins/UpdatePluginSettingsRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Plugins/UpdatePluginSettingsRequest.cs
index c48bac46..7a03da51 100644
--- a/src/Lumina.Presentation.Web/Common/Requests/Plugins/UpdatePluginSettingsRequest.cs
+++ b/src/Lumina.Presentation.Web/Common/Requests/Plugins/UpdatePluginSettingsRequest.cs
@@ -9,16 +9,10 @@ namespace Lumina.Presentation.Web.Common.Requests.Plugins;
///
/// Represents a request to update the settings of a plugin.
///
+/// The unique identifier of the plugin. Required.
+/// The settings of the plugin. Optional.
[DebuggerDisplay("PluginId: {PluginId}")]
-public class UpdatePluginSettingsRequest
-{
- ///
- /// Gets or sets the unique identifier of the plugin.
- ///
- public Guid PluginId { get; set; }
-
- ///
- /// Gets or sets the settings of the plugin.
- ///
- public Dictionary? Settings { get; set; }
-}
+public record UpdatePluginSettingsRequest(
+ Guid PluginId,
+ Dictionary? Settings
+);
diff --git a/src/Lumina.Presentation.Web/Common/Requests/Tools/SetLanguageRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Tools/SetLanguageRequest.cs
index fd8201aa..53135961 100644
--- a/src/Lumina.Presentation.Web/Common/Requests/Tools/SetLanguageRequest.cs
+++ b/src/Lumina.Presentation.Web/Common/Requests/Tools/SetLanguageRequest.cs
@@ -5,7 +5,7 @@ using System.Diagnostics;
namespace Lumina.Presentation.Web.Common.Requests.Tools;
///
-/// Represents the request for setting the culture used by the application.
+/// Represents a request for setting the culture used by the application.
///
/// The new culture to set. Required.
/// The URL to return to, after setting the new culture. Optional.
diff --git a/src/Lumina.Presentation.Web/Common/Requests/UsersManagement/Authentication/LoginViewRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/UsersManagement/Authentication/LoginViewRequest.cs
index 6fa27d41..68cdbda0 100644
--- a/src/Lumina.Presentation.Web/Common/Requests/UsersManagement/Authentication/LoginViewRequest.cs
+++ b/src/Lumina.Presentation.Web/Common/Requests/UsersManagement/Authentication/LoginViewRequest.cs
@@ -5,7 +5,7 @@ using System.Diagnostics;
namespace Lumina.Presentation.Web.Common.Requests.UsersManagement.Authentication;
///
-/// Represents the request for displaying the account login view.
+/// Represents a request for displaying the account login view.
///
/// The URL to return to, after login. Optional.
[DebuggerDisplay("ReturnUrl: {ReturnUrl}")]
diff --git a/src/Lumina.Presentation.Web/Common/Requests/UsersManagement/ChangePasswordRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/UsersManagement/ChangePasswordRequest.cs
index b899d829..48b36334 100644
--- a/src/Lumina.Presentation.Web/Common/Requests/UsersManagement/ChangePasswordRequest.cs
+++ b/src/Lumina.Presentation.Web/Common/Requests/UsersManagement/ChangePasswordRequest.cs
@@ -5,7 +5,7 @@ using System.Diagnostics;
namespace Lumina.Presentation.Web.Common.Requests.UsersManagement;
///
-/// Represents the request model for account password change.
+/// Represents a request for account password change.
///
/// The username of the account. Required.
/// The current password of the account. Required.
diff --git a/src/Lumina.Presentation.Web/Common/Requests/UsersManagement/LoginRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/UsersManagement/LoginRequest.cs
index de0d572e..74743f7e 100644
--- a/src/Lumina.Presentation.Web/Common/Requests/UsersManagement/LoginRequest.cs
+++ b/src/Lumina.Presentation.Web/Common/Requests/UsersManagement/LoginRequest.cs
@@ -5,7 +5,7 @@ using System.Diagnostics;
namespace Lumina.Presentation.Web.Common.Requests.UsersManagement;
///
-/// Represents the request model for user authentication.
+/// Represents a request for user authentication.
///
/// The username of the account to authenticate. Required.
/// The password of the account to authenticate. Required.
diff --git a/src/Lumina.Presentation.Web/Common/Requests/UsersManagement/RecoverPasswordRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/UsersManagement/RecoverPasswordRequest.cs
index e41f7e8a..72e570af 100644
--- a/src/Lumina.Presentation.Web/Common/Requests/UsersManagement/RecoverPasswordRequest.cs
+++ b/src/Lumina.Presentation.Web/Common/Requests/UsersManagement/RecoverPasswordRequest.cs
@@ -5,7 +5,7 @@ using System.Diagnostics;
namespace Lumina.Presentation.Web.Common.Requests.UsersManagement;
///
-/// Represents the request model for account password recovery.
+/// Represents a request for account password recovery.
///
/// The username of the account for which to recover the password. Required.
/// The TOTP (Time-Based One-Time Password) of the account for which to recover the password. Required.
diff --git a/src/Lumina.Presentation.Web/Common/Requests/UsersManagement/RegisterRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/UsersManagement/RegisterRequest.cs
index 9aa1c105..e39ba6cf 100644
--- a/src/Lumina.Presentation.Web/Common/Requests/UsersManagement/RegisterRequest.cs
+++ b/src/Lumina.Presentation.Web/Common/Requests/UsersManagement/RegisterRequest.cs
@@ -5,7 +5,7 @@ using System.Diagnostics;
namespace Lumina.Presentation.Web.Common.Requests.UsersManagement;
///
-/// Represents the request model for user registration.
+/// Represents a request for user registration.
///
/// The desired username for the new account. Required.
/// The password for the new account. Required.
diff --git a/src/Lumina.Presentation.Web/Common/Routes/ApiRoutes.Music.cs b/src/Lumina.Presentation.Web/Common/Routes/ApiRoutes.Music.cs
new file mode 100644
index 00000000..e1778db2
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Routes/ApiRoutes.Music.cs
@@ -0,0 +1,28 @@
+namespace Lumina.Presentation.Web.Common.Routes;
+
+///
+/// Class for the collection of remote API routes called by this Web application.
+///
+public static partial class ApiRoutes
+{
+ ///
+ /// Routes for the music library endpoints of the remote API.
+ ///
+ 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}";
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Common/Routes/WebRoutes.Music.cs b/src/Lumina.Presentation.Web/Common/Routes/WebRoutes.Music.cs
new file mode 100644
index 00000000..dd707299
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Routes/WebRoutes.Music.cs
@@ -0,0 +1,32 @@
+namespace Lumina.Presentation.Web.Common.Routes;
+
+///
+/// Class for the collection of routes defined in the Web application.
+///
+public static partial class WebRoutes
+{
+ ///
+ /// Routes for the music library pages.
+ ///
+ 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";
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Admin/Scheduler/SchedulerIndexViewEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Admin/Scheduler/SchedulerIndexViewEndpoint.cs
index cf09450c..22be1b44 100644
--- a/src/Lumina.Presentation.Web/Core/Endpoints/Admin/Scheduler/SchedulerIndexViewEndpoint.cs
+++ b/src/Lumina.Presentation.Web/Core/Endpoints/Admin/Scheduler/SchedulerIndexViewEndpoint.cs
@@ -26,10 +26,10 @@ namespace Lumina.Presentation.Web.Core.Endpoints.Admin.Scheduler;
///
public class SchedulerIndexViewEndpoint : BaseEndpoint
{
- // the resource base name deliberately excludes the "Core.Resources" segment: the localization factory re-roots it with the configured ResourcesPath
+ // 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.Admin.Scheduler";
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
+ // 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 = "admin/scheduler";
private readonly IAntiforgery _antiforgery;
diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Common/BaseEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Common/BaseEndpoint.cs
index 62ca2828..f00b760c 100644
--- a/src/Lumina.Presentation.Web/Core/Endpoints/Common/BaseEndpoint.cs
+++ b/src/Lumina.Presentation.Web/Core/Endpoints/Common/BaseEndpoint.cs
@@ -40,8 +40,8 @@ public abstract class BaseEndpoint : EndpointAn that renders the view.
protected IResult View(string viewName, object? model = null, IReadOnlyDictionary? viewData = null)
{
- // store the path of the displayed view in the session, so that the login redirect after the JWT token expires points to it; ignore the login endpoint,
- // because it is incorrect to be redirected to the login URL, with the login URL as the return URL
+ // Store the path of the displayed view in the session, so that the login redirect after the JWT token expires points to it; ignore the login endpoint,
+ // because it is incorrect to be redirected to the login URL, with the login URL as the return URL.
if (HttpContext.Request.Path != "/en-us/auth/login")
HttpContext.Session.SetString(HttpContextItemKeys.LAST_DISPLAYED_VIEW, $"{HttpContext.Request.PathBase}{HttpContext.Request.Path}{HttpContext.Request.QueryString}");
return new RazorViewResult(viewName, model, viewData);
diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/FileSystemManagement/Thumbnails/GetThumbnail/GetThumbnailEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/FileSystemManagement/Thumbnails/GetThumbnail/GetThumbnailEndpoint.cs
index d0230562..88e0fb5e 100644
--- a/src/Lumina.Presentation.Web/Core/Endpoints/FileSystemManagement/Thumbnails/GetThumbnail/GetThumbnailEndpoint.cs
+++ b/src/Lumina.Presentation.Web/Core/Endpoints/FileSystemManagement/Thumbnails/GetThumbnail/GetThumbnailEndpoint.cs
@@ -49,7 +49,7 @@ public class GetThumbnailEndpoint : BaseEndpoint
/// Cancellation token that can be used to stop the execution.
public override async Task ExecuteAsync(GetThumbnailRequest request, CancellationToken cancellationToken)
{
- // the thumbnail is proxied through the Web application, so that the request carries the authentication of the current user
+ // The thumbnail is proxied through the Web application, so that the request carries the authentication of the current user.
BlobDataDto blob = await _apiHttpClient.GetBlobAsync($"{ApiRoutes.Thumbnails.GET_THUMBNAIL}?path={Uri.EscapeDataString(request.Path!)}&quality={request.Quality}", cancellationToken).ConfigureAwait(false);
return Results.File(blob.Data, blob.ContentType);
}
diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Home/HomeNotFoundViewEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Home/HomeNotFoundViewEndpoint.cs
index 6e5c239e..155f4922 100644
--- a/src/Lumina.Presentation.Web/Core/Endpoints/Home/HomeNotFoundViewEndpoint.cs
+++ b/src/Lumina.Presentation.Web/Core/Endpoints/Home/HomeNotFoundViewEndpoint.cs
@@ -20,10 +20,10 @@ namespace Lumina.Presentation.Web.Core.Endpoints.Home;
///
public class HomeNotFoundViewEndpoint : BaseEndpoint
{
- // the resource base name deliberately excludes the "Core.Resources" segment: the localization factory re-roots it with the configured ResourcesPath
+ // 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.Shared.NotFound";
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
+ // 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 = "shared/not-found";
private readonly ThemePageRenderer _themePageRenderer;
diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/DeleteMusicAlbum/DeleteMusicAlbumEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/DeleteMusicAlbum/DeleteMusicAlbumEndpoint.cs
new file mode 100644
index 00000000..819810d7
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/DeleteMusicAlbum/DeleteMusicAlbumEndpoint.cs
@@ -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;
+
+///
+/// API endpoint for the /{culture}/library/audio-library/music-library/artists/{artistId}/albums/{albumId}/api-delete-album route.
+///
+public class DeleteMusicAlbumEndpoint : BaseEndpoint
+{
+ private readonly IApiHttpClient _apiHttpClient;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Injected service for interactions with the API.
+ public DeleteMusicAlbumEndpoint(IApiHttpClient apiHttpClient)
+ {
+ _apiHttpClient = apiHttpClient;
+ }
+
+ ///
+ /// Configures the endpoint.
+ ///
+ public override void Configure()
+ {
+ base.Configure();
+ Verbs(Http.DELETE);
+ Routes(WebRoutes.Music.DELETE_ALBUM);
+ DontAutoTag();
+ Options(options => options.WithTags("Music"));
+ EnableAntiforgery();
+ }
+
+ ///
+ /// Deletes the music album identified by the route.
+ ///
+ /// The request object.
+ /// Cancellation token that can be used to stop the execution.
+ public override async Task 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();
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/DeleteMusicAlbum/DeleteMusicAlbumEndpointSummary.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/DeleteMusicAlbum/DeleteMusicAlbumEndpointSummary.cs
new file mode 100644
index 00000000..3386ca71
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/DeleteMusicAlbum/DeleteMusicAlbumEndpointSummary.cs
@@ -0,0 +1,24 @@
+#region ========================================================================= USING =====================================================================================
+using FastEndpoints;
+using System.Diagnostics.CodeAnalysis;
+#endregion
+
+namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.DeleteMusicAlbum;
+
+///
+/// Class used for providing a textual description for the endpoint, for OpenAPI.
+///
+[ExcludeFromCodeCoverage]
+public class DeleteMusicAlbumEndpointSummary : Summary
+{
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ 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.");
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/EditMusicAlbum/EditMusicAlbumViewEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/EditMusicAlbum/EditMusicAlbumViewEndpoint.cs
new file mode 100644
index 00000000..0a491be2
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/EditMusicAlbum/EditMusicAlbumViewEndpoint.cs
@@ -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;
+
+///
+/// API endpoint for the /{culture}/library/audio-library/music-library/artists/{artistId}/albums/{albumId} route.
+///
+public class EditMusicAlbumViewEndpoint : BaseEndpoint
+{
+ // 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;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Injected service for interactions with the API.
+ /// Injected service for generating URLs from action and controller names, with localization.
+ /// Injected service for rendering themed pages.
+ /// Injected service for anti-forgery token handling.
+ /// Injected factory used to create the localizer of the view resources.
+ 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);
+ }
+
+ ///
+ /// Configures the endpoint.
+ ///
+ public override void Configure()
+ {
+ base.Configure();
+ Verbs(Http.GET);
+ Routes(WebRoutes.Music.ALBUM);
+ DontAutoTag();
+ Options(options => options.WithTags("Music"));
+ }
+
+ ///
+ /// Displays the music album details and editing view, rendered by the active theme with a fallback to the Razor view.
+ ///
+ /// The request containing the Id of the album to view.
+ /// Cancellation token that can be used to stop the execution.
+ public override async Task 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(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
+ {
+ ["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 sectionResult = await _themePageRenderer.RenderAsync(pageModel, requestedThemeId: null, cancellationToken).ConfigureAwait(false);
+ if (sectionResult.IsFailure)
+ {
+ Dictionary 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 { ["Title"] = title });
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/EditMusicAlbum/EditMusicAlbumViewEndpointSummary.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/EditMusicAlbum/EditMusicAlbumViewEndpointSummary.cs
new file mode 100644
index 00000000..ab2881d2
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/EditMusicAlbum/EditMusicAlbumViewEndpointSummary.cs
@@ -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;
+
+///
+/// Class used for providing a textual description for the endpoint, for OpenAPI.
+///
+[ExcludeFromCodeCoverage]
+public class EditMusicAlbumViewEndpointSummary : Summary
+{
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ 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.");
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetArtistAlbums/GetArtistAlbumsEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetArtistAlbums/GetArtistAlbumsEndpoint.cs
new file mode 100644
index 00000000..11ddeb00
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetArtistAlbums/GetArtistAlbumsEndpoint.cs
@@ -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;
+
+///
+/// API endpoint for the /{culture}/library/audio-library/music-library/artists/{artistId}/albums/api-get-albums route.
+///
+public class GetArtistAlbumsEndpoint : BaseEndpoint
+{
+ private readonly IApiHttpClient _apiHttpClient;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Injected service for interactions with the API.
+ public GetArtistAlbumsEndpoint(IApiHttpClient apiHttpClient)
+ {
+ _apiHttpClient = apiHttpClient;
+ }
+
+ ///
+ /// Configures the endpoint.
+ ///
+ public override void Configure()
+ {
+ base.Configure();
+ Verbs(Http.GET);
+ Routes(WebRoutes.Music.GET_ARTIST_ALBUMS);
+ DontAutoTag();
+ Options(options => options.WithTags("Music"));
+ }
+
+ ///
+ /// Retrieves the lightweight details of the albums of a music artist.
+ ///
+ /// The request containing the parameters used to retrieve the albums.
+ /// Cancellation token that can be used to stop the execution.
+ public override async Task ExecuteAsync(GetArtistAlbumsLiteRequest request, CancellationToken cancellationToken)
+ {
+ PaginatedMusicAlbumLiteDto response = await _apiHttpClient.GetAsync(BuildItemsEndpoint(request), cancellationToken).ConfigureAwait(false);
+ return JsonSuccess(response);
+ }
+
+ ///
+ /// Builds the API endpoint used to retrieve the lightweight details of the albums of a music artist.
+ ///
+ /// The request containing the parameters used to retrieve the albums.
+ /// The API endpoint to which the retrieval request is sent.
+ 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 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();
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetArtistAlbums/GetArtistAlbumsEndpointSummary.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetArtistAlbums/GetArtistAlbumsEndpointSummary.cs
new file mode 100644
index 00000000..19597ae8
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetArtistAlbums/GetArtistAlbumsEndpointSummary.cs
@@ -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;
+
+///
+/// Class used for providing a textual description for the endpoint, for OpenAPI.
+///
+[ExcludeFromCodeCoverage]
+public class GetArtistAlbumsEndpointSummary : Summary
+{
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ 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.");
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetMusicAlbum/GetMusicAlbumEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetMusicAlbum/GetMusicAlbumEndpoint.cs
new file mode 100644
index 00000000..34ab493f
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetMusicAlbum/GetMusicAlbumEndpoint.cs
@@ -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;
+
+///
+/// API endpoint for the /{culture}/library/audio-library/music-library/artists/{artistId}/albums/{albumId}/api-get-album route.
+///
+public class GetMusicAlbumEndpoint : BaseEndpoint
+{
+ private readonly IApiHttpClient _apiHttpClient;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Injected service for interactions with the API.
+ public GetMusicAlbumEndpoint(IApiHttpClient apiHttpClient)
+ {
+ _apiHttpClient = apiHttpClient;
+ }
+
+ ///
+ /// Configures the endpoint.
+ ///
+ public override void Configure()
+ {
+ base.Configure();
+ Verbs(Http.GET);
+ Routes(WebRoutes.Music.GET_ALBUM);
+ DontAutoTag();
+ Options(options => options.WithTags("Music"));
+ }
+
+ ///
+ /// Retrieves the full details of the music album identified by .
+ ///
+ /// The request containing the Id of the album to retrieve.
+ /// Cancellation token that can be used to stop the execution.
+ public override async Task 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(ApiRoutes.Music.GET_ALBUM.Replace("{libraryId}", request.LibraryId.ToString()).Replace("{artistId}", request.ArtistId).Replace("{albumId}", request.AlbumId), cancellationToken).ConfigureAwait(false);
+ return JsonSuccess(album);
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetMusicAlbum/GetMusicAlbumEndpointSummary.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetMusicAlbum/GetMusicAlbumEndpointSummary.cs
new file mode 100644
index 00000000..015782f5
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetMusicAlbum/GetMusicAlbumEndpointSummary.cs
@@ -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;
+
+///
+/// Class used for providing a textual description for the endpoint, for OpenAPI.
+///
+[ExcludeFromCodeCoverage]
+public class GetMusicAlbumEndpointSummary : Summary
+{
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ 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.");
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/SaveMusicAlbum/SaveMusicAlbumEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/SaveMusicAlbum/SaveMusicAlbumEndpoint.cs
new file mode 100644
index 00000000..714c1330
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/SaveMusicAlbum/SaveMusicAlbumEndpoint.cs
@@ -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;
+
+///
+/// API endpoint for the /{culture}/library/audio-library/music-library/artists/{artistId}/albums/{albumId}/api-save-album route.
+///
+public class SaveMusicAlbumEndpoint : BaseEndpoint
+{
+ private readonly IApiHttpClient _apiHttpClient;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Injected service for interactions with the API.
+ public SaveMusicAlbumEndpoint(IApiHttpClient apiHttpClient)
+ {
+ _apiHttpClient = apiHttpClient;
+ }
+
+ ///
+ /// Configures the endpoint.
+ ///
+ public override void Configure()
+ {
+ base.Configure();
+ Verbs(Http.PUT);
+ Routes(WebRoutes.Music.SAVE_ALBUM);
+ DontAutoTag();
+ Options(options => options.WithTags("Music"));
+ EnableAntiforgery();
+ }
+
+ ///
+ /// Updates the music album described by .
+ ///
+ /// The request containing the edited details of the album.
+ /// Cancellation token that can be used to stop the execution.
+ public override async Task 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(
+ ApiRoutes.Music.UPDATE_ALBUM.Replace("{libraryId}", libraryId).Replace("{artistId}", artistId).Replace("{albumId}", albumId), request, cancellationToken).ConfigureAwait(false);
+ return JsonSuccess(album);
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/SaveMusicAlbum/SaveMusicAlbumEndpointSummary.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/SaveMusicAlbum/SaveMusicAlbumEndpointSummary.cs
new file mode 100644
index 00000000..30deab2e
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/SaveMusicAlbum/SaveMusicAlbumEndpointSummary.cs
@@ -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;
+
+///
+/// Class used for providing a textual description for the endpoint, for OpenAPI.
+///
+[ExcludeFromCodeCoverage]
+public class SaveMusicAlbumEndpointSummary : Summary
+{
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ 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.");
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCover/UpdateAlbumCoverEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCover/UpdateAlbumCoverEndpoint.cs
new file mode 100644
index 00000000..39127f14
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCover/UpdateAlbumCoverEndpoint.cs
@@ -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;
+
+///
+/// API endpoint for the /{culture}/library/audio-library/music-library/artists/{artistId}/albums/{albumId}/api-update-cover route.
+///
+public class UpdateAlbumCoverEndpoint : BaseEndpoint
+{
+ private readonly IApiHttpClient _apiHttpClient;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Injected service for interactions with the API.
+ public UpdateAlbumCoverEndpoint(IApiHttpClient apiHttpClient)
+ {
+ _apiHttpClient = apiHttpClient;
+ }
+
+ ///
+ /// Configures the endpoint.
+ ///
+ public override void Configure()
+ {
+ base.Configure();
+ Verbs(Http.PUT);
+ Routes(WebRoutes.Music.UPDATE_ALBUM_COVER);
+ DontAutoTag();
+ Options(options => options.WithTags("Music"));
+ EnableAntiforgery();
+ }
+
+ ///
+ /// Updates the cover image of the album with the image uploaded in the multipart form of the request.
+ ///
+ /// The request object.
+ /// Cancellation token that can be used to stop the execution.
+ public override async Task 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(
+ 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();
+ }
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCover/UpdateAlbumCoverEndpointSummary.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCover/UpdateAlbumCoverEndpointSummary.cs
new file mode 100644
index 00000000..0a75f9e9
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCover/UpdateAlbumCoverEndpointSummary.cs
@@ -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;
+
+///
+/// Class used for providing a textual description for the endpoint, for OpenAPI.
+///
+[ExcludeFromCodeCoverage]
+public class UpdateAlbumCoverEndpointSummary : Summary
+{
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ 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(true, default));
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/DeleteMusicArtist/DeleteMusicArtistEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/DeleteMusicArtist/DeleteMusicArtistEndpoint.cs
new file mode 100644
index 00000000..4d1730fb
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/DeleteMusicArtist/DeleteMusicArtistEndpoint.cs
@@ -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;
+
+///
+/// API endpoint for the /{culture}/library/audio-library/music-library/artists/{artistId}/api-delete-artist route.
+///
+public class DeleteMusicArtistEndpoint : BaseEndpoint
+{
+ private readonly IApiHttpClient _apiHttpClient;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Injected service for interactions with the API.
+ public DeleteMusicArtistEndpoint(IApiHttpClient apiHttpClient)
+ {
+ _apiHttpClient = apiHttpClient;
+ }
+
+ ///
+ /// Configures the endpoint.
+ ///
+ public override void Configure()
+ {
+ base.Configure();
+ Verbs(Http.DELETE);
+ Routes(WebRoutes.Music.DELETE_ARTIST);
+ DontAutoTag();
+ Options(options => options.WithTags("Music"));
+ EnableAntiforgery();
+ }
+
+ ///
+ /// Deletes the music artist identified by the route.
+ ///
+ /// The request object.
+ /// Cancellation token that can be used to stop the execution.
+ public override async Task 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();
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/DeleteMusicArtist/DeleteMusicArtistEndpointSummary.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/DeleteMusicArtist/DeleteMusicArtistEndpointSummary.cs
new file mode 100644
index 00000000..9a1db23b
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/DeleteMusicArtist/DeleteMusicArtistEndpointSummary.cs
@@ -0,0 +1,24 @@
+#region ========================================================================= USING =====================================================================================
+using FastEndpoints;
+using System.Diagnostics.CodeAnalysis;
+#endregion
+
+namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.DeleteMusicArtist;
+
+///
+/// Class used for providing a textual description for the endpoint, for OpenAPI.
+///
+[ExcludeFromCodeCoverage]
+public class DeleteMusicArtistEndpointSummary : Summary
+{
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ 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.");
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/EditMusicArtist/EditMusicArtistViewEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/EditMusicArtist/EditMusicArtistViewEndpoint.cs
new file mode 100644
index 00000000..c025b99d
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/EditMusicArtist/EditMusicArtistViewEndpoint.cs
@@ -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;
+
+///
+/// API endpoint for the /{culture}/library/audio-library/music-library/artists/{artistId} route.
+///
+public class EditMusicArtistViewEndpoint : BaseEndpoint
+{
+ // 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;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Injected service for interactions with the API.
+ /// Injected service for generating URLs from action and controller names, with localization.
+ /// Injected service for rendering themed pages.
+ /// Injected service for anti-forgery token handling.
+ /// Injected factory used to create the localizer of the view resources.
+ 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);
+ }
+
+ ///
+ /// Configures the endpoint.
+ ///
+ public override void Configure()
+ {
+ base.Configure();
+ Verbs(Http.GET);
+ Routes(WebRoutes.Music.ARTIST);
+ DontAutoTag();
+ Options(options => options.WithTags("Music"));
+ }
+
+ ///
+ /// Displays the music artist details and editing view, rendered by the active theme with a fallback to the Razor view.
+ ///
+ /// The request containing the Id of the artist to view.
+ /// Cancellation token that can be used to stop the execution.
+ public override async Task 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(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
+ {
+ ["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 sectionResult = await _themePageRenderer.RenderAsync(pageModel, requestedThemeId: null, cancellationToken).ConfigureAwait(false);
+ if (sectionResult.IsFailure)
+ {
+ Dictionary 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 { ["Title"] = title });
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/EditMusicArtist/EditMusicArtistViewEndpointSummary.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/EditMusicArtist/EditMusicArtistViewEndpointSummary.cs
new file mode 100644
index 00000000..8d037c1b
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/EditMusicArtist/EditMusicArtistViewEndpointSummary.cs
@@ -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;
+
+///
+/// Class used for providing a textual description for the endpoint, for OpenAPI.
+///
+[ExcludeFromCodeCoverage]
+public class EditMusicArtistViewEndpointSummary : Summary
+{
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ 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.");
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtist/GetMusicArtistEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtist/GetMusicArtistEndpoint.cs
new file mode 100644
index 00000000..55ffee9d
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtist/GetMusicArtistEndpoint.cs
@@ -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;
+
+///
+/// API endpoint for the /{culture}/library/audio-library/music-library/artists/{artistId}/api-get-artist route.
+///
+public class GetMusicArtistEndpoint : BaseEndpoint
+{
+ private readonly IApiHttpClient _apiHttpClient;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Injected service for interactions with the API.
+ public GetMusicArtistEndpoint(IApiHttpClient apiHttpClient)
+ {
+ _apiHttpClient = apiHttpClient;
+ }
+
+ ///
+ /// Configures the endpoint.
+ ///
+ public override void Configure()
+ {
+ base.Configure();
+ Verbs(Http.GET);
+ Routes(WebRoutes.Music.GET_ARTIST);
+ DontAutoTag();
+ Options(options => options.WithTags("Music"));
+ }
+
+ ///
+ /// Retrieves the full details of the music artist identified by .
+ ///
+ /// The request containing the Id of the artist to retrieve.
+ /// Cancellation token that can be used to stop the execution.
+ public override async Task 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(ApiRoutes.Music.GET_ARTIST.Replace("{libraryId}", request.LibraryId.ToString()).Replace("{artistId}", request.ArtistId), cancellationToken).ConfigureAwait(false);
+ return JsonSuccess(artist);
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtist/GetMusicArtistEndpointSummary.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtist/GetMusicArtistEndpointSummary.cs
new file mode 100644
index 00000000..e293c4ed
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtist/GetMusicArtistEndpointSummary.cs
@@ -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;
+
+///
+/// Class used for providing a textual description for the endpoint, for OpenAPI.
+///
+[ExcludeFromCodeCoverage]
+public class GetMusicArtistEndpointSummary : Summary
+{
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ 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.");
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtists/GetMusicArtistsEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtists/GetMusicArtistsEndpoint.cs
new file mode 100644
index 00000000..843fae20
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtists/GetMusicArtistsEndpoint.cs
@@ -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;
+
+///
+/// API endpoint for the /{culture}/library/audio-library/music-library/artists/api-get-artists route.
+///
+public class GetMusicArtistsEndpoint : BaseEndpoint
+{
+ private readonly IApiHttpClient _apiHttpClient;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Injected service for interactions with the API.
+ public GetMusicArtistsEndpoint(IApiHttpClient apiHttpClient)
+ {
+ _apiHttpClient = apiHttpClient;
+ }
+
+ ///
+ /// Configures the endpoint.
+ ///
+ public override void Configure()
+ {
+ base.Configure();
+ Verbs(Http.GET);
+ Routes(WebRoutes.Music.GET_ARTISTS);
+ DontAutoTag();
+ Options(options => options.WithTags("Music"));
+ }
+
+ ///
+ /// Retrieves the lightweight details of the music artists of a media library.
+ ///
+ /// The request containing the parameters used to retrieve the artists.
+ /// Cancellation token that can be used to stop the execution.
+ public override async Task ExecuteAsync(GetMusicArtistsLiteRequest request, CancellationToken cancellationToken)
+ {
+ PaginatedMusicArtistLiteDto response = await _apiHttpClient.GetAsync(BuildItemsEndpoint(request), cancellationToken).ConfigureAwait(false);
+ return JsonSuccess(response);
+ }
+
+ ///
+ /// Builds the API endpoint used to retrieve the lightweight details of the music artists of a media library.
+ ///
+ /// The request containing the parameters used to retrieve the artists.
+ /// The API endpoint to which the retrieval request is sent.
+ private static string BuildItemsEndpoint(GetMusicArtistsLiteRequest query)
+ {
+ StringBuilder endpoint = new(ApiRoutes.Music.GET_ARTISTS_LITE.Replace("{libraryId}", query.LibraryId.ToString()));
+ List 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();
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtists/GetMusicArtistsEndpointSummary.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtists/GetMusicArtistsEndpointSummary.cs
new file mode 100644
index 00000000..5455a54e
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtists/GetMusicArtistsEndpointSummary.cs
@@ -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;
+
+///