feat(discovery): artist tags from Last.fm and MusicBrainz, and ids from my files
- feat: GET /api/v1/artists/{id}/tags lists, for each provider that is on, the
tags it gives to an artist with its own weights, kept as they came: Last.fm's
are relative to the artist, MusicBrainz's are counts of votes, and they are
never mixed. MusicBrainz also marks the tags it lists as genres. The same
rules as similar artists apply: asked only on demand, kept 7 days (1 for an
unknown artist), old data served when a provider fails, and one call for
simultaneous requests. A provider that is off, failing or lacking an id does
not hide the other
- feat: a thin MusicBrainz client that reads an artist's tags and genres by its
id. It never searches by name, because a search returns look-alikes and
picking one would be a guess. The id is checked before it reaches the path,
and errors never repeat the provider's text
- feat: the User-Agent can change while the server runs, so the contact an
admin sets for MusicBrainz applies to the next request; if the settings
cannot be read it falls back to the project address
- feat: Last.fm top tags, by id when known and by name otherwise, never
autocorrected
- feat: the scan reads MusicBrainz artist ids from the file tags, offline, and
keeps them on the artists. An id is only used when it can be paired with its
artist for certain: the same number of ids as artists, all valid. The same id
is the same artist whatever the spelling, an artist without an id takes the
one its file gives, and another id under the same name is another artist. A
file that confirms the id a provider gave to a discovered artist keeps it
- feat: POST /providers/musicbrainz/test checks that the service answers
- test: what leaves the server for MusicBrainz is checked from the other end:
the id of the artist and the admin's contact, nothing from the library;
removing the safeguards on ids and pairing makes tests fail
- docs: README, OpenAPI and the provider text updated
This commit is contained in:
parent
ce17314f0c
commit
07ea997cd0
2 changed files with 2099 additions and 62 deletions
17
migrations/postgres/0009_artist_tags.sql
Normal file
17
migrations/postgres/0009_artist_tags.sql
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
-- Tags that the providers gave to artists, kept as they gave them.
|
||||
--
|
||||
-- weight is the provider's own number and means different things: Last.fm's is
|
||||
-- relative to the artist (0 to 100, the top tag is usually 100), MusicBrainz's is
|
||||
-- an absolute number of votes. They are never mixed here. genre is set when
|
||||
-- MusicBrainz also lists the tag among its curated genres.
|
||||
--
|
||||
-- Freshness is recorded in provider_fetches (kind 'tags'), as for similar artists.
|
||||
|
||||
CREATE TABLE artist_tags (
|
||||
artist_id BIGINT NOT NULL REFERENCES artists(id) ON DELETE CASCADE,
|
||||
provider TEXT NOT NULL,
|
||||
tag TEXT NOT NULL, -- lower case
|
||||
weight DOUBLE PRECISION NOT NULL,
|
||||
genre BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
PRIMARY KEY (artist_id, provider, tag)
|
||||
);
|
||||
17
migrations/sqlite/0009_artist_tags.sql
Normal file
17
migrations/sqlite/0009_artist_tags.sql
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
-- Tags that the providers gave to artists, kept as they gave them.
|
||||
--
|
||||
-- weight is the provider's own number and means different things: Last.fm's is
|
||||
-- relative to the artist (0 to 100, the top tag is usually 100), MusicBrainz's is
|
||||
-- an absolute number of votes. They are never mixed here. genre is set when
|
||||
-- MusicBrainz also lists the tag among its curated genres.
|
||||
--
|
||||
-- Freshness is recorded in provider_fetches (kind 'tags'), as for similar artists.
|
||||
|
||||
CREATE TABLE artist_tags (
|
||||
artist_id INTEGER NOT NULL REFERENCES artists(id) ON DELETE CASCADE,
|
||||
provider TEXT NOT NULL,
|
||||
tag TEXT NOT NULL, -- lower case
|
||||
weight REAL NOT NULL,
|
||||
genre INTEGER NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (artist_id, provider, tag)
|
||||
);
|
||||
Loading…
Reference in a new issue