aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Jaremko2019-02-24 19:28:38 -0500
committerNathan Jaremko2019-02-24 19:28:38 -0500
commitec84cdd94c14583dbc57a683fc5e511d48c594fd (patch)
tree60b5359972f21d9a5f91959e451fe88809976872
parente80219b5a569a8745fe6423eaeb4f4d8caf03924 (diff)
downloadpodcast-ec84cdd94c14583dbc57a683fc5e511d48c594fd.tar.bz2
Improve subscription behavior
-rw-r--r--CHANGELOG3
-rw-r--r--Cargo.toml2
-rw-r--r--podcast6
-rw-r--r--src/actions.rs7
-rw-r--r--src/main.rs2
-rw-r--r--src/match_handler.rs6
-rw-r--r--src/parser.rs12
-rw-r--r--src/utils.rs1
8 files changed, 11 insertions, 28 deletions
diff --git a/CHANGELOG b/CHANGELOG
index b99a4f1..fbb309b 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,6 @@
+0.9.0
+- Removed `-d` from sub and subscribe subcommands. Behaviour of subscribing is defined by the .config.yaml file now.
+
0.8.2
- Add completion generation for all major shells
diff --git a/Cargo.toml b/Cargo.toml
index 10144fc..c9e210c 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "podcast"
edition = "2018"
-version = "0.8.2"
+version = "0.9.0"
authors = ["Nathan Jaremko <njaremko@gmail.com>"]
description = "A command line podcast manager"
license = "GPL-3.0"
diff --git a/podcast b/podcast
index b03d933..f6a74db 100644
--- a/podcast
+++ b/podcast
@@ -1,9 +1,9 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.8.
-.TH PODCAST "1" "February 2019" "podcast 0.8.2" "User Commands"
+.TH PODCAST "1" "February 2019" "podcast 0.9.0" "User Commands"
.SH NAME
-podcast \- manual page for podcast 0.8.2
+podcast \- manual page for podcast 0.9.0
.SH DESCRIPTION
-podcast 0.8.2
+podcast 0.9.0
Nathan J. <njaremko@gmail.com>
A command line podcast manager
.SS "USAGE:"
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)?;