Compare commits

..

No commits in common. "1cfa3bbb1b5ea845b3e4c51eba269745f0c3e271" and "9d61234c939d0f670ecec943316386704c79e34a" have entirely different histories.

3 changed files with 11 additions and 17 deletions

View File

@ -16,7 +16,7 @@ pub fn initialize() -> PathBuf {
if !&config_path.exists() { if !&config_path.exists() {
let config_directories = &mut config_path.to_owned(); let config_directories = &mut config_path.to_owned();
config_directories.pop(); config_directories.pop();
std::fs::create_dir_all(config_directories).unwrap_or_default(); std::fs::create_dir_all(&config_directories).unwrap_or_default();
std::fs::File::create(&config_path).unwrap(); std::fs::File::create(&config_path).unwrap();
default(); default();
} else { } else {

View File

@ -2,7 +2,6 @@ extern crate subprocess;
use crate::utils::{is_snap, is_wayland}; use crate::utils::{is_snap, is_wayland};
use crate::wayland_record::{CursorModeTypes, RecordTypes, WaylandRecorder}; use crate::wayland_record::{CursorModeTypes, RecordTypes, WaylandRecorder};
use chrono::prelude::*; use chrono::prelude::*;
use filename::Filename;
use gettextrs::gettext; use gettextrs::gettext;
use gtk::{prelude::*, ResponseType}; use gtk::{prelude::*, ResponseType};
use gtk::{ButtonsType, DialogFlags, MessageDialog, MessageType}; use gtk::{ButtonsType, DialogFlags, MessageDialog, MessageType};
@ -15,6 +14,7 @@ use std::sync::mpsc::Sender;
use std::thread::sleep; use std::thread::sleep;
use std::time::Duration; use std::time::Duration;
use subprocess::Exec; use subprocess::Exec;
use filename::Filename;
#[derive(Clone)] #[derive(Clone)]
pub struct Ffmpeg { pub struct Ffmpeg {
@ -144,17 +144,8 @@ impl Ffmpeg {
} else if self.record_video.is_active() && is_wayland() { } else if self.record_video.is_active() && is_wayland() {
sleep(Duration::from_secs(self.record_delay.value() as u64)); sleep(Duration::from_secs(self.record_delay.value() as u64));
let tempfile = tempfile::NamedTempFile::new() let tempfile = tempfile::NamedTempFile::new().expect("cannot create temp file").keep().expect("cannot keep temp file");
.expect("cannot create temp file") self.temp_video_filename = tempfile.0.file_name().expect("cannot get file name").to_str().unwrap().to_string();
.keep()
.expect("cannot keep temp file");
self.temp_video_filename = tempfile
.0
.file_name()
.expect("cannot get file name")
.to_str()
.unwrap()
.to_string();
let record_window = self.record_window.take(); let record_window = self.record_window.take();
self.record_window.replace(record_window); self.record_window.replace(record_window);
@ -184,7 +175,7 @@ impl Ffmpeg {
ffmpeg_command.arg("-f"); ffmpeg_command.arg("-f");
ffmpeg_command.arg("pulse"); ffmpeg_command.arg("pulse");
ffmpeg_command.arg("-i"); ffmpeg_command.arg("-i");
ffmpeg_command.arg(self.audio_id.active_id().unwrap()); ffmpeg_command.arg(&self.audio_id.active_id().unwrap());
ffmpeg_command.arg("-f"); ffmpeg_command.arg("-f");
ffmpeg_command.arg("ogg"); ffmpeg_command.arg("ogg");
ffmpeg_command.arg(format!( ffmpeg_command.arg(format!(
@ -253,7 +244,9 @@ impl Ffmpeg {
let audio_filename = format!("{}.temp.audio", self.saved_filename.as_ref().unwrap()); let audio_filename = format!("{}.temp.audio", self.saved_filename.as_ref().unwrap());
let is_video_record = { std::path::Path::new(video_filename.as_str()).exists() }; let is_video_record = {
std::path::Path::new(video_filename.as_str()).exists()
};
let is_audio_record = std::path::Path::new(audio_filename.as_str()).exists(); let is_audio_record = std::path::Path::new(audio_filename.as_str()).exists();
if is_video_record { if is_video_record {
@ -262,7 +255,8 @@ impl Ffmpeg {
Command::new("ffmpeg") Command::new("ffmpeg")
.args([ .args([
"-i", "-i",
self.temp_video_filename.as_str(), self.temp_video_filename
.as_str(),
"-crf", "-crf",
"23", // default quality "23", // default quality
"-c:a", "-c:a",

View File

@ -577,7 +577,7 @@ pub fn build_ui(application: &Application) {
.unwrap(); .unwrap();
} }
let logo = Image::from_file(about_icon_path.to_str().unwrap()); let logo = Image::from_file(&about_icon_path.to_str().unwrap());
about_dialog.set_transient_for(Some(&main_window)); about_dialog.set_transient_for(Some(&main_window));
about_dialog.set_program_name(Some(&gettext("Blue Recorder"))); about_dialog.set_program_name(Some(&gettext("Blue Recorder")));
about_dialog.set_version(Some("0.2.0")); about_dialog.set_version(Some("0.2.0"));