diff options
| author | Nathan Jaremko | 2019-02-24 19:37:42 -0500 |
|---|---|---|
| committer | Nathan Jaremko | 2019-02-24 19:37:42 -0500 |
| commit | bd4679d4b9b8a17e7abd027ffdde0dc380468bab (patch) | |
| tree | fef41e11e674ce6c80a87dfe10560391128c17f6 /src | |
| parent | 44fd58293585ada7bae51bd6ea3840f22e879416 (diff) | |
| download | podcast-bd4679d4b9b8a17e7abd027ffdde0dc380468bab.tar.bz2 | |
Improve unsubscription logic0.9.1
Diffstat (limited to 'src')
| -rw-r--r-- | src/actions.rs | 1 | ||||
| -rw-r--r-- | src/main.rs | 2 | ||||
| -rw-r--r-- | src/utils.rs | 7 |
3 files changed, 9 insertions, 1 deletions
diff --git a/src/actions.rs b/src/actions.rs index 989fe2b..c0518c5 100644 --- a/src/actions.rs +++ b/src/actions.rs @@ -51,6 +51,7 @@ pub fn download_rss(config: &Config, url: &str) -> Result<()> { let channel = download_rss_feed(url)?; let mut download_limit = config.auto_download_limit as usize; if 0 < download_limit { + println!("Subscribe auto-download limit set to: {}", download_limit); println!("Downloading episode(s)..."); let podcast = Podcast::from(channel); let episodes = podcast.episodes(); diff --git a/src/main.rs b/src/main.rs index 7cf2f45..b9085bb 100644 --- a/src/main.rs +++ b/src/main.rs @@ -30,7 +30,7 @@ pub mod errors { use self::errors::*; use self::structs::*; -const VERSION: &str = "0.9.0"; +const VERSION: &str = "0.9.1"; fn main() -> Result<()> { utils::create_directories().chain_err(|| "unable to create directories")?; diff --git a/src/utils.rs b/src/utils.rs index 184fb91..f495805 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -27,6 +27,8 @@ pub const UNABLE_TO_CREATE_CHANNEL_FROM_RESPONSE: &str = pub const UNABLE_TO_CREATE_CHANNEL_FROM_FILE: &str = "unable to create channel from xml file"; pub const UNABLE_TO_RETRIEVE_PODCAST_BY_TITLE: &str = "unable to retrieve podcast by title"; +const UNSUBSCRIBE_NOTE: &str = "Note: this does NOT delete any downloaded podcasts"; + pub fn trim_extension(filename: &str) -> Option<String> { let name = String::from(filename); let index = name.rfind('.')?; @@ -80,10 +82,15 @@ pub fn delete(title: &str) -> Result<()> { let mut filename = String::from(title); filename.push_str(".xml"); path.push(filename); + println!("Removing '{}' from subscriptions...", &title); + println!("{}", UNSUBSCRIBE_NOTE); fs::remove_file(path).chain_err(|| UNABLE_TO_REMOVE_FILE) } + pub fn delete_all() -> Result<()> { + println!("Removing all subscriptions..."); + println!("{}", UNSUBSCRIBE_NOTE); fs::remove_dir_all(get_xml_dir()?).chain_err(|| UNABLE_TO_READ_DIRECTORY) } |
