Stop retried/recast audiobook casts from creating duplicate scripts (v1.14.18)

A fresh (non-resume) cast unconditionally nulled _audiobook.rehId even
when retrying or recasting a book that already had a linked Rehearsal
Library record from a prior attempt — silently orphaning it and
creating a new one on the next save. Now only nulled for a genuinely
first-ever cast; retries/recasts overwrite the existing record.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
mARTin-B78 2026-07-09 12:23:55 +02:00
parent 606ae125a3
commit 17716ac740
4 changed files with 21 additions and 5 deletions

View File

@ -9,6 +9,13 @@ Follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) · versioned wi
--- ---
## [1.14.18] — 2026-07-09
### Fixed
- **Every retried/recast audiobook cast created a new duplicate Rehearsal Library entry** instead of overwriting the previous attempt — a fresh (non-resume) cast unconditionally nulled the in-memory link to the existing SQLite record, even when retrying or recasting a book that already had one from a prior attempt. The link is now only cleared for a genuinely first-ever cast; retries and "Recast all" overwrite the existing record instead of piling up near-duplicates.
---
## [1.14.17] — 2026-07-09 ## [1.14.17] — 2026-07-09
### Added ### Added

View File

@ -1 +1 @@
1.14.17 1.14.18

View File

@ -10,7 +10,7 @@
<meta name="format-detection" content="telephone=no"> <meta name="format-detection" content="telephone=no">
<meta name="color-scheme" content="light dark"> <meta name="color-scheme" content="light dark">
<meta name="theme-color" content="#2563EB"> <meta name="theme-color" content="#2563EB">
<meta name="app-version" content="1.14.17"> <meta name="app-version" content="1.14.18">
<link rel="manifest" href="/manifest.webmanifest"> <link rel="manifest" href="/manifest.webmanifest">
<link rel="icon" href="/static/icon.svg" type="image/svg+xml"> <link rel="icon" href="/static/icon.svg" type="image/svg+xml">
<link rel="apple-touch-icon" href="/static/icon.svg"> <link rel="apple-touch-icon" href="/static/icon.svg">
@ -27,7 +27,7 @@
<!-- ── Core styles (local — no CDN dependency for first paint) ────────── --> <!-- ── Core styles (local — no CDN dependency for first paint) ────────── -->
<link rel="stylesheet" href="/static/vendor/mdi/materialdesignicons.min.css"> <link rel="stylesheet" href="/static/vendor/mdi/materialdesignicons.min.css">
<link rel="stylesheet" href="/static/style.css?v=1.14.17"> <link rel="stylesheet" href="/static/style.css?v=1.14.18">
<!-- ── Flag icons — non-blocking (loaded async, icons appear after JS) ── --> <!-- ── Flag icons — non-blocking (loaded async, icons appear after JS) ── -->
@ -365,7 +365,7 @@ window.toggleNavTree = function(treeId, chevronId) {
</script> </script>
<!-- loader.js: fetches sections → loads JS modules → removes skeleton --> <!-- loader.js: fetches sections → loads JS modules → removes skeleton -->
<script src="/static/loader.js?v=1.14.17"></script> <script src="/static/loader.js?v=1.14.18"></script>
</body> </body>
</html> </html>

View File

@ -3872,7 +3872,16 @@ async function audiobookCast(overrideUrl, overrideModel, resume) {
_audiobook.cancel = false; _audiobook.cancel = false;
if (!isResume) { if (!isResume) {
_audiobook.rehId = null; // fresh cast creates a new rehearsal record // Deliberately does NOT null _audiobook.rehId here. It used to, on the
// theory that a fresh (non-resume) cast should always start a brand-new
// Rehearsal Library record — but "fresh cast" also covers "Recast all"
// and simply retrying after a failed/timed-out run for a book that
// already has a rehId (restored from its draft in _applyDraft above).
// Nulling it there meant every retry silently orphaned the previous
// record and created a new one, piling up near-duplicate scripts in the
// Rehearsal Library for the same book. Keeping whatever rehId is already
// known — null only for a genuinely first-ever cast — makes retries/
// recasts overwrite that one record instead.
_abClearDraft(); _abClearDraft();
} }
if (typeof window.setNavCastingBadge === 'function') window.setNavCastingBadge(true); if (typeof window.setNavCastingBadge === 'function') window.setNavCastingBadge(true);