Renames project paths from Lumina to Nemera

This commit is contained in:
BinaryAlley committed 2026-11-27 15:34:43 +02:00
1 parent ce6fddb4c9
commit 0f659a4877
6450 files changed

No files matched your search

@@ -0,0 +1,59 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Plugins.Contracts.Core.Metadata;
using Lumina.Plugins.Contracts.Core.Plugins;
using Lumina.Plugins.MusicBrainz.Common.Models.DTO.Settings;
using Lumina.Plugins.MusicBrainz.Core;
using Lumina.Plugins.MusicBrainz.Core.Api;
using Lumina.Plugins.MusicBrainz.Core.Settings;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using System;
#endregion
namespace Lumina.Plugins.MusicBrainz.Common.DependencyInjection;
/// <summary>
/// Utility class for registering the services of the MusicBrainz metadata provider into the Dependency Injection container.
/// </summary>
internal static class MusicBrainzServices
{
/// <summary>
/// Registers the services of the MusicBrainz metadata providers into the Dependency Injection container.
/// </summary>
/// <param name="services">The service collection to add the services to.</param>
/// <param name="pluginId">The unique identifier of the plugin that provides the metadata.</param>
/// <param name="settingsCallback">Action used to configure the <see cref="MusicBrainzSettingsDto"/>.</param>
/// <returns>The updated <see cref="IServiceCollection"/>.</returns>
internal static IServiceCollection AddMusicBrainzMetadataProviders(this IServiceCollection services, Guid pluginId, Action<MusicBrainzSettingsDto>? settingsCallback = null)
{
ArgumentNullException.ThrowIfNull(services);
// Build the runtime settings provider per scope, overlaying the settings persisted by the host over the defaults and the optional callback.
services.TryAddScoped(serviceProvider =>
{
MusicBrainzSettingsDto defaults = new();
settingsCallback?.Invoke(defaults);
IPluginSettingsStore? settingsStore = serviceProvider.GetService<IPluginSettingsStore>();
return new MusicBrainzSettingsProvider(settingsStore, pluginId, defaults);
});
// The throttle must be process-wide, because the MusicBrainz web service enforces its request policy across all callers, not per scope.
services.TryAddSingleton<MusicBrainzRequestThrottle>();
// The response cache is process-wide, so that an entity shared by many items, like a release shared by all its tracks, is fetched only once.
services.TryAddSingleton<MusicBrainzResponseCache>();
// The host creates the primary handler of the outbound clients, which disables automatic redirects and connects only to addresses validated to be
// public. The client follows the redirects itself, confined to the configured host, so the configurable base URL cannot be used to reach an internal address.
services.AddHttpClient<MusicBrainzHttpClient>();
// Register the metadata providers as keyed by pluginId transient services, so they can be resolved specifically among other IMetadataProvider implementations.
// A single plugin exposes one provider per entity type, because the metadata contract is typed to a single lookup and metadata pair.
services.AddKeyedTransient<IMetadataProvider, MusicBrainzArtistMetadataProvider>(pluginId);
services.AddKeyedTransient<IMetadataProvider, MusicBrainzAlbumMetadataProvider>(pluginId);
services.AddKeyedTransient<IMetadataProvider, MusicBrainzTrackMetadataProvider>(pluginId);
return services;
}
}
@@ -0,0 +1,59 @@
#region ========================================================================= USING =====================================================================================
using System.Text.Json.Serialization;
#endregion
namespace Lumina.Plugins.MusicBrainz.Common.Models.Contracts.Responses;
/// <summary>
/// Represents a response for an alias of a MusicBrainz entity.
/// </summary>
internal sealed record MusicBrainzAliasResponse
{
/// <summary>
/// Gets the name of the alias.
/// </summary>
[JsonPropertyName("name")]
public string? Name { get; init; }
/// <summary>
/// Gets the sort name of the alias.
/// </summary>
[JsonPropertyName("sort-name")]
public string? SortName { get; init; }
/// <summary>
/// Gets the type of the alias.
/// </summary>
[JsonPropertyName("type")]
public string? Type { get; init; }
/// <summary>
/// Gets the locale the alias is used in.
/// </summary>
[JsonPropertyName("locale")]
public string? Locale { get; init; }
/// <summary>
/// Gets a value indicating whether this is the primary alias.
/// </summary>
[JsonPropertyName("primary")]
public bool? IsPrimary { get; init; }
/// <summary>
/// Gets the begin date of the alias.
/// </summary>
[JsonPropertyName("begin")]
public string? Begin { get; init; }
/// <summary>
/// Gets the end date of the alias.
/// </summary>
[JsonPropertyName("end")]
public string? End { get; init; }
/// <summary>
/// Gets a value indicating whether the alias has ended.
/// </summary>
[JsonPropertyName("ended")]
public bool? IsEnded { get; init; }
}
@@ -0,0 +1,54 @@
#region ========================================================================= USING =====================================================================================
using System.Collections.Generic;
using System.Text.Json.Serialization;
#endregion
namespace Lumina.Plugins.MusicBrainz.Common.Models.Contracts.Responses;
/// <summary>
/// Represents a response for an area from the MusicBrainz API.
/// </summary>
internal sealed record MusicBrainzAreaResponse
{
/// <summary>
/// Gets the MusicBrainz identifier of the area.
/// </summary>
[JsonPropertyName("id")]
public string? Id { get; init; }
/// <summary>
/// Gets the name of the area.
/// </summary>
[JsonPropertyName("name")]
public string? Name { get; init; }
/// <summary>
/// Gets the sort name of the area.
/// </summary>
[JsonPropertyName("sort-name")]
public string? SortName { get; init; }
/// <summary>
/// Gets the disambiguation comment of the area.
/// </summary>
[JsonPropertyName("disambiguation")]
public string? Disambiguation { get; init; }
/// <summary>
/// Gets the MusicBrainz type of the area.
/// </summary>
[JsonPropertyName("type")]
public string? Type { get; init; }
/// <summary>
/// Gets the ISO 3166-1 codes of the area.
/// </summary>
[JsonPropertyName("iso-3166-1-codes")]
public List<string> Iso3166Part1Codes { get; init; } = [];
/// <summary>
/// Gets the ISO 3166-2 codes of the area.
/// </summary>
[JsonPropertyName("iso-3166-2-codes")]
public List<string> Iso3166Part2Codes { get; init; } = [];
}
@@ -0,0 +1,29 @@
#region ========================================================================= USING =====================================================================================
using System.Text.Json.Serialization;
#endregion
namespace Lumina.Plugins.MusicBrainz.Common.Models.Contracts.Responses;
/// <summary>
/// Represents a response for a single credit in the artist credit of a MusicBrainz entity.
/// </summary>
internal sealed record MusicBrainzArtistCreditResponse
{
/// <summary>
/// Gets the credited name of the artist.
/// </summary>
[JsonPropertyName("name")]
public string? Name { get; init; }
/// <summary>
/// Gets the join phrase that follows the credit.
/// </summary>
[JsonPropertyName("joinphrase")]
public string? JoinPhrase { get; init; }
/// <summary>
/// Gets the artist the credit refers to.
/// </summary>
[JsonPropertyName("artist")]
public MusicBrainzArtistResponse? Artist { get; init; }
}
@@ -0,0 +1,120 @@
#region ========================================================================= USING =====================================================================================
using System.Collections.Generic;
using System.Text.Json.Serialization;
#endregion
namespace Lumina.Plugins.MusicBrainz.Common.Models.Contracts.Responses;
/// <summary>
/// Represents a response for an artist from the MusicBrainz API.
/// </summary>
internal sealed record MusicBrainzArtistResponse
{
/// <summary>
/// Gets the MusicBrainz identifier of the artist.
/// </summary>
[JsonPropertyName("id")]
public string? Id { get; init; }
/// <summary>
/// Gets the name of the artist.
/// </summary>
[JsonPropertyName("name")]
public string? Name { get; init; }
/// <summary>
/// Gets the sort name of the artist.
/// </summary>
[JsonPropertyName("sort-name")]
public string? SortName { get; init; }
/// <summary>
/// Gets the disambiguation comment of the artist.
/// </summary>
[JsonPropertyName("disambiguation")]
public string? Disambiguation { get; init; }
/// <summary>
/// Gets the MusicBrainz type of the artist.
/// </summary>
[JsonPropertyName("type")]
public string? Type { get; init; }
/// <summary>
/// Gets the gender of the artist.
/// </summary>
[JsonPropertyName("gender")]
public string? Gender { get; init; }
/// <summary>
/// Gets the ISO 3166-1 alpha-2 code of the country of the artist.
/// </summary>
[JsonPropertyName("country")]
public string? Country { get; init; }
/// <summary>
/// Gets the area the artist is primarily identified with.
/// </summary>
[JsonPropertyName("area")]
public MusicBrainzAreaResponse? Area { get; init; }
/// <summary>
/// Gets the area the artist began in.
/// </summary>
[JsonPropertyName("begin-area")]
public MusicBrainzAreaResponse? BeginArea { get; init; }
/// <summary>
/// Gets the area the artist ended in.
/// </summary>
[JsonPropertyName("end-area")]
public MusicBrainzAreaResponse? EndArea { get; init; }
/// <summary>
/// Gets the life span of the artist.
/// </summary>
[JsonPropertyName("life-span")]
public MusicBrainzLifeSpanResponse? LifeSpan { get; init; }
/// <summary>
/// Gets the ISNI codes of the artist.
/// </summary>
[JsonPropertyName("isnis")]
public List<string> Isnis { get; init; } = [];
/// <summary>
/// Gets the IPI codes of the artist.
/// </summary>
[JsonPropertyName("ipis")]
public List<string> Ipis { get; init; } = [];
/// <summary>
/// Gets the alternative names of the artist.
/// </summary>
[JsonPropertyName("aliases")]
public List<MusicBrainzAliasResponse> Aliases { get; init; } = [];
/// <summary>
/// Gets the tags of the artist.
/// </summary>
[JsonPropertyName("tags")]
public List<MusicBrainzTagResponse> Tags { get; init; } = [];
/// <summary>
/// Gets the genres of the artist.
/// </summary>
[JsonPropertyName("genres")]
public List<MusicBrainzTagResponse> Genres { get; init; } = [];
/// <summary>
/// Gets the relationships of the artist to other entities.
/// </summary>
[JsonPropertyName("relations")]
public List<MusicBrainzRelationResponse> Relations { get; init; } = [];
/// <summary>
/// Gets the aggregated rating of the artist.
/// </summary>
[JsonPropertyName("rating")]
public MusicBrainzRatingResponse? Rating { get; init; }
}
@@ -0,0 +1,30 @@
#region ========================================================================= USING =====================================================================================
using System.Collections.Generic;
using System.Text.Json.Serialization;
#endregion
namespace Lumina.Plugins.MusicBrainz.Common.Models.Contracts.Responses;
/// <summary>
/// Represents a response for an artist search from the MusicBrainz API.
/// </summary>
internal sealed record MusicBrainzArtistSearchResponse
{
/// <summary>
/// Gets the total number of matching artists.
/// </summary>
[JsonPropertyName("count")]
public int Count { get; init; }
/// <summary>
/// Gets the offset of the returned artists.
/// </summary>
[JsonPropertyName("offset")]
public int Offset { get; init; }
/// <summary>
/// Gets the matching artists.
/// </summary>
[JsonPropertyName("artists")]
public List<MusicBrainzArtistResponse> Artists { get; init; } = [];
}
@@ -0,0 +1,23 @@
#region ========================================================================= USING =====================================================================================
using System.Text.Json.Serialization;
#endregion
namespace Lumina.Plugins.MusicBrainz.Common.Models.Contracts.Responses;
/// <summary>
/// Represents a response for the label information of a MusicBrainz release.
/// </summary>
internal sealed record MusicBrainzLabelInfoResponse
{
/// <summary>
/// Gets the catalog number assigned by the label.
/// </summary>
[JsonPropertyName("catalog-number")]
public string? CatalogNumber { get; init; }
/// <summary>
/// Gets the label that issued the release.
/// </summary>
[JsonPropertyName("label")]
public MusicBrainzLabelResponse? Label { get; init; }
}
@@ -0,0 +1,35 @@
#region ========================================================================= USING =====================================================================================
using System.Text.Json.Serialization;
#endregion
namespace Lumina.Plugins.MusicBrainz.Common.Models.Contracts.Responses;
/// <summary>
/// Represents a response for a label from the MusicBrainz API.
/// </summary>
internal sealed record MusicBrainzLabelResponse
{
/// <summary>
/// Gets the MusicBrainz identifier of the label.
/// </summary>
[JsonPropertyName("id")]
public string? Id { get; init; }
/// <summary>
/// Gets the name of the label.
/// </summary>
[JsonPropertyName("name")]
public string? Name { get; init; }
/// <summary>
/// Gets the disambiguation comment of the label.
/// </summary>
[JsonPropertyName("disambiguation")]
public string? Disambiguation { get; init; }
/// <summary>
/// Gets the label code of the label.
/// </summary>
[JsonPropertyName("label-code")]
public int? LabelCode { get; init; }
}
@@ -0,0 +1,29 @@
#region ========================================================================= USING =====================================================================================
using System.Text.Json.Serialization;
#endregion
namespace Lumina.Plugins.MusicBrainz.Common.Models.Contracts.Responses;
/// <summary>
/// Represents a response for the life span of a MusicBrainz artist, label, or area.
/// </summary>
internal sealed record MusicBrainzLifeSpanResponse
{
/// <summary>
/// Gets the begin date of the life span.
/// </summary>
[JsonPropertyName("begin")]
public string? Begin { get; init; }
/// <summary>
/// Gets the end date of the life span.
/// </summary>
[JsonPropertyName("end")]
public string? End { get; init; }
/// <summary>
/// Gets a value indicating whether the life span has ended.
/// </summary>
[JsonPropertyName("ended")]
public bool? IsEnded { get; init; }
}
@@ -0,0 +1,42 @@
#region ========================================================================= USING =====================================================================================
using System.Collections.Generic;
using System.Text.Json.Serialization;
#endregion
namespace Lumina.Plugins.MusicBrainz.Common.Models.Contracts.Responses;
/// <summary>
/// Represents a response for a medium of a MusicBrainz release.
/// </summary>
internal sealed record MusicBrainzMediumResponse
{
/// <summary>
/// Gets the position of the medium within its release.
/// </summary>
[JsonPropertyName("position")]
public int Position { get; init; }
/// <summary>
/// Gets the title of the medium.
/// </summary>
[JsonPropertyName("title")]
public string? Title { get; init; }
/// <summary>
/// Gets the format of the medium (e.g., CD, Vinyl, Digital Media).
/// </summary>
[JsonPropertyName("format")]
public string? Format { get; init; }
/// <summary>
/// Gets the number of tracks of the medium.
/// </summary>
[JsonPropertyName("track-count")]
public int TrackCount { get; init; }
/// <summary>
/// Gets the tracks of the medium. The tracks are only returned when the recordings are included in the request.
/// </summary>
[JsonPropertyName("tracks")]
public List<MusicBrainzTrackResponse> Tracks { get; init; } = [];
}
@@ -0,0 +1,23 @@
#region ========================================================================= USING =====================================================================================
using System.Text.Json.Serialization;
#endregion
namespace Lumina.Plugins.MusicBrainz.Common.Models.Contracts.Responses;
/// <summary>
/// Represents a response for the aggregated rating of a MusicBrainz entity.
/// </summary>
internal sealed record MusicBrainzRatingResponse
{
/// <summary>
/// Gets the average rating value.
/// </summary>
[JsonPropertyName("value")]
public decimal? Value { get; init; }
/// <summary>
/// Gets the number of votes that contributed to the rating.
/// </summary>
[JsonPropertyName("votes-count")]
public int? VotesCount { get; init; }
}
@@ -0,0 +1,18 @@
#region ========================================================================= USING =====================================================================================
using System.Collections.Generic;
using System.Text.Json.Serialization;
#endregion
namespace Lumina.Plugins.MusicBrainz.Common.Models.Contracts.Responses;
/// <summary>
/// Represents a response for the recordings returned by an ISRC lookup from the MusicBrainz API.
/// </summary>
internal sealed record MusicBrainzRecordingListResponse
{
/// <summary>
/// Gets the recordings that carry the looked up ISRC.
/// </summary>
[JsonPropertyName("recordings")]
public List<MusicBrainzRecordingResponse> Recordings { get; init; } = [];
}
@@ -0,0 +1,90 @@
#region ========================================================================= USING =====================================================================================
using System.Collections.Generic;
using System.Text.Json.Serialization;
#endregion
namespace Lumina.Plugins.MusicBrainz.Common.Models.Contracts.Responses;
/// <summary>
/// Represents a response for a recording from the MusicBrainz API.
/// </summary>
internal sealed record MusicBrainzRecordingResponse
{
/// <summary>
/// Gets the MusicBrainz identifier of the recording.
/// </summary>
[JsonPropertyName("id")]
public string? Id { get; init; }
/// <summary>
/// Gets the title of the recording.
/// </summary>
[JsonPropertyName("title")]
public string? Title { get; init; }
/// <summary>
/// Gets the disambiguation comment of the recording.
/// </summary>
[JsonPropertyName("disambiguation")]
public string? Disambiguation { get; init; }
/// <summary>
/// Gets the length of the recording in milliseconds.
/// </summary>
[JsonPropertyName("length")]
public long? Length { get; init; }
/// <summary>
/// Gets a value indicating whether the recording is a video recording.
/// </summary>
[JsonPropertyName("video")]
public bool? IsVideo { get; init; }
/// <summary>
/// Gets the date the recording was first released.
/// </summary>
[JsonPropertyName("first-release-date")]
public string? FirstReleaseDate { get; init; }
/// <summary>
/// Gets the artist credit of the recording.
/// </summary>
[JsonPropertyName("artist-credit")]
public List<MusicBrainzArtistCreditResponse> ArtistCredit { get; init; } = [];
/// <summary>
/// Gets the ISRC (International Standard Recording Code) of the recording.
/// </summary>
[JsonPropertyName("isrcs")]
public List<string> Isrcs { get; init; } = [];
/// <summary>
/// Gets the releases the recording appears on.
/// </summary>
[JsonPropertyName("releases")]
public List<MusicBrainzReleaseResponse> Releases { get; init; } = [];
/// <summary>
/// Gets the tags of the recording.
/// </summary>
[JsonPropertyName("tags")]
public List<MusicBrainzTagResponse> Tags { get; init; } = [];
/// <summary>
/// Gets the genres of the recording.
/// </summary>
[JsonPropertyName("genres")]
public List<MusicBrainzTagResponse> Genres { get; init; } = [];
/// <summary>
/// Gets the relationships of the recording to other entities (e.g., its work, and its performers).
/// </summary>
[JsonPropertyName("relations")]
public List<MusicBrainzRelationResponse> Relations { get; init; } = [];
/// <summary>
/// Gets the aggregated rating of the recording.
/// </summary>
[JsonPropertyName("rating")]
public MusicBrainzRatingResponse? Rating { get; init; }
}
@@ -0,0 +1,30 @@
#region ========================================================================= USING =====================================================================================
using System.Collections.Generic;
using System.Text.Json.Serialization;
#endregion
namespace Lumina.Plugins.MusicBrainz.Common.Models.Contracts.Responses;
/// <summary>
/// Represents a response for a recording search from the MusicBrainz API.
/// </summary>
internal sealed record MusicBrainzRecordingSearchResponse
{
/// <summary>
/// Gets the total number of matching recordings.
/// </summary>
[JsonPropertyName("count")]
public int Count { get; init; }
/// <summary>
/// Gets the offset of the returned recordings.
/// </summary>
[JsonPropertyName("offset")]
public int Offset { get; init; }
/// <summary>
/// Gets the matching recordings.
/// </summary>
[JsonPropertyName("recordings")]
public List<MusicBrainzRecordingResponse> Recordings { get; init; } = [];
}
@@ -0,0 +1,60 @@
#region ========================================================================= USING =====================================================================================
using System.Collections.Generic;
using System.Text.Json.Serialization;
#endregion
namespace Lumina.Plugins.MusicBrainz.Common.Models.Contracts.Responses;
/// <summary>
/// Represents a response for a relationship between a MusicBrainz entity and another entity.
/// </summary>
internal sealed record MusicBrainzRelationResponse
{
/// <summary>
/// Gets the type of the relationship (e.g., producer, composer, member of band).
/// </summary>
[JsonPropertyName("type")]
public string? Type { get; init; }
/// <summary>
/// Gets the MusicBrainz identifier of the type of the relationship.
/// </summary>
[JsonPropertyName("type-id")]
public string? TypeId { get; init; }
/// <summary>
/// Gets the direction of the relationship.
/// </summary>
[JsonPropertyName("direction")]
public string? Direction { get; init; }
/// <summary>
/// Gets the type of the entity the relationship targets.
/// </summary>
[JsonPropertyName("target-type")]
public string? TargetType { get; init; }
/// <summary>
/// Gets the artist the relationship targets, when the target is an artist.
/// </summary>
[JsonPropertyName("artist")]
public MusicBrainzArtistResponse? Artist { get; init; }
/// <summary>
/// Gets the work the relationship targets, when the target is a work.
/// </summary>
[JsonPropertyName("work")]
public MusicBrainzWorkResponse? Work { get; init; }
/// <summary>
/// Gets the URL the relationship targets, when the target is a URL.
/// </summary>
[JsonPropertyName("url")]
public MusicBrainzUrlResponse? Url { get; init; }
/// <summary>
/// Gets the attributes of the relationship (e.g., the instrument that was performed).
/// </summary>
[JsonPropertyName("attributes")]
public List<string> Attributes { get; init; } = [];
}
@@ -0,0 +1,30 @@
#region ========================================================================= USING =====================================================================================
using System.Collections.Generic;
using System.Text.Json.Serialization;
#endregion
namespace Lumina.Plugins.MusicBrainz.Common.Models.Contracts.Responses;
/// <summary>
/// Represents a response for the result of browsing the releases linked to another MusicBrainz entity.
/// </summary>
internal sealed record MusicBrainzReleaseBrowseResponse
{
/// <summary>
/// Gets the releases returned by the browse request.
/// </summary>
[JsonPropertyName("releases")]
public List<MusicBrainzReleaseResponse> Releases { get; init; } = [];
/// <summary>
/// Gets the total number of releases linked to the browsed entity.
/// </summary>
[JsonPropertyName("release-count")]
public int ReleaseCount { get; init; }
/// <summary>
/// Gets the offset of the returned releases.
/// </summary>
[JsonPropertyName("release-offset")]
public int ReleaseOffset { get; init; }
}
@@ -0,0 +1,23 @@
#region ========================================================================= USING =====================================================================================
using System.Text.Json.Serialization;
#endregion
namespace Lumina.Plugins.MusicBrainz.Common.Models.Contracts.Responses;
/// <summary>
/// Represents a response for a release event of a MusicBrainz release.
/// </summary>
internal sealed record MusicBrainzReleaseEventResponse
{
/// <summary>
/// Gets the date of the release event.
/// </summary>
[JsonPropertyName("date")]
public string? Date { get; init; }
/// <summary>
/// Gets the area of the release event.
/// </summary>
[JsonPropertyName("area")]
public MusicBrainzAreaResponse? Area { get; init; }
}
@@ -0,0 +1,78 @@
#region ========================================================================= USING =====================================================================================
using System.Collections.Generic;
using System.Text.Json.Serialization;
#endregion
namespace Lumina.Plugins.MusicBrainz.Common.Models.Contracts.Responses;
/// <summary>
/// Represents a response for a release group from the MusicBrainz API.
/// </summary>
internal sealed record MusicBrainzReleaseGroupResponse
{
/// <summary>
/// Gets the MusicBrainz identifier of the release group.
/// </summary>
[JsonPropertyName("id")]
public string? Id { get; init; }
/// <summary>
/// Gets the title of the release group.
/// </summary>
[JsonPropertyName("title")]
public string? Title { get; init; }
/// <summary>
/// Gets the disambiguation comment of the release group.
/// </summary>
[JsonPropertyName("disambiguation")]
public string? Disambiguation { get; init; }
/// <summary>
/// Gets the primary type of the release group.
/// </summary>
[JsonPropertyName("primary-type")]
public string? PrimaryType { get; init; }
/// <summary>
/// Gets the secondary types of the release group.
/// </summary>
[JsonPropertyName("secondary-types")]
public List<string> SecondaryTypes { get; init; } = [];
/// <summary>
/// Gets the date the release group was first released.
/// </summary>
[JsonPropertyName("first-release-date")]
public string? FirstReleaseDate { get; init; }
/// <summary>
/// Gets the artist credit of the release group.
/// </summary>
[JsonPropertyName("artist-credit")]
public List<MusicBrainzArtistCreditResponse> ArtistCredit { get; init; } = [];
/// <summary>
/// Gets the releases of the release group.
/// </summary>
[JsonPropertyName("releases")]
public List<MusicBrainzReleaseResponse> Releases { get; init; } = [];
/// <summary>
/// Gets the tags of the release group.
/// </summary>
[JsonPropertyName("tags")]
public List<MusicBrainzTagResponse> Tags { get; init; } = [];
/// <summary>
/// Gets the genres of the release group.
/// </summary>
[JsonPropertyName("genres")]
public List<MusicBrainzTagResponse> Genres { get; init; } = [];
/// <summary>
/// Gets the aggregated rating of the release group.
/// </summary>
[JsonPropertyName("rating")]
public MusicBrainzRatingResponse? Rating { get; init; }
}
@@ -0,0 +1,30 @@
#region ========================================================================= USING =====================================================================================
using System.Collections.Generic;
using System.Text.Json.Serialization;
#endregion
namespace Lumina.Plugins.MusicBrainz.Common.Models.Contracts.Responses;
/// <summary>
/// Represents a response for a release group search from the MusicBrainz API.
/// </summary>
internal sealed record MusicBrainzReleaseGroupSearchResponse
{
/// <summary>
/// Gets the total number of matching release groups.
/// </summary>
[JsonPropertyName("count")]
public int Count { get; init; }
/// <summary>
/// Gets the offset of the returned release groups.
/// </summary>
[JsonPropertyName("offset")]
public int Offset { get; init; }
/// <summary>
/// Gets the matching release groups.
/// </summary>
[JsonPropertyName("release-groups")]
public List<MusicBrainzReleaseGroupResponse> ReleaseGroups { get; init; } = [];
}
@@ -0,0 +1,120 @@
#region ========================================================================= USING =====================================================================================
using System.Collections.Generic;
using System.Text.Json.Serialization;
#endregion
namespace Lumina.Plugins.MusicBrainz.Common.Models.Contracts.Responses;
/// <summary>
/// Represents a response for a release from the MusicBrainz API.
/// </summary>
internal sealed record MusicBrainzReleaseResponse
{
/// <summary>
/// Gets the MusicBrainz identifier of the release.
/// </summary>
[JsonPropertyName("id")]
public string? Id { get; init; }
/// <summary>
/// Gets the title of the release.
/// </summary>
[JsonPropertyName("title")]
public string? Title { get; init; }
/// <summary>
/// Gets the disambiguation comment of the release.
/// </summary>
[JsonPropertyName("disambiguation")]
public string? Disambiguation { get; init; }
/// <summary>
/// Gets the status of the release (e.g., Official, Bootleg).
/// </summary>
[JsonPropertyName("status")]
public string? Status { get; init; }
/// <summary>
/// Gets the date the release was issued.
/// </summary>
[JsonPropertyName("date")]
public string? Date { get; init; }
/// <summary>
/// Gets the ISO 3166-1 alpha-2 code of the country the release was issued in.
/// </summary>
[JsonPropertyName("country")]
public string? Country { get; init; }
/// <summary>
/// Gets the release events of the release.
/// </summary>
[JsonPropertyName("release-events")]
public List<MusicBrainzReleaseEventResponse> ReleaseEvents { get; init; } = [];
/// <summary>
/// Gets the barcode of the release.
/// </summary>
[JsonPropertyName("barcode")]
public string? Barcode { get; init; }
/// <summary>
/// Gets the outermost packaging of the release.
/// </summary>
[JsonPropertyName("packaging")]
public string? Packaging { get; init; }
/// <summary>
/// Gets the language and script of the titles of the release.
/// </summary>
[JsonPropertyName("text-representation")]
public MusicBrainzTextRepresentationResponse? TextRepresentation { get; init; }
/// <summary>
/// Gets the artist credit of the release.
/// </summary>
[JsonPropertyName("artist-credit")]
public List<MusicBrainzArtistCreditResponse> ArtistCredit { get; init; } = [];
/// <summary>
/// Gets the release group the release belongs to.
/// </summary>
[JsonPropertyName("release-group")]
public MusicBrainzReleaseGroupResponse? ReleaseGroup { get; init; }
/// <summary>
/// Gets the label information of the release.
/// </summary>
[JsonPropertyName("label-info")]
public List<MusicBrainzLabelInfoResponse> LabelInfo { get; init; } = [];
/// <summary>
/// Gets the media of the release.
/// </summary>
[JsonPropertyName("media")]
public List<MusicBrainzMediumResponse> Media { get; init; } = [];
/// <summary>
/// Gets the ASIN (Amazon Standard Identification Number) of the release.
/// </summary>
[JsonPropertyName("asin")]
public string? Asin { get; init; }
/// <summary>
/// Gets the tags of the release.
/// </summary>
[JsonPropertyName("tags")]
public List<MusicBrainzTagResponse> Tags { get; init; } = [];
/// <summary>
/// Gets the genres of the release.
/// </summary>
[JsonPropertyName("genres")]
public List<MusicBrainzTagResponse> Genres { get; init; } = [];
/// <summary>
/// Gets the relationships of the release to other entities (e.g., its producers and engineers).
/// </summary>
[JsonPropertyName("relations")]
public List<MusicBrainzRelationResponse> Relations { get; init; } = [];
}
@@ -0,0 +1,35 @@
#region ========================================================================= USING =====================================================================================
using System.Text.Json.Serialization;
#endregion
namespace Lumina.Plugins.MusicBrainz.Common.Models.Contracts.Responses;
/// <summary>
/// Represents a response for a tag or a genre of a MusicBrainz entity.
/// </summary>
internal sealed record MusicBrainzTagResponse
{
/// <summary>
/// Gets the MusicBrainz identifier of the genre, when the tag is a genre.
/// </summary>
[JsonPropertyName("id")]
public string? Id { get; init; }
/// <summary>
/// Gets the name of the tag.
/// </summary>
[JsonPropertyName("name")]
public string? Name { get; init; }
/// <summary>
/// Gets the disambiguation comment of the genre, when the tag is a genre.
/// </summary>
[JsonPropertyName("disambiguation")]
public string? Disambiguation { get; init; }
/// <summary>
/// Gets the number of votes the tag received.
/// </summary>
[JsonPropertyName("count")]
public int Count { get; init; }
}
@@ -0,0 +1,23 @@
#region ========================================================================= USING =====================================================================================
using System.Text.Json.Serialization;
#endregion
namespace Lumina.Plugins.MusicBrainz.Common.Models.Contracts.Responses;
/// <summary>
/// Represents a response for the language and script of the titles of a MusicBrainz release.
/// </summary>
internal sealed record MusicBrainzTextRepresentationResponse
{
/// <summary>
/// Gets the ISO 639-3 language code of the release.
/// </summary>
[JsonPropertyName("language")]
public string? Language { get; init; }
/// <summary>
/// Gets the ISO 15924 script code of the release.
/// </summary>
[JsonPropertyName("script")]
public string? Script { get; init; }
}
@@ -0,0 +1,47 @@
#region ========================================================================= USING =====================================================================================
using System.Text.Json.Serialization;
#endregion
namespace Lumina.Plugins.MusicBrainz.Common.Models.Contracts.Responses;
/// <summary>
/// Represents a response for a track of a medium of a MusicBrainz release, including the recording it is a performance of.
/// </summary>
internal sealed record MusicBrainzTrackResponse
{
/// <summary>
/// Gets the MusicBrainz identifier of the track.
/// </summary>
[JsonPropertyName("id")]
public string? Id { get; init; }
/// <summary>
/// Gets the track number, as displayed on the medium (for example, "1" or "A1").
/// </summary>
[JsonPropertyName("number")]
public string? Number { get; init; }
/// <summary>
/// Gets the position of the track within its medium.
/// </summary>
[JsonPropertyName("position")]
public int Position { get; init; }
/// <summary>
/// Gets the title of the track.
/// </summary>
[JsonPropertyName("title")]
public string? Title { get; init; }
/// <summary>
/// Gets the length of the track in milliseconds.
/// </summary>
[JsonPropertyName("length")]
public long? Length { get; init; }
/// <summary>
/// Gets the recording the track is a performance of.
/// </summary>
[JsonPropertyName("recording")]
public MusicBrainzRecordingResponse? Recording { get; init; }
}
@@ -0,0 +1,23 @@
#region ========================================================================= USING =====================================================================================
using System.Text.Json.Serialization;
#endregion
namespace Lumina.Plugins.MusicBrainz.Common.Models.Contracts.Responses;
/// <summary>
/// Represents a response for a URL from the MusicBrainz API.
/// </summary>
internal sealed record MusicBrainzUrlResponse
{
/// <summary>
/// Gets the MusicBrainz identifier of the URL.
/// </summary>
[JsonPropertyName("id")]
public string? Id { get; init; }
/// <summary>
/// Gets the resource the URL points to.
/// </summary>
[JsonPropertyName("resource")]
public string? Resource { get; init; }
}
@@ -0,0 +1,66 @@
#region ========================================================================= USING =====================================================================================
using System.Collections.Generic;
using System.Text.Json.Serialization;
#endregion
namespace Lumina.Plugins.MusicBrainz.Common.Models.Contracts.Responses;
/// <summary>
/// Represents a response for a work from the MusicBrainz API.
/// </summary>
internal sealed record MusicBrainzWorkResponse
{
/// <summary>
/// Gets the MusicBrainz identifier of the work.
/// </summary>
[JsonPropertyName("id")]
public string? Id { get; init; }
/// <summary>
/// Gets the title of the work.
/// </summary>
[JsonPropertyName("title")]
public string? Title { get; init; }
/// <summary>
/// Gets the MusicBrainz type of the work.
/// </summary>
[JsonPropertyName("type")]
public string? Type { get; init; }
/// <summary>
/// Gets the disambiguation comment of the work.
/// </summary>
[JsonPropertyName("disambiguation")]
public string? Disambiguation { get; init; }
/// <summary>
/// Gets the languages of the work.
/// </summary>
[JsonPropertyName("languages")]
public List<string> Languages { get; init; } = [];
/// <summary>
/// Gets the ISWC (International Standard Musical Work Code) of the work.
/// </summary>
[JsonPropertyName("iswcs")]
public List<string> Iswcs { get; init; } = [];
/// <summary>
/// Gets the relationships of the work to other entities (e.g., its composers and lyricists).
/// </summary>
[JsonPropertyName("relations")]
public List<MusicBrainzRelationResponse> Relations { get; init; } = [];
/// <summary>
/// Gets the tags of the work.
/// </summary>
[JsonPropertyName("tags")]
public List<MusicBrainzTagResponse> Tags { get; init; } = [];
/// <summary>
/// Gets the genres of the work.
/// </summary>
[JsonPropertyName("genres")]
public List<MusicBrainzTagResponse> Genres { get; init; } = [];
}
@@ -0,0 +1,49 @@
#region ========================================================================= USING =====================================================================================
using System;
#endregion
namespace Lumina.Plugins.MusicBrainz.Common.Models.DTO.Settings;
/// <summary>
/// Data transfer object for the settings that configure the MusicBrainz metadata plugin.
/// </summary>
internal sealed class MusicBrainzSettingsDto
{
/// <summary>
/// Gets or sets the base URL of the MusicBrainz web service the requests are sent to.
/// Defaults to the public MusicBrainz web service, and can point to a self hosted mirror instead.
/// </summary>
public string BaseUrl { get; set; } = "https://musicbrainz.org/ws/2/";
/// <summary>
/// Gets or sets a value indicating whether the base URL is allowed to point at a private or local host, for a self hosted mirror on a local
/// network. Defaults to <see langword="false"/>, so that a misconfigured base URL cannot silently reach a local service.
/// </summary>
public bool DoesAllowPrivateBaseUrl { get; set; }
/// <summary>
/// Gets or sets the user agent sent with every request to the MusicBrainz API.
/// </summary>
public string UserAgent { get; set; } = "Lumina-MusicBrainz/1.0";
/// <summary>
/// Gets or sets the contact email sent with every request to the MusicBrainz API.
/// </summary>
public string? ContactEmail { get; set; }
/// <summary>
/// Gets or sets the maximum number of results returned by a single search.
/// </summary>
public int SearchResultLimit { get; set; } = 10;
/// <summary>
/// Gets or sets the maximum number of releases fetched for a single release group.
/// </summary>
public int ReleaseLookupLimit { get; set; } = 25;
/// <summary>
/// Gets or sets the minimum interval between consecutive requests to the MusicBrainz API.
/// MusicBrainz requires client applications to make no more than one request per second.
/// </summary>
public TimeSpan MinimumRequestInterval { get; set; } = TimeSpan.FromSeconds(1.0);
}