fix typo
This commit is contained in:
12
src/main.rs
12
src/main.rs
@@ -66,17 +66,17 @@ fn gmake<T: IsA<Element>>(factory_name: &str) -> Result<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct ConvertionArgs {
|
pub struct ConversionArgs {
|
||||||
rel_from_path: PathBuf,
|
rel_from_path: PathBuf,
|
||||||
transcode: config::Transcode,
|
transcode: config::Transcode,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_convertion_args(config: &Config) -> impl Iterator<Item = Result<ConvertionArgs>> + '_ {
|
fn get_conversion_args(config: &Config) -> impl Iterator<Item = Result<ConversionArgs>> + '_ {
|
||||||
walkdir::WalkDir::new(&config.from)
|
walkdir::WalkDir::new(&config.from)
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.filter_map(|e| e.ok())
|
.filter_map(|e| e.ok())
|
||||||
.filter(|e| e.file_type().is_file())
|
.filter(|e| e.file_type().is_file())
|
||||||
.map(move |e| -> Result<Option<ConvertionArgs>> {
|
.map(move |e| -> Result<Option<ConversionArgs>> {
|
||||||
let from_bytes = path_to_bytes(e.path());
|
let from_bytes = path_to_bytes(e.path());
|
||||||
|
|
||||||
let transcode = config
|
let transcode = config
|
||||||
@@ -127,7 +127,7 @@ fn get_convertion_args(config: &Config) -> impl Iterator<Item = Result<Convertio
|
|||||||
};
|
};
|
||||||
|
|
||||||
if is_newer {
|
if is_newer {
|
||||||
Ok(Some(ConvertionArgs {
|
Ok(Some(ConversionArgs {
|
||||||
rel_from_path: rel_path.to_path_buf(),
|
rel_from_path: rel_path.to_path_buf(),
|
||||||
transcode,
|
transcode,
|
||||||
}))
|
}))
|
||||||
@@ -170,7 +170,7 @@ async fn main_loop(ui_queue: ui::MsgQueue) -> Result<()> {
|
|||||||
gstreamer::init()?;
|
gstreamer::init()?;
|
||||||
let config = config::config().context("could not get the config")?;
|
let config = config::config().context("could not get the config")?;
|
||||||
|
|
||||||
let conv_args = get_convertion_args(&config)
|
let conv_args = get_conversion_args(&config)
|
||||||
.collect::<Result<Vec<_>>>()
|
.collect::<Result<Vec<_>>>()
|
||||||
.context("failed loading dir structure")?;
|
.context("failed loading dir structure")?;
|
||||||
|
|
||||||
@@ -258,7 +258,7 @@ async fn main_loop(ui_queue: ui::MsgQueue) -> Result<()> {
|
|||||||
|
|
||||||
async fn transcode(
|
async fn transcode(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
args: &ConvertionArgs,
|
args: &ConversionArgs,
|
||||||
task_id: usize,
|
task_id: usize,
|
||||||
queue: &ui::MsgQueue,
|
queue: &ui::MsgQueue,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
use crate::ConvertionArgs;
|
use crate::ConversionArgs;
|
||||||
use anyhow::{Context, Result};
|
use anyhow::{Context, Result};
|
||||||
use futures::Future;
|
use futures::Future;
|
||||||
use std::{
|
use std::{
|
||||||
@@ -14,7 +14,7 @@ pub const UPDATE_INTERVAL_MILLIS: u64 = 100;
|
|||||||
pub enum Msg {
|
pub enum Msg {
|
||||||
Init { task_len: usize, log_path: PathBuf },
|
Init { task_len: usize, log_path: PathBuf },
|
||||||
Exit,
|
Exit,
|
||||||
TaskStart { id: usize, args: ConvertionArgs },
|
TaskStart { id: usize, args: ConversionArgs },
|
||||||
TaskEnd { id: usize },
|
TaskEnd { id: usize },
|
||||||
TaskProgress { id: usize, ratio: f64 },
|
TaskProgress { id: usize, ratio: f64 },
|
||||||
TaskError { id: usize },
|
TaskError { id: usize },
|
||||||
@@ -232,7 +232,7 @@ impl State {
|
|||||||
struct Task {
|
struct Task {
|
||||||
id: usize,
|
id: usize,
|
||||||
ratio: Option<f64>,
|
ratio: Option<f64>,
|
||||||
args: ConvertionArgs,
|
args: ConversionArgs,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn init() -> (MsgQueue, impl Future<Output = Result<()>>) {
|
pub fn init() -> (MsgQueue, impl Future<Output = Result<()>>) {
|
||||||
|
|||||||
Reference in New Issue
Block a user