diff options
| author | Nathan Jaremko | 2017-11-30 00:29:16 -0500 |
|---|---|---|
| committer | Nathan Jaremko | 2017-11-30 00:29:16 -0500 |
| commit | bdcd9a9e0739796bc568de9c4296026a9ea147a6 (patch) | |
| tree | 7da742ad5db93fce8d86caac98c5ad6477ca7bc7 /src/structs.rs | |
| parent | 3313491352b1f0b2a62ae12328bd99ac3b727a66 (diff) | |
| download | podcast-bdcd9a9e0739796bc568de9c4296026a9ea147a6.tar.bz2 | |
add ability to unsubscribe and some more stuff
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(); |
