mirror of
https://github.com/crunchy-labs/crunchy-cli.git
synced 2026-01-21 04:02:00 -06:00
Apply lints
This commit is contained in:
parent
4066b8511c
commit
f77804fcb5
3 changed files with 15 additions and 35 deletions
|
|
@ -393,7 +393,7 @@ impl Execute for Archive {
|
||||||
|| (method_subtitle && subtitle_differ)
|
|| (method_subtitle && subtitle_differ)
|
||||||
{
|
{
|
||||||
skip = false;
|
skip = false;
|
||||||
path = formatted_path.clone()
|
path.clone_from(&formatted_path)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@ use std::collections::{BTreeMap, HashMap};
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::process::{Command, Stdio};
|
use std::process::{Command, Stdio};
|
||||||
use std::str::FromStr;
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use std::{env, fs};
|
use std::{env, fs};
|
||||||
|
|
@ -731,7 +730,7 @@ impl Downloader {
|
||||||
output_presets.remove(i - remove_count);
|
output_presets.remove(i - remove_count);
|
||||||
remove_count += 1;
|
remove_count += 1;
|
||||||
}
|
}
|
||||||
last = s.clone();
|
last.clone_from(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
output_presets.extend([
|
output_presets.extend([
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
|
use std::fmt;
|
||||||
|
use std::fmt::Formatter;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
pub const SOFTSUB_CONTAINERS: [&str; 3] = ["mkv", "mov", "mp4"];
|
pub const SOFTSUB_CONTAINERS: [&str; 3] = ["mkv", "mov", "mp4"];
|
||||||
|
|
@ -33,11 +35,11 @@ macro_rules! ffmpeg_enum {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ToString for $name {
|
impl fmt::Display for $name {
|
||||||
fn to_string(&self) -> String {
|
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
$(
|
$(
|
||||||
&$name::$field => stringify!($field).to_string().to_lowercase()
|
&$name::$field => write!(f, "{}", stringify!($field).to_string().to_lowercase())
|
||||||
),*
|
),*
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -135,23 +137,16 @@ impl FFmpegPreset {
|
||||||
for (codec, hwaccel, quality) in FFmpegPreset::available_matches() {
|
for (codec, hwaccel, quality) in FFmpegPreset::available_matches() {
|
||||||
let mut description_details = vec![];
|
let mut description_details = vec![];
|
||||||
if let Some(h) = &hwaccel {
|
if let Some(h) = &hwaccel {
|
||||||
description_details.push(format!("{} hardware acceleration", h.to_string()))
|
description_details.push(format!("{h} hardware acceleration"))
|
||||||
}
|
}
|
||||||
if let Some(q) = &quality {
|
if let Some(q) = &quality {
|
||||||
description_details.push(format!("{} video quality/compression", q.to_string()))
|
description_details.push(format!("{q} video quality/compression"))
|
||||||
}
|
}
|
||||||
|
|
||||||
let description = if description_details.is_empty() {
|
let description = if description_details.is_empty() {
|
||||||
format!(
|
format!("{codec} encoded with default video quality/compression",)
|
||||||
"{} encoded with default video quality/compression",
|
|
||||||
codec.to_string()
|
|
||||||
)
|
|
||||||
} else if description_details.len() == 1 {
|
} else if description_details.len() == 1 {
|
||||||
format!(
|
format!("{} encoded with {}", codec, description_details[0])
|
||||||
"{} encoded with {}",
|
|
||||||
codec.to_string(),
|
|
||||||
description_details[0]
|
|
||||||
)
|
|
||||||
} else {
|
} else {
|
||||||
let first = description_details.remove(0);
|
let first = description_details.remove(0);
|
||||||
let last = description_details.remove(description_details.len() - 1);
|
let last = description_details.remove(description_details.len() - 1);
|
||||||
|
|
@ -161,13 +156,7 @@ impl FFmpegPreset {
|
||||||
"".to_string()
|
"".to_string()
|
||||||
};
|
};
|
||||||
|
|
||||||
format!(
|
format!("{codec} encoded with {first}{mid} and {last}",)
|
||||||
"{} encoded with {}{} and {}",
|
|
||||||
codec.to_string(),
|
|
||||||
first,
|
|
||||||
mid,
|
|
||||||
last
|
|
||||||
)
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return_values.push(format!(
|
return_values.push(format!(
|
||||||
|
|
@ -201,11 +190,7 @@ impl FFmpegPreset {
|
||||||
.find(|p| p.to_string() == token.to_lowercase())
|
.find(|p| p.to_string() == token.to_lowercase())
|
||||||
{
|
{
|
||||||
if let Some(cc) = codec {
|
if let Some(cc) = codec {
|
||||||
return Err(format!(
|
return Err(format!("cannot use multiple codecs (found {cc} and {c})",));
|
||||||
"cannot use multiple codecs (found {} and {})",
|
|
||||||
cc.to_string(),
|
|
||||||
c.to_string()
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
codec = Some(c)
|
codec = Some(c)
|
||||||
} else if let Some(h) = FFmpegHwAccel::all()
|
} else if let Some(h) = FFmpegHwAccel::all()
|
||||||
|
|
@ -214,9 +199,7 @@ impl FFmpegPreset {
|
||||||
{
|
{
|
||||||
if let Some(hh) = hwaccel {
|
if let Some(hh) = hwaccel {
|
||||||
return Err(format!(
|
return Err(format!(
|
||||||
"cannot use multiple hardware accelerations (found {} and {})",
|
"cannot use multiple hardware accelerations (found {hh} and {h})",
|
||||||
hh.to_string(),
|
|
||||||
h.to_string()
|
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
hwaccel = Some(h)
|
hwaccel = Some(h)
|
||||||
|
|
@ -226,9 +209,7 @@ impl FFmpegPreset {
|
||||||
{
|
{
|
||||||
if let Some(qq) = quality {
|
if let Some(qq) = quality {
|
||||||
return Err(format!(
|
return Err(format!(
|
||||||
"cannot use multiple ffmpeg preset qualities (found {} and {})",
|
"cannot use multiple ffmpeg preset qualities (found {qq} and {q})",
|
||||||
qq.to_string(),
|
|
||||||
q.to_string()
|
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
quality = Some(q)
|
quality = Some(q)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue