diff options
Diffstat (limited to 'src/structs.rs')
| -rw-r--r-- | src/structs.rs | 16 | 
1 files changed, 15 insertions, 1 deletions
| diff --git a/src/structs.rs b/src/structs.rs index b33da2e..885d6cd 100644 --- a/src/structs.rs +++ b/src/structs.rs @@ -5,7 +5,7 @@ use reqwest;  use rss::{self, Channel, Item};  use serde_json;  use std::collections::BTreeSet; -use std::fs::{self, DirBuilder, File}; +use std::fs::{self, remove_dir_all, remove_file, DirBuilder, File};  use std::io::{self, BufReader, Read, Write};  use utils::*;  use yaml_rust::YamlLoader; @@ -185,6 +185,20 @@ impl Podcast {          }      } +    pub fn delete(title: &str) -> io::Result<()> { +        let mut path = get_xml_dir(); +        let mut filename = String::from(title); +        filename.push_str(".xml"); +        path.push(filename); + +        return remove_file(path); +    } + +    pub fn delete_all() -> io::Result<()> { +        let path = get_xml_dir(); +        return remove_dir_all(path); +    } +      pub fn episodes(&self) -> Vec<Episode> {          let mut result = Vec::new(); | 
