Add MusicBrainz API integration for metadata enrichment

- Added MusicBrainzSettings model with username/password authentication
- Created MusicBrainzService with ISRC lookup and recording search
- Implements proper rate limiting (1 req/sec) per MusicBrainz rules
- Added meaningful User-Agent header as required
- Registered service in Program.cs with configuration
- Added MusicBrainz section to appsettings.json
- Credentials stored in .env (MUSICBRAINZ_USERNAME/PASSWORD)

Next: Add to admin UI and implement import/export for .env
This commit is contained in:
2026-02-04 16:23:16 -05:00
parent cd4fd702fc
commit 39f6893741
5 changed files with 310 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
namespace allstarr.Models.Settings;
/// <summary>
/// Settings for MusicBrainz API integration.
/// </summary>
public class MusicBrainzSettings
{
public bool Enabled { get; set; } = true;
public string? Username { get; set; }
public string? Password { get; set; }
/// <summary>
/// Base URL for MusicBrainz API.
/// </summary>
public string BaseUrl { get; set; } = "https://musicbrainz.org/ws/2";
/// <summary>
/// Rate limit: 1 request per second for unauthenticated, 1 per second for authenticated.
/// </summary>
public int RateLimitMs { get; set; } = 1000;
}