mirror of
https://github.com/xlmnxp/blue-recorder.git
synced 2025-04-02 07:44:54 +03:00
update core
This commit is contained in:
parent
ebc930d564
commit
c3741880d8
12
Cargo.lock
generated
12
Cargo.lock
generated
@ -504,8 +504,10 @@ version = "0.1.0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"ffmpeg-sidecar",
|
"ffmpeg-sidecar",
|
||||||
|
"glib 0.10.3",
|
||||||
"libadwaita",
|
"libadwaita",
|
||||||
"open",
|
"open",
|
||||||
|
"subprocess",
|
||||||
"tempfile",
|
"tempfile",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -3721,6 +3723,16 @@ dependencies = [
|
|||||||
"syn 1.0.109",
|
"syn 1.0.109",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "subprocess"
|
||||||
|
version = "0.2.9"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0c2e86926081dda636c546d8c5e641661049d7562a68f5488be4a1f7f66f6086"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
"winapi",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "subtle"
|
name = "subtle"
|
||||||
version = "2.6.1"
|
version = "2.6.1"
|
||||||
|
@ -5,11 +5,13 @@ edition = "2021"
|
|||||||
|
|
||||||
[features]
|
[features]
|
||||||
cmd = []
|
cmd = []
|
||||||
gtk = ["dep:adw"]
|
gtk = ["dep:adw", "dep:glib", "dep:subprocess"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
adw = { version = "0.2.1", package = "libadwaita", features = ["gtk_v4_6"], optional = true }
|
adw = { version = "0.2.1", package = "libadwaita", features = ["gtk_v4_6"], optional = true }
|
||||||
anyhow = "1.0.86"
|
anyhow = "1.0.86"
|
||||||
ffmpeg-sidecar = "1.1.0"
|
ffmpeg-sidecar = "1.1.0"
|
||||||
|
glib = { version = "0.10.3", optional = true }
|
||||||
open = "5.1.4"
|
open = "5.1.4"
|
||||||
|
subprocess = {version = "0.2.6", optional = true }
|
||||||
tempfile = "3.10.1"
|
tempfile = "3.10.1"
|
||||||
|
@ -9,6 +9,15 @@ pub enum RecordMode {
|
|||||||
Window,
|
Window,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "gtk")]
|
||||||
|
// Execute command after finish recording
|
||||||
|
pub fn exec(command: &str) -> Result<()> {
|
||||||
|
if !command.trim().is_empty() {
|
||||||
|
subprocess::Exec::shell(command.trim()).popen()?;
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
// Check if tmp input video file exist
|
// Check if tmp input video file exist
|
||||||
pub fn is_input_audio_record(audio_filename: &str) -> bool {
|
pub fn is_input_audio_record(audio_filename: &str) -> bool {
|
||||||
std::path::Path::new(audio_filename).exists()
|
std::path::Path::new(audio_filename).exists()
|
||||||
@ -21,18 +30,19 @@ pub fn is_output_audio_record(audio_filename: &str) -> bool {
|
|||||||
|
|
||||||
#[cfg(feature = "gtk")]
|
#[cfg(feature = "gtk")]
|
||||||
// Overwrite file if exists or not
|
// Overwrite file if exists or not
|
||||||
pub fn is_overwrite(filename: &str, window: Window) -> bool {
|
pub fn is_overwrite(msg_bundle: &str, filename: &str, window: adw::Window) -> bool {
|
||||||
let is_file_already_exists = Path::new(filename).exists();
|
let is_file_already_exists = std::path::Path::new(filename).exists();
|
||||||
if is_file_already_exists {
|
if is_file_already_exists {
|
||||||
let message_dialog = adw::gtk::MessageDialog::new(
|
let message_dialog = adw::gtk::MessageDialog::new(
|
||||||
Some(&window),
|
Some(&window),
|
||||||
adw::gtk::DialogFlags::all(),
|
adw::gtk::DialogFlags::all(),
|
||||||
adw::gtk::MessageType::Warning,
|
adw::gtk::MessageType::Warning,
|
||||||
adw::gtk::ButtonsType::YesNo,
|
adw::gtk::ButtonsType::YesNo,
|
||||||
&&get_bundle("already-exist", None),
|
msg_bundle,
|
||||||
);
|
);
|
||||||
|
|
||||||
let main_context = glib::MainContext::default();
|
let main_context = glib::MainContext::default();
|
||||||
|
use adw::prelude::*;
|
||||||
let answer = main_context.block_on(message_dialog.run_future());
|
let answer = main_context.block_on(message_dialog.run_future());
|
||||||
message_dialog.close();
|
message_dialog.close();
|
||||||
|
|
||||||
@ -77,6 +87,7 @@ pub fn is_wayland() -> bool {
|
|||||||
.eq_ignore_ascii_case("wayland")
|
.eq_ignore_ascii_case("wayland")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "gtk")]
|
||||||
// Play recorded file
|
// Play recorded file
|
||||||
pub fn play_record(file_name: &str) -> Result<()> {
|
pub fn play_record(file_name: &str) -> Result<()> {
|
||||||
if is_snap() {
|
if is_snap() {
|
||||||
|
@ -6,7 +6,7 @@ edition = "2021"
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
anyhow = "1.0.86"
|
anyhow = "1.0.86"
|
||||||
async-std = {version = "1.12.0", features = ["attributes"]}
|
async-std = {version = "1.12.0", features = ["attributes"]}
|
||||||
blue-recorder-core = { path = "../core", features = ["cmd"] }
|
blue-recorder-core = { path = "../core", features = ["gtk"] }
|
||||||
chrono = "0.4.19"
|
chrono = "0.4.19"
|
||||||
cpal = "0.15.3"
|
cpal = "0.15.3"
|
||||||
dark-light = "1.0.0"
|
dark-light = "1.0.0"
|
||||||
|
Loading…
Reference in New Issue
Block a user