Add api to delete thumbnails for a file

Signed-off-by: trivernis <trivernis@protonmail.com>
pull/4/head
trivernis 3 years ago
parent 9411cbd1ab
commit cccc5ac713

@ -1,6 +1,6 @@
[package]
name = "mediarepo-api"
version = "0.11.0"
version = "0.11.1"
edition = "2018"
license = "gpl-3"

@ -146,4 +146,12 @@ where
self.emit_and_get("add_file", payload).await
}
/// Deletes all thumbnails of a file to regenerate them when requested
#[tracing::instrument(level = "debug", skip(self))]
pub async fn delete_thumbnails(&self, file_id: FileIdentifier) -> ApiResult<()> {
self.emit("delete_thumbnails", file_id).await?;
Ok(())
}
}

@ -113,6 +113,14 @@ pub async fn save_file_locally(
Ok(())
}
#[tauri::command]
pub async fn delete_thumbnail(api_state: ApiAccess<'_>, id: i64) -> PluginResult<()> {
let api = api_state.api().await?;
api.file.delete_thumbnails(FileIdentifier::ID(id)).await?;
Ok(())
}
#[tauri::command]
pub async fn resolve_paths_to_files(paths: Vec<String>) -> PluginResult<Vec<FileOSMetadata>> {
let mut files = Vec::new();

@ -53,7 +53,8 @@ impl<R: Runtime> MediarepoPlugin<R> {
update_file_name,
resolve_paths_to_files,
add_local_file,
save_file_locally
save_file_locally,
delete_thumbnail
]),
}
}

Loading…
Cancel
Save