From c981cf824f5d75423f88437361d915cb1233eb3a Mon Sep 17 00:00:00 2001 From: njaremko Date: Mon, 17 Jul 2017 19:58:04 -0400 Subject: Fix download support --- src/structs.rs | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) (limited to 'src/structs.rs') diff --git a/src/structs.rs b/src/structs.rs index 5e50307..ac1de96 100644 --- a/src/structs.rs +++ b/src/structs.rs @@ -102,25 +102,10 @@ impl Podcast { result } - pub fn list_episodes(&self) -> Vec<&str> { - let mut result = Vec::new(); - - let items = self.0.items(); - for item in items { - match item.title() { - Some(val) => result.push(val), - None => (), - } - } - result - } - pub fn download(&self) { let mut path = get_podcast_dir(); path.push(self.title()); - DirBuilder::new().recursive(true).create(path).unwrap(); - let downloaded = already_downloaded(self.title()); for ep in self.episodes() { @@ -165,6 +150,7 @@ impl Episode { pub fn download(&self, podcast_name: &str) -> Result<(), io::Error> { let mut path = get_podcast_dir(); path.push(podcast_name); + DirBuilder::new().recursive(true).create(&path).unwrap(); if let Some(url) = self.download_url() { if let Some(title) = self.title() { @@ -172,7 +158,6 @@ impl Episode { let mut filename = String::from(title); filename.push_str(self.download_extension().unwrap()); path.push(filename); - let mut file = File::create(&path)?; let mut resp = reqwest::get(url).unwrap(); let mut content: Vec = Vec::new(); -- cgit v1.2.3