parent
62eefeea0f
commit
84b9ac781d
File diff suppressed because it is too large
Load Diff
|
|
@ -1,5 +1,5 @@
|
|||
[package]
|
||||
name = "pa-home-video-blue-extractinator-2-ui"
|
||||
name = "pa-home-video-blue-extractinator-ui"
|
||||
version = "0.0.0"
|
||||
edition = "2021"
|
||||
|
||||
|
|
@ -12,6 +12,7 @@ serde-wasm-bindgen = "0.6"
|
|||
wasm-bindgen = { version = "0.2", features = ["serde-serialize"] }
|
||||
wasm-bindgen-futures = "0.4"
|
||||
js-sys = "0.3"
|
||||
tauri-api = "0.7.6"
|
||||
|
||||
[workspace]
|
||||
members = ["src-tauri"]
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
FROM rust
|
||||
|
||||
RUN apt update && cargo install tauri-cli
|
||||
RUN cargo install trunk
|
||||
|
||||
ENTRYPOINT []
|
||||
CMD []
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
pub mod video;
|
||||
use std::path::Path;
|
||||
|
||||
pub fn analyze(file: &str) -> String {
|
||||
match _analyze(file) {
|
||||
|
|
@ -21,5 +22,9 @@ pub fn clipify(file: &str) -> String {
|
|||
|
||||
fn _clipify(file: &str) -> Result<String, String> {
|
||||
eprintln!("clipifying {}", file);
|
||||
Err(format!("not impl"))
|
||||
let files = video::clipify(&file.to_string())?;
|
||||
match files.iter().nth(0) {
|
||||
Some(file) => Ok(Path::new(file).parent().unwrap().to_str().unwrap().to_string()),
|
||||
None => Err(format!("no clips found from {}", file)),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ impl Inspection {
|
|||
.filter(|x| (*x).contains("start: "))
|
||||
.filter(|x| (*x).contains("bitrate: "))
|
||||
.nth(0)
|
||||
.unwrap()
|
||||
.expect("did not find duration from ffmpeg")
|
||||
.split(",").nth(0).unwrap()
|
||||
.split(": ").nth(1).unwrap();
|
||||
let pieces: Vec<_> = ts.split(":")
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
[package]
|
||||
name = "pa-home-video-blue-extractinator-2"
|
||||
name = "pa-home-video-blue-extractinator"
|
||||
version = "0.0.0"
|
||||
description = "A Tauri App"
|
||||
authors = ["you"]
|
||||
|
|
@ -14,7 +14,7 @@ tauri-build = { version = "1.5", features = [] }
|
|||
|
||||
[dependencies]
|
||||
lib = { path = "../src-lib" }
|
||||
tauri = { version = "1.5", features = ["shell-open"] }
|
||||
tauri = { version = "1.5", features = [ "dialog-open", "shell-open"] }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
"withGlobalTauri": true
|
||||
},
|
||||
"package": {
|
||||
"productName": "pa-home-video-blue-extractinator-2",
|
||||
"productName": "pa-home-video-blue-extractinator",
|
||||
"version": "0.0.0"
|
||||
},
|
||||
"tauri": {
|
||||
|
|
@ -16,12 +16,15 @@
|
|||
"shell": {
|
||||
"all": false,
|
||||
"open": true
|
||||
},
|
||||
"dialog": {
|
||||
"open": true
|
||||
}
|
||||
},
|
||||
"bundle": {
|
||||
"active": true,
|
||||
"targets": "all",
|
||||
"identifier": "com.tauri.dev",
|
||||
"identifier": "com.breel.pa-home-video-blue-extractinator",
|
||||
"icon": [
|
||||
"icons/32x32.png",
|
||||
"icons/128x128.png",
|
||||
|
|
|
|||
17
src/app.rs
17
src/app.rs
|
|
@ -3,6 +3,7 @@ use leptos::*;
|
|||
use serde::{Deserialize, Serialize};
|
||||
use serde_wasm_bindgen::to_value;
|
||||
use wasm_bindgen::prelude::*;
|
||||
use tauri_api::dialog::{select, Response};
|
||||
|
||||
use lib;
|
||||
|
||||
|
|
@ -32,6 +33,17 @@ pub fn App() -> impl IntoView {
|
|||
|
||||
let noop = move |ev: ev::SubmitEvent| { ev.prevent_default(); };
|
||||
|
||||
let select_file = move |ev: ev::MouseEvent| {
|
||||
ev.prevent_default();
|
||||
match select(None, None) {
|
||||
Ok(response) => match response {
|
||||
Response::Okay(s) => { set_file.set(s) },
|
||||
_ => {},
|
||||
},
|
||||
Err(msg) => set_err.set(format!("failed to select a file: {}", msg)),
|
||||
};
|
||||
};
|
||||
|
||||
let analyze = move |ev: ev::MouseEvent| {
|
||||
ev.prevent_default();
|
||||
spawn_local(async move {
|
||||
|
|
@ -68,10 +80,7 @@ pub fn App() -> impl IntoView {
|
|||
<main class="container">
|
||||
<div class="row">
|
||||
<form class="row" on:submit=noop>
|
||||
<input
|
||||
type="file"
|
||||
on:input=update_file
|
||||
/>
|
||||
<p id="file_selection" on:click=select_file>{ move || file.get() }</p>
|
||||
<button type="submit" on:click=analyze>"Analyze"</button>
|
||||
<button type="button" on:click=clipify>"Clipify"</button>
|
||||
</form>
|
||||
|
|
|
|||
Loading…
Reference in New Issue