change default, rename flag, and use more gooder words

This commit is contained in:
kralverde 2024-01-28 15:23:23 -05:00
parent 7a91fca4e5
commit 48f37de41d

View file

@ -87,10 +87,10 @@ pub struct Archive {
pub(crate) merge: MergeBehavior, pub(crate) merge: MergeBehavior,
#[arg( #[arg(
help = "If in auto merge mode. Milliseconds if which audio track lengths are within each other, the audio merge method is used" help = "If the merge behavior is 'auto', only download multiple video tracks if their length difference is higher than the given milliseconds"
)] )]
#[arg(long, default_value_t = 1000)] #[arg(long, default_value_t = 200)]
pub(crate) audio_error: i64, pub(crate) merge_auto_tolerance: u32,
#[arg(help = format!("Presets for converting the video to a specific coding format. \ #[arg(help = format!("Presets for converting the video to a specific coding format. \
Available presets: \n {}", FFmpegPreset::available_matches_human_readable().join("\n ")))] Available presets: \n {}", FFmpegPreset::available_matches_human_readable().join("\n ")))]
@ -362,7 +362,7 @@ async fn get_format(
.collect(), .collect(),
}), }),
MergeBehavior::Auto => { MergeBehavior::Auto => {
let mut d_formats: Vec<(Duration, DownloadFormat)> = Vec::with_capacity(4); let mut d_formats: Vec<(Duration, DownloadFormat)> = vec![];
for (single_format, video, audio, subtitles) in format_pairs { for (single_format, video, audio, subtitles) in format_pairs {
let closest_format = d_formats.iter_mut().min_by(|(x, _), (y, _)| { let closest_format = d_formats.iter_mut().min_by(|(x, _), (y, _)| {
@ -378,7 +378,7 @@ async fn get_format(
.sub(single_format.duration) .sub(single_format.duration)
.abs() .abs()
.num_milliseconds() .num_milliseconds()
< archive.audio_error => < archive.merge_auto_tolerance.into() =>
{ {
// If less than `audio_error` apart, use same audio. // If less than `audio_error` apart, use same audio.
closest_format closest_format