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HYOMBWNNJNPC6SG2UUCCZRIIXDMXJYDQC
ZYS43ILR4OXI7S2AYNGYSTK3IU2UVELIWVCCWDS7RVZQDSNJMDHQC
H5MQEP35FJNDLARTAB7J5GEHRNBSL6RTHFUGURG5HIVGLCG4FGUAC
for subscription in &state.subscriptions {
if re_pod.is_match(&subscription.title) {
let podcast = Podcast::from_title(&subscription.title)
.chain_err(|| UNABLE_TO_RETRIEVE_PODCAST_BY_TITLE)?;
let episodes = podcast.episodes();
episodes[episodes.len() - ep_num]
.download(podcast.title())
.chain_err(|| "unable to download episode")?;
if let Ok(ep_num) = e_search.parse::<usize>() {
for subscription in &state.subscriptions {
if re_pod.is_match(&subscription.title) {
let podcast = Podcast::from_title(&subscription.title)
.chain_err(|| UNABLE_TO_RETRIEVE_PODCAST_BY_TITLE)?;
let episodes = podcast.episodes();
episodes[episodes.len() - ep_num]
.download(podcast.title())
.chain_err(|| "unable to download episode")?;
}
let ep_num: usize = ep_num_string.parse::<usize>().unwrap();
let mut path: PathBuf = get_xml_dir()?;
if let Err(err) = DirBuilder::new().recursive(true).create(&path) {
eprintln!(
"Couldn't create directory: {}\nReason: {}",
path.to_str().unwrap(),
err
);
return Ok(());
}
for subscription in &state.subscriptions {
if re_pod.is_match(&subscription.title) {
let mut filename: String = subscription.title.clone();
filename.push_str(".xml");
path.push(filename);
if let Ok(ep_num) = ep_num_string.parse::<usize>() {
let mut path: PathBuf = get_xml_dir()?;
if let Err(err) = DirBuilder::new().recursive(true).create(&path) {
eprintln!(
"Couldn't create directory: {}\nReason: {}",
path.to_str().unwrap(),
err
);
return Ok(());
}
for subscription in &state.subscriptions {
if re_pod.is_match(&subscription.title) {
let mut filename: String = subscription.title.clone();
filename.push_str(".xml");
path.push(filename);
let mut file: File = File::open(&path).unwrap();
let mut content: Vec<u8> = Vec::new();
file.read_to_end(&mut content).unwrap();
let mut file: File = File::open(&path).unwrap();
let mut content: Vec<u8> = Vec::new();
file.read_to_end(&mut content).unwrap();
let podcast = Podcast::from(Channel::read_from(content.as_slice()).unwrap());
let episodes = podcast.episodes();
let episode = episodes[episodes.len() - ep_num].clone();
let podcast = Podcast::from(Channel::read_from(content.as_slice()).unwrap());
let episodes = podcast.episodes();
let episode = episodes[episodes.len() - ep_num].clone();
filename = episode.title().unwrap();
filename.push_str(episode.extension().unwrap());
path = get_podcast_dir()?;
path.push(podcast.title());
path.push(filename);
if path.exists() {
launch_player(path.to_str().chain_err(|| UNABLE_TO_CONVERT_TO_STR)?)?;
} else {
launch_player(
episode
.url()
.chain_err(|| "unable to retrieve episode url")?,
)?;
filename = episode.title().unwrap();
filename.push_str(episode.extension().unwrap());
path = get_podcast_dir()?;
path.push(podcast.title());
path.push(filename);
if path.exists() {
launch_player(path.to_str().chain_err(|| UNABLE_TO_CONVERT_TO_STR)?)?;
} else {
launch_player(
episode
.url()
.chain_err(|| "unable to retrieve episode url")?,
)?;
}
return Ok(());