Rename --sync-tolerance to --merge-sync-tolerance and --merge-sync-precision to --merge-sync-precision

This commit is contained in:
bytedream 2024-05-04 23:08:55 +02:00
parent 757d3094ea
commit dad91dba91
3 changed files with 20 additions and 20 deletions

View file

@ -482,14 +482,14 @@ The `archive` command lets you download episodes with multiple audios and subtit
Default are `200` milliseconds. Default are `200` milliseconds.
- <span id="archive-sync-tolerance">Sync tolerance</span> - <span id="archive-merge-sync-tolerance">Merge sync tolerance</span>
Sometimes two video tracks are downloaded with `--merge` set to `sync` because the audio fingerprinting fails to identify matching audio parts (e.g. opening). Sometimes two video tracks are downloaded with `--merge` set to `sync` because the audio fingerprinting fails to identify matching audio parts (e.g. opening).
To prevent this, you can use the `--sync-tolerance` flag to specify the difference by which two fingerprints are considered equal. To prevent this, you can use the `--merge-sync-tolerance` flag to specify the difference by which two fingerprints are considered equal.
Default is `6`. Default is `6`.
- <span id="archive-sync-precision">Sync precision</span> - <span id="archive-merge-sync-precision">Merge sync precision</span>
If you use `--merge` set to `sync` and the syncing seems to be not accurate enough or takes to long, you can use the `--sync-precision` flag to specify the amount of offset determination runs from which the final offset is calculated. If you use `--merge` set to `sync` and the syncing seems to be not accurate enough or takes to long, you can use the `--sync-precision` flag to specify the amount of offset determination runs from which the final offset is calculated.

View file

@ -109,12 +109,12 @@ pub struct Archive {
help = "If the merge behavior is 'sync', specify the difference by which two fingerprints are considered equal, higher values can help when the algorithm fails" help = "If the merge behavior is 'sync', specify the difference by which two fingerprints are considered equal, higher values can help when the algorithm fails"
)] )]
#[arg(long, default_value_t = 6)] #[arg(long, default_value_t = 6)]
pub(crate) sync_tolerance: u32, pub(crate) merge_sync_tolerance: u32,
#[arg( #[arg(
help = "If the merge behavior is 'sync', specify the amount of offset determination runs from which the final offset is calculated, higher values will increase the time required but lead to more precise offsets" help = "If the merge behavior is 'sync', specify the amount of offset determination runs from which the final offset is calculated, higher values will increase the time required but lead to more precise offsets"
)] )]
#[arg(long, default_value_t = 4)] #[arg(long, default_value_t = 4)]
pub(crate) sync_precision: u32, pub(crate) merge_sync_precision: u32,
#[arg( #[arg(
help = "Specified which language tagging the audio and subtitle tracks and language specific format options should have. \ help = "Specified which language tagging the audio and subtitle tracks and language specific format options should have. \
@ -308,12 +308,12 @@ impl Execute for Archive {
.audio_sort(Some(self.audio.clone())) .audio_sort(Some(self.audio.clone()))
.subtitle_sort(Some(self.subtitle.clone())) .subtitle_sort(Some(self.subtitle.clone()))
.no_closed_caption(self.no_closed_caption) .no_closed_caption(self.no_closed_caption)
.sync_tolerance(match self.merge { .merge_sync_tolerance(match self.merge {
MergeBehavior::Sync => Some(self.sync_tolerance), MergeBehavior::Sync => Some(self.merge_sync_tolerance),
_ => None, _ => None,
}) })
.sync_precision(match self.merge { .merge_sync_precision(match self.merge {
MergeBehavior::Sync => Some(self.sync_precision), MergeBehavior::Sync => Some(self.merge_sync_precision),
_ => None, _ => None,
}) })
.threads(self.threads) .threads(self.threads)

View file

@ -64,8 +64,8 @@ pub struct DownloadBuilder {
force_hardsub: bool, force_hardsub: bool,
download_fonts: bool, download_fonts: bool,
no_closed_caption: bool, no_closed_caption: bool,
sync_tolerance: Option<u32>, merge_sync_tolerance: Option<u32>,
sync_precision: Option<u32>, merge_sync_precision: Option<u32>,
threads: usize, threads: usize,
ffmpeg_threads: Option<usize>, ffmpeg_threads: Option<usize>,
audio_locale_output_map: HashMap<Locale, String>, audio_locale_output_map: HashMap<Locale, String>,
@ -85,8 +85,8 @@ impl DownloadBuilder {
force_hardsub: false, force_hardsub: false,
download_fonts: false, download_fonts: false,
no_closed_caption: false, no_closed_caption: false,
sync_tolerance: None, merge_sync_tolerance: None,
sync_precision: None, merge_sync_precision: None,
threads: num_cpus::get(), threads: num_cpus::get(),
ffmpeg_threads: None, ffmpeg_threads: None,
audio_locale_output_map: HashMap::new(), audio_locale_output_map: HashMap::new(),
@ -108,8 +108,8 @@ impl DownloadBuilder {
download_fonts: self.download_fonts, download_fonts: self.download_fonts,
no_closed_caption: self.no_closed_caption, no_closed_caption: self.no_closed_caption,
sync_tolerance: self.sync_tolerance, merge_sync_tolerance: self.merge_sync_tolerance,
sync_precision: self.sync_precision, merge_sync_precision: self.merge_sync_precision,
download_threads: self.threads, download_threads: self.threads,
ffmpeg_threads: self.ffmpeg_threads, ffmpeg_threads: self.ffmpeg_threads,
@ -168,8 +168,8 @@ pub struct Downloader {
download_fonts: bool, download_fonts: bool,
no_closed_caption: bool, no_closed_caption: bool,
sync_tolerance: Option<u32>, merge_sync_tolerance: Option<u32>,
sync_precision: Option<u32>, merge_sync_precision: Option<u32>,
download_threads: usize, download_threads: usize,
ffmpeg_threads: Option<usize>, ffmpeg_threads: Option<usize>,
@ -287,13 +287,13 @@ impl Downloader {
} }
} }
if self.formats.len() > 1 && self.sync_tolerance.is_some() { if self.formats.len() > 1 && self.merge_sync_tolerance.is_some() {
let _progress_handler = let _progress_handler =
progress!("Syncing video start times (this might take some time)"); progress!("Syncing video start times (this might take some time)");
let mut offsets = sync_audios( let mut offsets = sync_audios(
&raw_audios, &raw_audios,
self.sync_tolerance.unwrap(), self.merge_sync_tolerance.unwrap(),
self.sync_precision.unwrap(), self.merge_sync_precision.unwrap(),
)?; )?;
drop(_progress_handler); drop(_progress_handler);