Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions CONVENTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4411,8 +4411,10 @@ every session. CLAUDE.md keeps a one-line index of these topics.
`bridge/audible.go`, `api/handlers_audible.go`)**: the Bridge signs in to Audible and holds every credential; the
server only keeps what it reports. `0063`: `audible_accounts` (`account` = the Bridge's id
`^[a-z0-9]{8,32}$`, label, marketplace = one of `config.Regions`, `user_id` -> users CASCADE (deleting a
person, or an owner their member, then cancels the gone accounts' open poll, backups and sync,
`catalog.CancelOrphanAudibleJobs`, bridge#46), `library_id` ->
person captures their account ids and those of deleted members before the cascade. After commit,
`catalog.CancelRemovedAudibleJobs` cancels those accounts' open poll, backups and sync by indexed job key.
Each Audible scheduler pass also checks the open-job index for orphan jobs, even while the Bridge is offline.
An empty pass takes no writer (`catalog.CancelOrphanAudibleJobs`, bridge#46)), `library_id` ->
libraries SET NULL, policy `all`|`series`|`manual`, sync, `poll_hours` default 6, `last_poll_at`,
`last_queued_at`) and `audible_titles` (account CASCADE + asin; title, authors/series JSON, release_date,
runtime_s, state `available`|`preorder`|`unavailable`|`gone`, reason, the match `match_library_id` /
Expand Down Expand Up @@ -4509,7 +4511,9 @@ every session. CLAUDE.md keeps a one-line index of these topics.
the title's own (`importOwnBook`, else `ErrImportNotOwn`, logged): a book carrying the title's ASIN, or one
holding only the files the backup placed (a single-file book is its file), so a file placed into a folder
book already there (the scan makes it one book) never makes that book, nor another title's, the title's
match; and never the book the admin marked Not this book for the title. On refusal, the same transaction
match; and never the book the admin marked Not this book for the title. If the placement joined a disc into
the parent book, its indexed files must all belong to the backup even when the Bridge added its ASIN.
On refusal, the same transaction
records `fold_refusal_reason` and `fold_refused_at` on the title (`0093`). The admin title includes both until
the title's next backup is queued (`SetAudibleImportTx`: the status is that backup's now, so a refusal is
always the title's import job's), or a newly accepted match clears them (a poll naming another book, Not this book undone:
Expand Down Expand Up @@ -4551,9 +4555,13 @@ every session. CLAUDE.md keeps a one-line index of these topics.
(`{queued, skipped}`, `skipped` the titles left out because their params no longer validate (a stored `dest_path` from before a rule tightened: `CheckAudibleDestPath`; an account template that no longer validates refuses the batch: 400 `invalid_template`, reason `account`), the rest queued; `backupAllSQL`: available, unmatched, not rejected, ignored or contested, nothing open, the
latest import not a `done` one whose book is still indexed (a refused fold, `ErrImportNotOwn`, isn't
queued again; a done one whose book left the library is), a failed or cancelled one again; a console Back up of one contested or done title, and its pending request, still queue), `PATCH /admin/audible/titles/{account}/{asin}` (`{rejected?, dest_path?}`; 400
`invalid_dest_path`, also for a disc folder ("CD 3") directly inside an indexed book or a folder with a
`book` override, which the scan would join into it: `checkDestOwnFolder`, `metadata.IsDiscFolder`) and `PATCH /admin/audible/accounts/{account}` (`{policy?, template?}`, 400
`invalid_policy` / `invalid_template`), audited: a queued Back up `bridge.job` (kind `audible.import`; also
`invalid_dest_path`, also for a disc folder ("CD 3") directly inside an indexed book (reason `indexed_book`)
or a folder set to one book (`book_override`). Setting the `book` override checks saved destinations and open
imports in the same library. Changing an account's library or a placement template checks disc folders
the server can identify before placement (`checkDestOwnFolder`, `audibleDiscParent`; a remap skips the
destinations of titles already on this server, which are never backed up again: `checkAudibleRemap`). An actual joined
placement is checked at fold time too) and `PATCH /admin/audible/accounts/{account}` (`{policy?, template?}`, 400
`invalid_policy` / `invalid_template` / `invalid_dest_path`), audited: a queued Back up `bridge.job` (kind `audible.import`; also
when recording it on the title failed), a pending one `bridge.audible.backup`, then `bridge.audible.backup_all`
/ `title` / `account` (the audit guard reads `moduleRoutes.Admin` routes too), each with the account's id
in its details and its name as the row's target, as `bridge.audible.remove` has it (`audibleAccountName`:
Expand Down
2 changes: 1 addition & 1 deletion admin-ui/src/api/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ export const api = {
`/admin/audible/titles/${encodeURIComponent(account)}/${encodeURIComponent(asin)}`,
patch,
),
/** An account's policy and template; 400 invalid_policy, invalid_template. */
/** An account's policy and template; 400 invalid_policy, invalid_template, invalid_dest_path. */
patchAudibleAccount: (account: string, patch: AudibleAccountPatch) =>
request<{ account: AudibleAccount }>(
'PATCH',
Expand Down
2 changes: 2 additions & 0 deletions admin-ui/src/i18n/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -4033,6 +4033,8 @@
"errors.invalidDestPath": "Das ist kein Ort in der Bibliothek. Verwende Ordner und einen Dateinamen wie Autor/Reihe/Titel.m4b, ohne versteckte Ordner, Backslashes oder \"..\".",
"errors.invalidTemplate": "Diese Vorlage funktioniert nicht. Verwende die Variablen in geschweiften Klammern, etwa {Author}/{Series}/{Title}, und bleib unter 500 Zeichen.",
"errors.invalid_template.account": "Die Ablagevorlage dieses Kontos funktioniert nicht mehr. Korrigiere sie in den Kontoeinstellungen und sichere dann erneut.",
"errors.invalid_dest_path.indexed_book": "Dieser Disc-Ordner liegt in einem bereits erfassten Buch. Wähle einen separaten Ordner für die Audible-Sicherung.",
"errors.invalid_dest_path.book_override": "Diese Audible-Sicherung verwendet einen Disc-Ordner, der durch die Ordnereinstellung mit anderen Discs zu einem Buch zusammengefasst würde. Wähle einen separaten Ordner für die Sicherung.",
"errors.invalid_dest_path.title": "Das Ziel dieses Titels ist nicht mehr gültig. Lege es mit Ziel neu fest und sichere dann erneut.",
"librivox.title": "LibriVox",
"librivox.description": "Finde ein freies, gemeinfreies Hörbuch auf LibriVox und füge es einer Bibliothek hinzu. Deine Bridge lädt es herunter, legt es ab und ordnet es seiner Aufnahme zu.",
Expand Down
2 changes: 2 additions & 0 deletions admin-ui/src/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -4033,6 +4033,8 @@
"errors.invalidDestPath": "That isn't a place inside the library. Use folders and a file name such as Author/Series/Title.m4b, with no hidden folders, backslashes or \"..\".",
"errors.invalidTemplate": "That template doesn't work. Use the variables in braces, such as {Author}/{Series}/{Title}, and keep it under 500 characters.",
"errors.invalid_template.account": "This account's placement template no longer works. Fix it in Account settings and back up again.",
"errors.invalid_dest_path.indexed_book": "This disc folder is inside an indexed book. Choose a separate folder for the Audible backup.",
"errors.invalid_dest_path.book_override": "This Audible backup uses a disc folder that the folder setting would join into one book. Choose a separate folder for the backup.",
"errors.invalid_dest_path.title": "This title's destination is no longer valid. Set it again with Destination and back up again.",
"librivox.title": "LibriVox",
"librivox.description": "Find a free public-domain audiobook on LibriVox and add it to a library. Your Bridge downloads it, places it and matches it to its recording.",
Expand Down
2 changes: 2 additions & 0 deletions admin-ui/src/i18n/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -4255,6 +4255,8 @@
"errors.invalidDestPath": "Eso no es un lugar dentro de la biblioteca. Usa carpetas y un nombre de archivo como Autor/Serie/Título.m4b, sin carpetas ocultas, barras invertidas ni \"..\".",
"errors.invalidTemplate": "Esa plantilla no funciona. Usa las variables entre llaves, como {Author}/{Series}/{Title}, y no pases de 500 caracteres.",
"errors.invalid_template.account": "La plantilla de ubicación de esta cuenta ya no funciona. Corrígela en Ajustes de la cuenta y vuelve a hacer la copia.",
"errors.invalid_dest_path.indexed_book": "Esta carpeta de disco está dentro de un libro indexado. Elige otra carpeta para la copia de Audible.",
"errors.invalid_dest_path.book_override": "La copia de Audible usa una carpeta de disco que este ajuste uniría con otros discos en un solo libro. Elige otra carpeta para la copia.",
"errors.invalid_dest_path.title": "El destino de este título ya no es válido. Vuelve a definirlo con Destino y vuelve a hacer la copia.",
"librivox.title": "LibriVox",
"librivox.description": "Busca un audiolibro gratuito de dominio público en LibriVox y añádelo a una biblioteca. Tu Bridge lo descarga, lo coloca y lo asocia a su grabación.",
Expand Down
2 changes: 2 additions & 0 deletions admin-ui/src/i18n/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -4255,6 +4255,8 @@
"errors.invalidDestPath": "Ce n'est pas un emplacement dans la bibliothèque. Utilisez des dossiers et un nom de fichier comme Auteur/Série/Titre.m4b, sans dossiers cachés, barres obliques inverses ni « .. ».",
"errors.invalidTemplate": "Ce modèle ne fonctionne pas. Utilisez les variables entre accolades, comme {Author}/{Series}/{Title}, en moins de 500 caractères.",
"errors.invalid_template.account": "Le modèle d'emplacement de ce compte ne fonctionne plus. Corrigez-le dans Réglages du compte et relancez la sauvegarde.",
"errors.invalid_dest_path.indexed_book": "Ce dossier de disque se trouve dans un livre déjà indexé. Choisissez un dossier distinct pour la sauvegarde Audible.",
"errors.invalid_dest_path.book_override": "La sauvegarde Audible utilise un dossier de disque que ce réglage regrouperait avec d’autres disques en un seul livre. Choisissez un dossier distinct pour la sauvegarde.",
"errors.invalid_dest_path.title": "La destination de ce titre n'est plus valide. Redéfinissez-la avec Destination et relancez la sauvegarde.",
"librivox.title": "LibriVox",
"librivox.description": "Trouvez un livre audio gratuit du domaine public sur LibriVox et ajoutez-le à une bibliothèque. Votre Bridge le télécharge, le range et l'associe à son enregistrement.",
Expand Down
2 changes: 2 additions & 0 deletions admin-ui/src/i18n/locales/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -4255,6 +4255,8 @@
"errors.invalidDestPath": "Non è un percorso dentro la libreria. Usa cartelle e un nome di file come Autore/Serie/Titolo.m4b, senza cartelle nascoste, barre rovesciate o \"..\".",
"errors.invalidTemplate": "Questo modello non funziona. Usa le variabili tra parentesi graffe, come {Author}/{Series}/{Title}, e non superare i 500 caratteri.",
"errors.invalid_template.account": "Il modello di posizione di questo account non funziona più. Correggilo in Impostazioni account e riprova il backup.",
"errors.invalid_dest_path.indexed_book": "Questa cartella del disco si trova all’interno di un libro già indicizzato. Scegli una cartella separata per il backup Audible.",
"errors.invalid_dest_path.book_override": "Il backup Audible usa una cartella del disco che questa impostazione unirebbe ad altri dischi in un unico libro. Scegli una cartella separata per il backup.",
"errors.invalid_dest_path.title": "La destinazione di questo titolo non è più valida. Impostala di nuovo con Destinazione e riprova il backup.",
"librivox.title": "LibriVox",
"librivox.description": "Trova un audiolibro gratuito di pubblico dominio su LibriVox e aggiungilo a una libreria. La tua Bridge lo scarica, lo sistema e lo abbina alla sua registrazione.",
Expand Down
2 changes: 2 additions & 0 deletions admin-ui/src/i18n/locales/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -4255,6 +4255,8 @@
"errors.invalidDestPath": "Isso não é um local dentro da biblioteca. Use pastas e um nome de ficheiro como Autor/Série/Título.m4b, sem pastas ocultas, barras invertidas nem \"..\".",
"errors.invalidTemplate": "Esse modelo não funciona. Use as variáveis entre chavetas, como {Author}/{Series}/{Title}, e não ultrapasse os 500 caracteres.",
"errors.invalid_template.account": "O modelo de localização desta conta já não funciona. Corrija-o em Definições da conta e volte a fazer a cópia.",
"errors.invalid_dest_path.indexed_book": "Esta pasta de disco está dentro de um livro já indexado. Escolha uma pasta separada para a cópia de segurança da Audible.",
"errors.invalid_dest_path.book_override": "A cópia de segurança da Audible usa uma pasta de disco que esta definição juntaria a outros discos num só livro. Escolha uma pasta separada para a cópia de segurança.",
"errors.invalid_dest_path.title": "O destino deste título já não é válido. Defina-o de novo em Destino e volte a fazer a cópia.",
"librivox.title": "LibriVox",
"librivox.description": "Encontre um audiolivro gratuito em domínio público no LibriVox e adicione-o a uma biblioteca. A Bridge o baixa, o coloca no lugar e o associa à gravação.",
Expand Down
6 changes: 6 additions & 0 deletions admin-ui/src/lib/errors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,12 @@ describe('errorMessage', () => {
expect(errorMessage(stored('invalid_dest_path', 'title'), t)).toBe(
"This title's destination is no longer valid. Set it again with Destination and back up again.",
);
expect(errorMessage(stored('invalid_dest_path', 'indexed_book'), t)).toMatch(
/inside an indexed book/,
);
expect(errorMessage(stored('invalid_dest_path', 'book_override'), t)).toMatch(
/folder setting would join/,
);
// The value just typed (the account and title PATCHes): no reason.
expect(errorMessage(stored('invalid_template'), t)).toMatch(/^That template doesn't work/);
});
Expand Down
Loading
Loading