Repository navigation
feat: choose an artist's portrait from a Deezer search #311
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| -- A Deezer search for an artist's portrait, and what it offered (RFC-013 | ||
| -- decision 4). | ||
| -- | ||
| -- The pick names a Deezer id and nothing else, so the server remembers what it | ||
| -- offered: a search per artist and query, and its candidates in Deezer's | ||
| -- order, each with the preview the server fetched. Keyed by the artist row, | ||
| -- which is per library, so any owner or manager of that library may pick from | ||
| -- it and no other library ever finds it. | ||
| CREATE TABLE artist_image_search ( | ||
| id TEXT PRIMARY KEY NOT NULL, | ||
| artist_id TEXT NOT NULL REFERENCES artist(id) ON DELETE CASCADE, | ||
| -- The query as typed, trimmed and case-folded: "Björk " and "björk" are | ||
| -- one search. | ||
| query_key TEXT NOT NULL, | ||
| searched_by TEXT NOT NULL, | ||
| searched_at INTEGER NOT NULL, | ||
| -- An hour from the moment the search completed; NULL while it fetches. | ||
| expires_at INTEGER, | ||
| -- Set when every candidate's preview is stored. 0 means a task is | ||
| -- fetching for it now: a failed search is deleted, a search past its | ||
| -- fetch deadline is swept, and boot deletes any left at 0. It is what | ||
| -- makes a second search by the account answer 429. | ||
| complete INTEGER NOT NULL DEFAULT 0 CHECK (complete IN (0, 1)), | ||
| CHECK ((complete = 1) = (expires_at IS NOT NULL)) | ||
| ) STRICT; | ||
|
|
||
| CREATE INDEX artist_image_search_artist ON artist_image_search(artist_id, query_key); | ||
| CREATE INDEX artist_image_search_account ON artist_image_search(searched_by, complete); | ||
|
|
||
| -- The preview names its artwork with no `ON DELETE`, as a choice does: the | ||
| -- sweep keeps what a candidate names, and one that forgot would fail rather | ||
| -- than leave a candidate pointing at nothing. | ||
| CREATE TABLE artist_image_candidate ( | ||
| search_id TEXT NOT NULL REFERENCES artist_image_search(id) ON DELETE CASCADE, | ||
| -- Deezer's order, so the answer reads as the search did. | ||
| position INTEGER NOT NULL, | ||
| deezer_id INTEGER NOT NULL, | ||
| name TEXT NOT NULL, | ||
| fans INTEGER, | ||
| artwork_hash TEXT NOT NULL REFERENCES artwork(hash), | ||
| PRIMARY KEY (search_id, position), | ||
| UNIQUE (search_id, deezer_id) | ||
| ) STRICT; | ||
|
|
||
| CREATE INDEX artist_image_candidate_artwork ON artist_image_candidate(artwork_hash); |
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.