Repository navigation
Artist art and bios from fanart.tv and Wikipedia (plan 072, Phase 2, server) - #123
Merged
Merged
Conversation
…nt with retries, body caps and errors that never quote a URL, and MusicBrainz looks up an artist's Wikidata item
…pass: what each source said, remote art that never replaces a folder's or a pin
… as settings, the keys secrets and lookups off on a new server
…busy, down, refused, bare names, slowly and too much
…ns and folders first, failures backed off, a refused key stopping its source
…ng asks for it first, the pass wired to its settings and the KITSUNE_FANARTTV_URL and KITSUNE_WIKIMEDIA_URL stand-ins, and its speed budget
…tate, GET /admin/metadata and the stand-ins
…ute, so a busy machine can't turn too much into too slow
Owner
Author
Speed, before (main at f5a301c) and after, on the same idle machineBrowser suite (
Server speed tests, median / p95:
Everything moves within run-to-run noise. scrape-artist is mostly the 4K background's renders. Lookups are off by default, so the pass doesn't run during the suite; with them on it is background work that waits on a scan's claim and shares the scan's two renders. CI's perf jobs pass, the new budget included. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Plan 072, Phase 2, the server half: artist art and bios fetched from fanart.tv and from Wikipedia, Wikidata and Wikimedia Commons, by the MusicBrainz IDs the library holds. The UI half (Health's Metadata card, the Settings rows) follows from the boards.
What it does
internal/scrape, the artist pass.Scraper.Runis the app's background work: a pass at start, after every library change (a scan, an edit or a match may have given an artist an MBID) and when the next artist falls due. People's artists first, then album artists by everyone's plays, then the rest. It waits on the scan's claim before each artist and renders through the scan'sartwork.Cache, sharing its two renders. Never by a name: only an artist's MBID, never Various Artists or MusicBrainz's special-purpose artists.Decide,DecideBio,Pick). Pins and the library's own files are never replaced or taken away. fanart.tv (thumb, 4K then 1080p background, HD then plain logo, banner), then Commons' Wikidata portrait for a thumb fanart.tv lacks; Wikipedia's lead inmetadata.language, else English, as the bio, credited CC BY-SA 4.0 with its link. A source that wasn't asked or failed keeps its own image; one goes only when its own source answered with none. Among one source's images: tier, language, likes, size, oldest ID.internal/remote: the gate MusicBrainz used, moved, beside a client every source shares: people before background work, one request per key, retries on 429 and 503 honoring Retry-After, body caps, Kitsune's User-Agent, keys in headers, and errors that never quote a URL.scrape/fanarttvandscrape/wikimediaclients, andmatching.MusicBrainz.ArtistLinks(artist/{mbid}?inc=url-rels, kept a week) for the Wikidata item.scrape_state(per source and MBID: found, none or failed, failures in a row, the error in words, next ask) andscrape_feeds. Found is asked again in 27 to 33 days by a hash of the MBID; none in 7 days, then 30; failures back off 1 h, 6 h, a day, a week. A 404 is none; a 401 or 403 stops that source until a setting changes; a source down or busy rests. fanart.tv'slatestfeed, read once a day, brings forward every artist on it. A folder that gives up an image asks the sources again.metadata.remote(off on a new server),metadata.fanarttv,metadata.wikipedia,metadata.language, and the secretsfanarttv.api_keyandfanarttv.client_key. Kitsune ships no key and builds none into a release: without a project key fanart.tv is off and says so. Live throughfollow.go(Scraper.Configure).GET /admin/metadatafor Health's card: the master switch and language, each source's state and key states in words (never a value), its last failure, the pass's progress, and album artists counted (with an MBID, looked up, with art, found nothing, without an MBID for the Matching link).artistsevent.fanarttvtestandwikimediatest(KITSUNE_FANARTTV_URL,KITSUNE_WIKIMEDIA_URL, read only incmd/), andmusicbrainztestgains url-rels. Each answers 429 with Retry-After, 503, a refused key, bare file names, slowly and too much.Deviations from the plan
set,missingornone(nobuilt in).metadata.lastfm_bios,metadata.coverartarchiveandmetadata.audiodbare left to their phases: no defs yet.GET /admin/metadata, not inGET /library: it is for administrators, and the card reads it again whilepass.running.lookupsyet (the picker of Phase 4 needs them); MusicBrainz's are, as before.Tests
TestNoErrorQuotesAKeyinfanarttvandscrape(every fault: logs, stored errors, the report), andTestNoEventHoldsASecretwith both fanart.tv keys set.TestPrefixescovers 0027.openapitest:GET /admin/metadata200, 401, 403, 503, and an artist opened asked first.remote: statuses as sentinels, no URL in an error, body caps, Retry-After, a long Retry-After ending the request, people first, single flight, a timeout ending (not looping).Speed
Numbers before and after, on the same machine, to follow in a comment here.