Compare commits
5 Commits
a38e39b808
...
0.1.4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bf7d09dde0 | ||
|
|
d13266dd73 | ||
|
|
ccc4d7fbd2 | ||
|
|
48961fee2a | ||
|
|
dfbdba81a6 |
@@ -207,12 +207,14 @@ impl Inspection {
|
||||
for i in 0..unstuck_spans.len() {
|
||||
let mut span = unstuck_spans[i];
|
||||
for split in scene_splits.iter() {
|
||||
if &span.start < split && split < &span.stop { // TODO buffer
|
||||
if &(span.start + 5.0) < split && split < &(span.stop - 5.0) { // TODO const
|
||||
result.push(ContentSpan{start: span.start, stop: *split});
|
||||
span.start = *split;
|
||||
}
|
||||
}
|
||||
result.push(span); // TODO assert nontrivial
|
||||
if span.stop - span.start > 2.0 {
|
||||
result.push(span);
|
||||
}
|
||||
}
|
||||
result
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "home-video-blue-extractinator"
|
||||
version = "0.1.3"
|
||||
version = "0.1.4"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
@@ -15,7 +15,7 @@ dioxus-desktop = "0.4.3"
|
||||
[package.metadata.bundle]
|
||||
name = "home-video-blue-extractinator"
|
||||
identifier = "com.breel.home-video-blue-extractinator"
|
||||
version = "0.1.3"
|
||||
version = "0.1.4"
|
||||
copyright = "Copyright (c) breel.dev 2023. All rights reserved."
|
||||
long_description = """
|
||||
Tool to turn long home movies into clips with less noise.
|
||||
|
||||
@@ -32,11 +32,19 @@ fn App(cx: Scope) -> Element {
|
||||
let clipify_status = use_state(cx, || String::new());
|
||||
let processing = use_state(cx, || false);
|
||||
let analysis = use_state(cx, || Analysis::new());
|
||||
|
||||
let a_css = String::from_utf8_lossy(include_bytes!("./style.css"));
|
||||
let processing_css = || {
|
||||
match *processing.get() {
|
||||
true => "body { background-color: lightgray !important; opacity: 0.75 !important; }".to_string(),
|
||||
false => "".to_string(),
|
||||
}
|
||||
};
|
||||
|
||||
cx.render(rsx! {
|
||||
header {
|
||||
title { "home-video-blue-extractinator" }
|
||||
style { "{a_css}" }
|
||||
style { "{a_css} {processing_css()}" }
|
||||
}
|
||||
main {
|
||||
rsx! {
|
||||
@@ -47,10 +55,13 @@ fn App(cx: Scope) -> Element {
|
||||
r#type: "file",
|
||||
disabled: *processing.get(),
|
||||
onchange: |evt| {
|
||||
to_owned![file];
|
||||
if let Some(file_engine) = &evt.files {
|
||||
for f in &file_engine.files() {
|
||||
file.set(f.clone());
|
||||
analyze_status.set(String::new());
|
||||
clipify_status.set(String::new());
|
||||
processing.set(false);
|
||||
analysis.set(Analysis::new());
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -123,7 +134,7 @@ fn App(cx: Scope) -> Element {
|
||||
checked: a.has_content,
|
||||
name: "{a.start}..{a.stop}",
|
||||
}
|
||||
"{a.start}..{a.stop}: "
|
||||
"{a.pretty_range()}"
|
||||
br {}
|
||||
img { src: "data:image/png;base64, {a.screenshot}" }
|
||||
}
|
||||
@@ -158,12 +169,33 @@ impl Analysis {
|
||||
|
||||
#[derive(Clone)]
|
||||
struct Analyzed {
|
||||
_start: f32,
|
||||
_stop: f32,
|
||||
start: String,
|
||||
stop: String,
|
||||
screenshot: String,
|
||||
has_content: bool,
|
||||
}
|
||||
|
||||
impl Analyzed {
|
||||
fn pretty_range(&self) -> String {
|
||||
format!("{} - {}", self.pretty_t(self._start), self.pretty_t(self._stop))
|
||||
}
|
||||
|
||||
fn pretty_t(&self, t: f32) -> String {
|
||||
if t < 60.0 {
|
||||
return format!(":{:02}", t as i32);
|
||||
} else if t < 60.0 * 60.0 {
|
||||
return format!("{:02}:{:02}", (t / 60.0) as i32, (t % 60.0) as i32);
|
||||
} else {
|
||||
return format!("{:02}:{:02}:{:02}",
|
||||
(t / 60.0 / 60.0) as i32,
|
||||
(t / 60.0) as i32,
|
||||
(t % 60.0) as i32);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async fn analyze(file: String) -> Analysis {
|
||||
let content_spans = lib::video::inspect_async(&file).await;
|
||||
if content_spans.is_err() {
|
||||
@@ -188,6 +220,8 @@ async fn analyze(file: String) -> Analysis {
|
||||
let screenshot = |content_span: &lib::video::ContentSpan| -> Analyzed {
|
||||
let ts = (content_span.start + content_span.stop) / 2.0;
|
||||
Analyzed {
|
||||
_start: content_span.start,
|
||||
_stop: content_span.stop,
|
||||
start: content_span.start.to_string(),
|
||||
stop: content_span.stop.to_string(),
|
||||
screenshot: match lib::video::screenshot_png(&file, ts) {
|
||||
|
||||
Reference in New Issue
Block a user