fix(images): a refresh never wipes covers, the job sees outages and starts cleanly

- A refresh (or any rebuild) while the Cover Art Archive is switched off, but its data
  not taken back, no longer turns the covers it gave into "no cover" and deletes their
  files: the stored cover is kept and its date renewed, so the files are not searched
  again at every request.
- When none of an album's files and folders can be looked at (an unmounted disk, a
  permission), that is ErrFilesUnreadable (503 files_unreadable), not "no picture": nothing
  is remembered, nothing built is touched, the archive is not asked, and the job counts it
  as a failure and gives up after five. A link that leaves the library is still just refused.
- The job calls the build for every album that is not good yet and does not serve an older
  cover on an outage, so a dead provider shows as failures and trips the limit instead of
  being reported as covers from the archive.
- Start marks the job as running before counting the albums and does not hold the lock
  meanwhile; a stop that comes back as a plain driver error is not a failure; a job that
  finished by itself is never marked stopped.
- Spec and README say so; the tests cover each case, including a list that fails midway.
This commit is contained in:
tgiachi 2026-11-12 09:43:51 +01:00
commit 345ad8eecb

View file

@ -511,7 +511,10 @@ paths:
**This is the one request that goes through the whole library.** With the archive on, it sends
the release group id of every album that has no picture in its files, one after the other and
spaced out. It gives up, and says why in `last_error`, when the provider fails for five albums
in a row. `DELETE /library/covers` stops it.
in a row, and also when the files cannot be read (an unmounted disk): it never turns that into
"no cover" and never replaces a cover that was built. A cover that came from the archive is kept
when the provider was switched off since, even with `refresh=true`; only taking its data back
(`DELETE /providers/coverartarchive/data`) removes those. `DELETE /library/covers` stops it.
security: [{bearerAuth: []}]
parameters:
- name: refresh
@ -537,6 +540,11 @@ paths:
content:
application/json:
schema: {$ref: '#/components/schemas/Error'}
'500':
description: The albums could not be counted (`internal`).
content:
application/json:
schema: {$ref: '#/components/schemas/Error'}
delete:
tags: [Scan]
operationId: stopCoversJob
@ -1310,6 +1318,14 @@ paths:
content:
application/json:
schema: {$ref: '#/components/schemas/Error'}
'503':
description: |
None of the album's files or folders could be read, for example because the disk is not
mounted (`files_unreadable`). That says nothing about whether there is a picture, so it is
not remembered as "no cover" and nothing already built is touched. Try again later.
content:
application/json:
schema: {$ref: '#/components/schemas/Error'}
head:
tags: [Catalog]
operationId: headAlbumCover
@ -1339,6 +1355,7 @@ paths:
'401': {$ref: '#/components/responses/Unauthorized'}
'404': {description: "No such album, or it has no cover."}
'502': {description: "The cover provider could not be reached."}
'503': {description: "None of the album's files could be read."}
/tracks:
get: