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