validate config regex
This commit is contained in:
parent
aeb2ff5d4e
commit
c939df891f
@ -152,11 +152,8 @@ pub fn prepare_output_cmd(
|
||||
let re_multi = Regex::new(r"\[[\w:_-]+\]\[[\w:_-]+\]").unwrap();
|
||||
|
||||
if let Some(mut filter) = filters.clone() {
|
||||
// Loop over output parameters
|
||||
//
|
||||
// Check if it contains a filtergraph, count its outputs and set correct mapping values.
|
||||
// Check if it contains a filtergraph and set correct output mapping.
|
||||
for (i, param) in output_params.iter().enumerate() {
|
||||
// Skip filter command, to concat existing filters with new ones.
|
||||
if param != "-filter_complex" {
|
||||
if i > 0 && output_params[i - 1] == "-filter_complex" {
|
||||
output_filter = param.clone();
|
||||
|
@ -1,4 +1,5 @@
|
||||
use std::{
|
||||
ffi::OsStr,
|
||||
path::Path,
|
||||
sync::{Arc, Mutex},
|
||||
};
|
||||
@ -27,11 +28,16 @@ pub fn filter_node(
|
||||
// TODO: in Rust 1.65 use let_chains instead
|
||||
if config.text.text_from_filename && node.is_some() {
|
||||
let source = node.unwrap_or(&Media::new(0, "", false)).source.clone();
|
||||
let regex: Regex = Regex::new(&config.text.regex).unwrap();
|
||||
|
||||
let text: String = match regex.captures(&source) {
|
||||
let text = match Regex::new(&config.text.regex)
|
||||
.ok()
|
||||
.and_then(|r| r.captures(&source))
|
||||
{
|
||||
Some(t) => t[1].to_string(),
|
||||
None => source,
|
||||
None => Path::new(&source)
|
||||
.file_stem()
|
||||
.unwrap_or_else(|| OsStr::new(&source))
|
||||
.to_string_lossy()
|
||||
.to_string(),
|
||||
};
|
||||
|
||||
let escape = text
|
||||
|
Loading…
x
Reference in New Issue
Block a user