feat(images): free photos of artists from Wikimedia Commons
- GET and HEAD /artists/{id}/image serve a free picture of an artist as a JPEG
(size=small 300 px or large 1000 px, token in the query allowed for an <img>), and
GET /artists/{id}/image/credit gives the author, the licence and the page of the file,
to be shown next to it.
- New provider "commons" (off by default, no key, contact in the User-Agent), which also
needs MusicBrainz on. The way to the picture uses ids only, never a name: the artist's
MusicBrainz id, the Wikidata item MusicBrainz links to it, the file Wikidata names for
it (P18), Commons for its licence, and a 960 px copy from a Wikimedia picture host.
- Only free licences: public domain, CC0, CC BY and CC BY-SA. Non-commercial,
no-derivatives, GFDL alone, fair use and unknown licences are refused, since a copy is
kept. The author is plain text, the licence address is kept only on creativecommons.org,
and the download only from https thumb.wikimedia.org or upload.wikimedia.org.
- Built on the first request, kept in the data folder: 30 days, or a week when there is no
free picture; an older copy is served when Commons cannot be reached; a failure is not
remembered. Credit changes change the ETag.
- Removing the provider's data forgets the records and deletes the files; a read that started
before it is not saved over it.
- images table gets the credit (migration 0015); the purge reports images.
- Spec, contract test, README updated; the facts of the real APIs are written down.
Closes #41
This commit is contained in:
parent
d0f98b0dcc
commit
e752d15536
2 changed files with 2176 additions and 81 deletions
9
migrations/postgres/0015_image_credit.sql
Normal file
9
migrations/postgres/0015_image_credit.sql
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
-- Whose picture it is, for the pictures that come from somewhere else (the free photos of
|
||||
-- artists from Wikimedia Commons): the author, the licence and the page of the file are
|
||||
-- what a reader needs to give credit, so they are stored with the picture. Pictures from
|
||||
-- the user's own files leave them empty.
|
||||
|
||||
ALTER TABLE images ADD COLUMN author TEXT NOT NULL DEFAULT '';
|
||||
ALTER TABLE images ADD COLUMN license TEXT NOT NULL DEFAULT '';
|
||||
ALTER TABLE images ADD COLUMN license_url TEXT NOT NULL DEFAULT '';
|
||||
ALTER TABLE images ADD COLUMN page_url TEXT NOT NULL DEFAULT '';
|
||||
9
migrations/sqlite/0015_image_credit.sql
Normal file
9
migrations/sqlite/0015_image_credit.sql
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
-- Whose picture it is, for the pictures that come from somewhere else (the free photos of
|
||||
-- artists from Wikimedia Commons): the author, the licence and the page of the file are
|
||||
-- what a reader needs to give credit, so they are stored with the picture. Pictures from
|
||||
-- the user's own files leave them empty.
|
||||
|
||||
ALTER TABLE images ADD COLUMN author TEXT NOT NULL DEFAULT '';
|
||||
ALTER TABLE images ADD COLUMN license TEXT NOT NULL DEFAULT '';
|
||||
ALTER TABLE images ADD COLUMN license_url TEXT NOT NULL DEFAULT '';
|
||||
ALTER TABLE images ADD COLUMN page_url TEXT NOT NULL DEFAULT '';
|
||||
Loading…
Reference in a new issue