Skip to content

Commit

Permalink
Merge pull request #47 from couleur-tweak-tips/gui
Browse files Browse the repository at this point in the history
egui
  • Loading branch information
couleurm authored Apr 16, 2024
2 parents 0caa7a2 + 065eb2e commit 8012fe0
Show file tree
Hide file tree
Showing 10 changed files with 959 additions and 148 deletions.
13 changes: 10 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ build = "build.rs"
[dependencies]
clap = {version = "4.1.4 ", features = ["derive"] } # cli arg helper
color-eyre = "0.6.2" # error handling
ffprobe = "0.3.3"
ffprobe = "0.4.0"
opener = "0.7.0" # open file with default app
rand = "0.8.5" # randomly choose from fruits for suffix
rfd = "0.11.0" # open file dialog
which = "4.4.0" # Get-Command / where.exe / which alternative
rfd = "0.14.1" # open file dialog
which = "6.0.1" # Get-Command / where.exe / which alternative

# json stuff
serde = "1.0.152"
Expand All @@ -30,6 +30,13 @@ indicatif = { version = "0.17.2", features = ["improved_unicode"] }
regex = "1.7.2"
indexmap = { version = "2.2.6", features = ["serde"] }

# gui-related
eframe = "0.27.2" # egui 'frame'work
env_logger = "0.11.3"
winit = "0.29.15" # load icon
image = "0.25.1" # load icon
copypasta = "0.10.1" # copy to clipboard

[build-dependencies]
winres = "0.1" # give the exe an icon
cc = "1.0.79" # for /src/windows.c
Expand Down
10 changes: 7 additions & 3 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use std::io::{Read, Write};
use std::{env, path::PathBuf, process::Command};

/// Smoothen up your gameplay footage with Smoothie, yum!
#[derive(Parser, Debug)]
#[clap(about, long_about = "", arg_required_else_help = true)]
#[derive(Parser, Debug, Clone)]
#[clap(about, long_about = "", arg_required_else_help = false)]
pub struct Arguments {
// io
/// Input video file paths, quoted and separated by strings
Expand Down Expand Up @@ -122,6 +122,10 @@ pub struct Arguments {
#[clap(short, long, default_value = "recipe.ini")]
pub recipe: String,

/// Specify a recipe string
#[clap(long)]
pub recipe_str: Option<String>,

/// Override recipe setting(s), e.g: --ov "flowblur;amount;40" "misc;container;MKV"
#[clap(visible_alias="ov", visible_alias="overide", long, num_args=1..)]
pub r#override: Option<Vec<String>>,
Expand Down Expand Up @@ -159,7 +163,7 @@ Arguments passed:
Note: If your PC is still going BRRR the video might still be rendering :)
Common troubleshooting errors are listed at ctt.cx/video/smoothie/troubleshooting
Common errors are listed on the troubleshooting page at ctt.cx/smoothie
If you'd like help, take a screenshot of this message and your recipe and come over to discord.gg/CTT and make a post in #support
"#))
Expand Down
47 changes: 27 additions & 20 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,21 +1,9 @@
#[macro_use] // to parse --json in video.rs
extern crate serde_derive;
extern crate clap;
extern crate serde;
extern crate serde_json;

extern crate colored;
extern crate ffprobe; // cli wrapper

// rustsynth output
extern crate anyhow;
extern crate num_rational;

// progress bar, used in ffpb.rs
extern crate regex;

mod cli;
mod cmd;
mod smgui;
// mod ffpb;
// mod ffpb2;
mod parse;
Expand All @@ -25,10 +13,23 @@ mod utils;
//mod vapoursynth;
mod video;

use crate::{cli::Arguments, cmd::SmCommand, recipe::Recipe, video::Payload};
use crate::{cli::Arguments, cmd::SmCommand, video::Payload};
use std::env;
use utils::verbosity_init;

const VIDEO_EXTENSIONS: &[&str] = &[
"mp4", "mkv", "webm", "mov", "avi", "wmv", "flv", "ts", "m3u8", "qt", "m4v",
];

const YES: &[&str] = &[
"on", "True", "true", "yes", "y", "1", "yeah", "yea", "yep", "sure", "positive",
];

const NO: &[&str] = &[
"off", "False", "false", "no", "n", "nah", "nope", "negative", "negatory", "0", "0.0", "null",
"", " ", " ", "\t", "none",
];

fn main() {
if enable_ansi_support::enable_ansi_support().is_err() {
println!("Failed enabling ANSI color support, expect broken colors!")
Expand All @@ -40,7 +41,8 @@ fn main() {
let mut args: Arguments = cli::setup_args();
// args.input is the only one being mutated in video.rs

let recipe: Recipe = recipe::get_recipe(&mut args);
// Recipe and WidgetMetadata
let (recipe, _metadata) = recipe::get_recipe(&mut args);
// mutable because args.verbose sets `[miscellaneous] always verbose:` to true
// loads defaults.ini, then overrides recipe.ini over it

Expand All @@ -62,9 +64,14 @@ fn main() {
utils::set_window_position(&recipe);
}

let payloads: Vec<Payload> = video::resolve_input(&mut args, &recipe);

let commands: Vec<SmCommand> = cmd::build_commands(args, payloads, recipe);

render::_vpipe_render2(commands);
let payloads: Vec<Payload>;
// dbg!(&_metadata);
if args.input.is_empty() {
let _result = smgui::sm_gui(recipe.clone(), _metadata, args.recipe.clone(), args);
// payloads = vec![];
} else {
payloads = video::resolve_input(&mut args, &recipe);
let commands: Vec<SmCommand> = cmd::build_commands(args, payloads, recipe);
render::vspipe_render(commands);
}
}
3 changes: 3 additions & 0 deletions src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ pub fn parse_encoding_args(args: &Arguments, rc: &Recipe) -> String {
.parent()
.unwrap()
.join("encoding_presets.ini"),
None,
&mut enc_arg_presets,
&mut None,
false,
);
// dbg!(&enc_arg_presets);

Expand Down
Loading

0 comments on commit 8012fe0

Please sign in to comment.