Add interactive input to choose season on duplicated season numbers (#55, #82)

This commit is contained in:
ByteDream 2023-01-07 16:02:51 +01:00
parent 54dfe8002e
commit 7588621f34
3 changed files with 128 additions and 4 deletions

View file

@ -1,5 +1,5 @@
use crate::cli::log::tab_info;
use crate::cli::utils::{download_segments, find_resolution, FFmpegPreset};
use crate::cli::utils::{download_segments, find_resolution, FFmpegPreset, interactive_season_choosing, find_multiple_seasons_with_same_number};
use crate::utils::context::Context;
use crate::utils::format::{format_string, Format};
use crate::utils::log::progress;
@ -71,6 +71,10 @@ pub struct Download {
#[arg(value_parser = FFmpegPreset::parse)]
ffmpeg_preset: Vec<FFmpegPreset>,
#[arg(help = "Ignore interactive input")]
#[arg(short, long, default_value_t = false)]
yes: bool,
#[arg(help = "Url(s) to Crunchyroll episodes or series")]
urls: Vec<String>,
}
@ -348,6 +352,12 @@ async fn formats_from_series(
})
}
if !download.yes && !find_multiple_seasons_with_same_number(&seasons).is_empty() {
info!(target: "progress_end", "Fetched seasons");
seasons = interactive_season_choosing(seasons);
info!(target: "progress", "Fetching series details")
}
let mut formats = vec![];
for season in seasons {
if let Some(fmts) = formats_from_season(download, season, url_filter).await? {