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:
@ -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(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user