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3B73QWLYL2NWXLWAC
R7FXZ7ANRHRU3VWZOBEYSRYGEVF5YEIGLQDKFAR532DBF2I7BCBQC
KHBYSOY7O3OGZLSIYZL6XRYHPNESD7WG2IAT7JT7HBTTCZVW4WJAC
FVYGRIUYU4NXIDGD733YGWFT253T4V6EXMEM6HJMBXMNX5TPDM2AC
57DU4YHARHICJPWTTHSBB5O7MAW7GJVJUMVEREGVWEMHCGI7JMLQC
GE7XXDPC73SUY6I6F3X6I4QFQO2BCPHD4MZALYOWG7H7SRE5XAFQC
DP6ASS5FJGSZUG2B4SQOKZVHFAVZLEHFVEWBNFG3BHMC6FZAJNHQC
if let Some(ep) = Download::new(state, &podcast, episode).await? {
downloads.push(ep);
}
}
}
}
Ok(downloads)
}
pub async fn download_matching(
state: &State,
p_search: &str,
e_search: &Regex,
) -> Result<Vec<Download>> {
let re_pod = Regex::new(&format!("(?i){}", &p_search))?;
let mut downloads = vec![];
for subscription in &state.subscriptions {
if re_pod.is_match(&subscription.title) {
let podcast = Podcast::from_title(&subscription.title)?;
let mut path = utils::get_podcast_dir()?;
path.push(podcast.title());
utils::create_dir_if_not_exist(&path)?;
let episodes = podcast.episodes();
let episodes_to_download: Vec<&Episode> = episodes
.iter()
.filter(|ep| ep.title().map(|t| e_search.is_match(&t)).unwrap_or(false))
.collect();
for episode in episodes_to_download {
if String::from(ep).contains(|c| c == '-' || c == ',') {
to_download.append(&mut download::download_range(&state, podcast, ep).await?);
if let Some(pattern) = matches.value_of("pattern") {
let regex = Regex::new(pattern)?;
to_download.append(
&mut download::download_matching(&mutable_state, podcast, ®ex).await?,
)
} else if String::from(ep).contains(|c| c == '-' || c == ',') {
to_download
.append(&mut download::download_range(&mutable_state, podcast, ep).await?);
// Run CLI parser and get matches
let app = parser::get_app(VERSION);
let matches = app.get_matches();
// Run CLI parser and get matches
let app = parser::get_app(VERSION);
let matches = app.get_matches();
// Load config file
let config = Config::load()?.unwrap_or_default();
if !config.quiet.unwrap_or(false) && !is_quiet {
let path = utils::get_podcast_dir()?;
writeln!(std::io::stdout().lock(), "Using PODCAST dir: {:?}", &path).ok();
}
// Load config file
let config = Config::load()?.unwrap_or_default();
if !config.quiet.unwrap_or(false) && !is_quiet {
let path = utils::get_podcast_dir()?;
writeln!(std::io::stdout().lock(), "Using PODCAST dir: {:?}", &path).ok();
}
// Parse the state and provided arguments into a command to be run
let command = parse_command(state, matches);
// Parse the state and provided arguments into a command to be run
let command = parse_command(state, matches);