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 | |
| parent | 44fd58293585ada7bae51bd6ea3840f22e879416 (diff) | |
| download | podcast-bd4679d4b9b8a17e7abd027ffdde0dc380468bab.tar.bz2 | |
Improve unsubscription logic0.9.1
| -rw-r--r-- | CHANGELOG | 3 | ||||
| -rw-r--r-- | Cargo.toml | 2 | ||||
| -rw-r--r-- | src/actions.rs | 1 | ||||
| -rw-r--r-- | src/main.rs | 2 | ||||
| -rw-r--r-- | src/utils.rs | 7 | 
5 files changed, 13 insertions, 2 deletions
| @@ -1,3 +1,6 @@ +0.9.1 +- Improve unsubscribe messages +  0.9.0  - Removed `-d` from sub and subscribe subcommands. Behaviour of subscribing is defined by the .config.yaml file now. @@ -1,7 +1,7 @@  [package]  name = "podcast"  edition = "2018" -version = "0.9.0" +version = "0.9.1"  authors = ["Nathan Jaremko <njaremko@gmail.com>"]  description = "A command line podcast manager"  license = "GPL-3.0" 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)  } | 
