Implement video thumbnail generation and Windows 11 UI
This commit is contained in:
1 parent
a1af08aa00
commit
74dd0a9cf5
8 files changed
+229
-37
No files matched your search
@@ -1,12 +1,20 @@
|
||||
mod media;
|
||||
mod thumbnails;
|
||||
|
||||
use media::{list_files, FileInfo};
|
||||
use thumbnails::{ThumbnailCache, get_thumbnail};
|
||||
use tauri::State;
|
||||
|
||||
#[tauri::command]
|
||||
async fn list_files_command(dir_path: String) -> Result<Vec<FileInfo>, String> {
|
||||
list_files(&dir_path).map_err(|e| e.to_string())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
async fn get_thumbnail_command(path: String, cache: State<'_, ThumbnailCache>) -> Result<String, String> {
|
||||
get_thumbnail(&path, cache.inner()).await.map_err(|e| e.to_string())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
fn greet(name: &str) -> String {
|
||||
format!("Hello, {}! You've been greeted from Rust!", name)
|
||||
@@ -17,7 +25,8 @@ pub fn run() {
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_opener::init())
|
||||
.plugin(tauri_plugin_dialog::init())
|
||||
.invoke_handler(tauri::generate_handler![greet, list_files_command])
|
||||
.manage(ThumbnailCache::default())
|
||||
.invoke_handler(tauri::generate_handler![greet, list_files_command, get_thumbnail_command])
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
Reference in new issue
Block a user