diff options
| author | njaremko | 2017-07-17 19:58:04 -0400 |
|---|---|---|
| committer | njaremko | 2017-07-17 19:58:04 -0400 |
| commit | c981cf824f5d75423f88437361d915cb1233eb3a (patch) | |
| tree | bea037bea03603b4333bb1f2ad6a273bb1334eac /src/structs.rs | |
| parent | 4e128165278d92b5efae7054355037eadbde1724 (diff) | |
| download | podcast-c981cf824f5d75423f88437361d915cb1233eb3a.tar.bz2 | |
Fix download support
Diffstat (limited to 'src/structs.rs')
| -rw-r--r-- | src/structs.rs | 17 |
1 files changed, 1 insertions, 16 deletions
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<u8> = Vec::new(); |
