T-024: Position pro Buch (5 s-Takt/Pausen/Stop), Fortsetzen an letzter Stelle; App-Start lädt letztes Buch pausiert; audible last-heard als sync.json (T-030-Basis)

This commit is contained in:
2026-11-06 20:34:03 +01:00
parent ab1995c5f5
commit ed0ff900ca
3 changed files with 145 additions and 4 deletions

View File

@ -516,6 +516,24 @@ fn decrypt_book(asin: &str, dir: &Path) -> Result<(), String> {
}
if let Some(ch) = find_chapters(dir) {
let _ = fs::copy(&ch, book_dir.join("chapters.json"));
// Zuletzt-gehört-Position aus Kapitel-Datei für T-030 sichern
if let Ok(txt) = fs::read_to_string(&ch) {
if let Ok(v) = serde_json::from_str::<serde_json::Value>(&txt) {
let lp = &v["content_metadata"]["last_position_heard"];
let ms = lp["position_ms"].as_f64();
let updated = lp["last_updated"].as_str().unwrap_or("");
if let Some(ms) = ms {
let _ = fs::write(
book_dir.join("sync.json"),
serde_json::json!({
"position_sec": ms / 1000.0,
"updated": updated
})
.to_string(),
);
}
}
}
}
Ok(())
}