Files
tonehaus/docs/lastfm-integration.md
T

27 lines
880 B
Markdown

# Last.fm Integration
## Credentials
- Preferred: manage the Last.fm API key in `/admin/settings` (persisted in DB; no restart required).
- Env fallback: `LASTFM_API_KEY`.
## API Client
- `src/Service/LastFmClient.php` (uses Guzzle)
- `searchAlbums(query, limit)`
- `getAlbum(id)` / `getAlbums([ids])`
- `getAlbumWithTracks(id)`
- `getAlbumTracks(id)`
## Caching & Limits
- Last.fm responses are cached in Symfony cache pools to reduce repeated calls.
- Search/detail payloads are normalized to one internal album shape before persistence.
## Ingestion Flow
1. Search Last.fm
2. Resolve tags/genres via `LastFmTagResolver`
3. Persist or update album with `AlbumRepository::upsertFromExternalAlbum()`
4. Persist tracks with `AlbumTrackRepository::replaceAlbumTracks()`
## Admin Settings
- Set the Last.fm API key in `/admin/settings`.
- Key changes apply immediately.