diff options
| author | Nathan Jaremko | 2019-02-24 19:28:38 -0500 | 
|---|---|---|
| committer | Nathan Jaremko | 2019-02-24 19:28:38 -0500 | 
| commit | ec84cdd94c14583dbc57a683fc5e511d48c594fd (patch) | |
| tree | 60b5359972f21d9a5f91959e451fe88809976872 /src | |
| parent | e80219b5a569a8745fe6423eaeb4f4d8caf03924 (diff) | |
| download | podcast-ec84cdd94c14583dbc57a683fc5e511d48c594fd.tar.bz2 | |
Improve subscription behavior
Diffstat (limited to 'src')
| -rw-r--r-- | src/actions.rs | 7 | ||||
| -rw-r--r-- | src/main.rs | 2 | ||||
| -rw-r--r-- | src/match_handler.rs | 6 | ||||
| -rw-r--r-- | src/parser.rs | 12 | ||||
| -rw-r--r-- | src/utils.rs | 1 | 
5 files changed, 4 insertions, 24 deletions
| diff --git a/src/actions.rs b/src/actions.rs index cb4a157..989fe2b 100644 --- a/src/actions.rs +++ b/src/actions.rs @@ -47,16 +47,11 @@ pub fn list_episodes(search: &str) -> Result<()> {      Ok(())  } -pub fn subscribe_rss(url: &str) -> Result<Channel> { -    println!("Downloading RSS feed..."); -    download_rss_feed(url) -} -  pub fn download_rss(config: &Config, url: &str) -> Result<()> { -    println!("Downloading episode(s)...");      let channel = download_rss_feed(url)?;      let mut download_limit = config.auto_download_limit as usize;      if 0 < download_limit { +        println!("Downloading episode(s)...");          let podcast = Podcast::from(channel);          let episodes = podcast.episodes();          if episodes.len() < download_limit { diff --git a/src/main.rs b/src/main.rs index 9d5b4d5..7cf2f45 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.8.2"; +const VERSION: &str = "0.9.0";  fn main() -> Result<()> {      utils::create_directories().chain_err(|| "unable to create directories")?; diff --git a/src/match_handler.rs b/src/match_handler.rs index 428f99c..ac09d15 100644 --- a/src/match_handler.rs +++ b/src/match_handler.rs @@ -77,11 +77,7 @@ pub fn handle_matches(                  .value_of("URL")                  .chain_err(|| "unable to find subcommand match")?;              state.subscribe(url).chain_err(|| "unable to subscribe")?; -            if subscribe_matches.occurrences_of("download") > 0 { -                download_rss(&config, url)?; -            } else { -                subscribe_rss(url)?; -            } +            download_rss(&config, url)?;          }          Some("search") => println!("This feature is coming soon..."),          Some("rm") => { diff --git a/src/parser.rs b/src/parser.rs index 6802ceb..caae070 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -93,12 +93,6 @@ pub fn get_app<'a, 'b>(version: &'a str) -> App<'a, 'b> {                          .help("URL to RSS feed")                          .required(true)                          .index(1), -                ) -                .arg( -                    Arg::with_name("download") -                        .short("d") -                        .long("download") -                        .help("auto download based on config"),                  ),          )          .subcommand( @@ -109,12 +103,6 @@ pub fn get_app<'a, 'b>(version: &'a str) -> App<'a, 'b> {                          .help("URL to RSS feed")                          .required(true)                          .index(1), -                ) -                .arg( -                    Arg::with_name("download") -                        .short("d") -                        .long("download") -                        .help("auto download based on config"),                  ),          )          .subcommand(SubCommand::with_name("refresh").about("refresh subscribed podcasts")) diff --git a/src/utils.rs b/src/utils.rs index e1b2ccb..184fb91 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -125,6 +125,7 @@ pub fn get_xml_dir() -> Result<PathBuf> {  }  pub fn download_rss_feed(url: &str) -> Result<Channel> { +    println!("Downloading RSS feed...");      let mut path = get_podcast_dir()?;      path.push(".rss");      create_dir_if_not_exist(&path)?; | 
