fix clippy

This commit is contained in:
jb-alvarado 2024-09-25 18:20:48 +02:00
parent 5061f21376
commit 5d601844e3
5 changed files with 19 additions and 20 deletions

View File

@ -75,7 +75,7 @@ pub fn ingest_server(
let vtt_dummy = config
.channel
.storage_path
.join(&config.processing.vtt_dummy.clone().unwrap_or_default());
.join(config.processing.vtt_dummy.clone().unwrap_or_default());
if let Some(ingest_input_cmd) = config.advanced.ingest.input_cmd {
server_cmd.append(&mut ingest_input_cmd.clone());

View File

@ -640,14 +640,14 @@ pub fn gen_source(
.filter(|c| IMAGE_FORMAT.contains(&c.as_str()))
.is_some()
{
node.cmd = Some(loop_image(&config, &node));
node.cmd = Some(loop_image(config, &node));
} else {
if node.seek > 0.0 && node.out > node.duration {
warn!(target: Target::file_mail(), channel = config.general.channel_id; "Clip loops and has seek value: duplicate clip to separate loop and seek.");
duplicate_for_seek_and_loop(&mut node, &manager.current_list);
}
node.cmd = Some(seek_and_length(&config, &mut node));
node.cmd = Some(seek_and_length(config, &mut node));
}
} else {
trace!("clip index: {node_index} | last index: {last_index}");
@ -694,7 +694,7 @@ pub fn gen_source(
node.seek = 0.0;
node.out = filler_media.out;
node.duration = filler_media.duration;
node.cmd = Some(loop_filler(&config, &node));
node.cmd = Some(loop_filler(config, &node));
node.probe = filler_media.probe;
} else {
match MediaProbe::new(&config.storage.filler_path.to_string_lossy()) {
@ -715,7 +715,7 @@ pub fn gen_source(
.clone()
.to_string_lossy()
.to_string();
node.cmd = Some(loop_image(&config, &node));
node.cmd = Some(loop_image(config, &node));
node.probe = Some(probe);
} else if let Some(filler_duration) = probe
.clone()
@ -739,7 +739,7 @@ pub fn gen_source(
node.seek = 0.0;
node.out = filler_out;
node.duration = filler_duration;
node.cmd = Some(loop_filler(&config, &node));
node.cmd = Some(loop_filler(config, &node));
node.probe = Some(probe);
} else {
// Create colored placeholder.

View File

@ -66,7 +66,7 @@ fn ingest_to_hls_server(manager: ChannelManager) -> Result<(), ProcessError> {
let vtt_dummy = config
.channel
.storage_path
.join(&config.processing.vtt_dummy.clone().unwrap_or_default());
.join(config.processing.vtt_dummy.clone().unwrap_or_default());
if vtt_dummy.is_file() {
server_prefix.append(&mut vec_strings!["-i", vtt_dummy.to_string_lossy()]);

View File

@ -151,10 +151,12 @@ pub fn player(manager: ChannelManager) -> Result<(), ProcessError> {
}
if config.processing.vtt_enable && dec_cmd.iter().any(|s| s.ends_with(".vtt")) {
let mut i = dec_cmd.iter().filter(|&n| &*n == "-i").count();
if i > 0 {
i -= 1
}
let i = dec_cmd
.iter()
.filter(|&n| n == "-i")
.count()
.saturating_sub(1);
dec_cmd.append(&mut vec_strings!("-map", format!("{i}:s"), "-c:s", "copy"));
}

View File

@ -70,7 +70,7 @@ pub fn prepare_output_cmd(
let vtt_dummy = config
.channel
.storage_path
.join(&config.processing.vtt_dummy.clone().unwrap_or_default());
.join(config.processing.vtt_dummy.clone().unwrap_or_default());
if let Some(mut filter) = filters.clone() {
for (i, param) in output_params.iter().enumerate() {
@ -124,10 +124,7 @@ pub fn prepare_output_cmd(
}
if config.processing.vtt_enable && vtt_dummy.is_file() {
let mut i = cmd.iter().filter(|&n| &*n == "-i").count();
if i > 0 {
i -= 1
}
let i = cmd.iter().filter(|&n| n == "-i").count().saturating_sub(1);
cmd.append(&mut vec_strings!("-map", format!("{i}:s?")));
}
@ -626,7 +623,7 @@ pub fn loop_image(config: &PlayoutConfig, node: &Media) -> Vec<String> {
let vtt_dummy = config
.channel
.storage_path
.join(&config.processing.vtt_dummy.clone().unwrap_or_default());
.join(config.processing.vtt_dummy.clone().unwrap_or_default());
if vtt_file.is_file() {
source_cmd.append(&mut vec_strings![
@ -661,7 +658,7 @@ pub fn loop_filler(config: &PlayoutConfig, node: &Media) -> Vec<String> {
let vtt_dummy = config
.channel
.storage_path
.join(&config.processing.vtt_dummy.clone().unwrap_or_default());
.join(config.processing.vtt_dummy.clone().unwrap_or_default());
if vtt_file.is_file() {
if loop_count > 1 {
@ -733,7 +730,7 @@ pub fn seek_and_length(config: &PlayoutConfig, node: &mut Media) -> Vec<String>
let vtt_dummy = config
.channel
.storage_path
.join(&config.processing.vtt_dummy.clone().unwrap_or_default());
.join(config.processing.vtt_dummy.clone().unwrap_or_default());
if vtt_file.is_file() {
if loop_count > 1 {
@ -778,7 +775,7 @@ pub fn gen_dummy(config: &PlayoutConfig, duration: f64) -> (String, Vec<String>)
let vtt_dummy = config
.channel
.storage_path
.join(&config.processing.vtt_dummy.clone().unwrap_or_default());
.join(config.processing.vtt_dummy.clone().unwrap_or_default());
if vtt_dummy.is_file() {
source_cmd.append(&mut vec_strings!["-i", vtt_dummy.to_string_lossy()]);