From f74bac100bbd122f0b7698e0c57d39256dc1048f Mon Sep 17 00:00:00 2001 From: trivernis Date: Sat, 8 Jan 2022 14:46:02 +0100 Subject: [PATCH] Add file metadata command Signed-off-by: trivernis --- mediarepo-api/Cargo.toml | 2 +- mediarepo-api/src/tauri_plugin/commands/file.rs | 11 +++++++++++ mediarepo-api/src/tauri_plugin/mod.rs | 3 ++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/mediarepo-api/Cargo.toml b/mediarepo-api/Cargo.toml index 27cbb04..eb88c79 100644 --- a/mediarepo-api/Cargo.toml +++ b/mediarepo-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mediarepo-api" -version = "0.24.0" +version = "0.24.1" edition = "2018" license = "gpl-3" diff --git a/mediarepo-api/src/tauri_plugin/commands/file.rs b/mediarepo-api/src/tauri_plugin/commands/file.rs index eba42ca..697f429 100644 --- a/mediarepo-api/src/tauri_plugin/commands/file.rs +++ b/mediarepo-api/src/tauri_plugin/commands/file.rs @@ -97,6 +97,17 @@ pub async fn get_file_thumbnails( Ok(thumbs) } +#[tauri::command] +pub async fn get_file_metadata( + api_state: ApiAccess<'_>, + id: i64, +) -> PluginResult { + let api = api_state.api().await?; + let metadata = api.file.get_file_metadata(FileIdentifier::ID(id)).await?; + + Ok(metadata) +} + #[tauri::command] pub async fn update_file_name( api_state: ApiAccess<'_>, diff --git a/mediarepo-api/src/tauri_plugin/mod.rs b/mediarepo-api/src/tauri_plugin/mod.rs index b4c37e2..38d84ef 100644 --- a/mediarepo-api/src/tauri_plugin/mod.rs +++ b/mediarepo-api/src/tauri_plugin/mod.rs @@ -65,7 +65,8 @@ impl MediarepoPlugin { get_all_namespaces, get_files, get_repo_metadata, - get_size + get_size, + get_file_metadata ]), } }