T-031: Lesezeichen mit Notiz — bookmarks.json, Panel in der Leiste (Sprung, Notiz editieren, delete)

This commit is contained in:
2026-11-06 20:36:38 +01:00
parent bb1fea60df
commit 06ac4ebd11
7 changed files with 275 additions and 1 deletions

View File

@ -1,4 +1,5 @@
mod audible;
mod bookmarks;
mod download;
mod player;
@ -162,6 +163,45 @@ async fn player_stop(pl: tauri::State<'_, SharedPlayer>) -> Result<PlayerState,
.map_err(|e| format!("Hintergrundthread fehlgeschlagen: {e}"))?
}
#[tauri::command]
async fn bookmark_list(asin: String) -> Result<Vec<bookmarks::Bookmark>, String> {
tauri::async_runtime::spawn_blocking(move || bookmarks::list(&asin))
.await
.map_err(|e| format!("Hintergrundthread fehlgeschlagen: {e}"))?
}
#[tauri::command]
async fn bookmark_add(
asin: String,
time: f64,
note: String,
) -> Result<Vec<bookmarks::Bookmark>, String> {
tauri::async_runtime::spawn_blocking(move || bookmarks::add(&asin, time, &note))
.await
.map_err(|e| format!("Hintergrundthread fehlgeschlagen: {e}"))?
}
#[tauri::command]
async fn bookmark_remove(
asin: String,
index: usize,
) -> Result<Vec<bookmarks::Bookmark>, String> {
tauri::async_runtime::spawn_blocking(move || bookmarks::remove(&asin, index))
.await
.map_err(|e| format!("Hintergrundthread fehlgeschlagen: {e}"))?
}
#[tauri::command]
async fn bookmark_set_note(
asin: String,
index: usize,
note: String,
) -> Result<Vec<bookmarks::Bookmark>, String> {
tauri::async_runtime::spawn_blocking(move || bookmarks::set_note(&asin, index, &note))
.await
.map_err(|e| format!("Hintergrundthread fehlgeschlagen: {e}"))?
}
#[tauri::command]
async fn player_snapshot(pl: tauri::State<'_, SharedPlayer>) -> Result<PlayerState, String> {
let p = pl.inner().clone();
@ -212,6 +252,10 @@ pub fn run() {
player_set_speed,
player_stop,
player_snapshot,
bookmark_list,
bookmark_add,
bookmark_remove,
bookmark_set_note,
download_list,
download_enqueue,
download_cancel,