aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs30
1 files changed, 29 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs
index 05c8bf2..cff7c45 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -6,6 +6,9 @@ extern crate serde_json;
#[macro_use]
extern crate serde_derive;
extern crate clap;
+use std::fs::File;
+use std::io::BufReader;
+use rss::Channel;
mod actions;
mod structs;
@@ -28,11 +31,26 @@ fn main() {
.arg(
Arg::with_name("PODCAST")
.help("Regex for subscribed podcast")
- //.required(true)
.index(1),
),
)
.subcommand(
+ SubCommand::with_name("play")
+ .about("list episodes of podcast")
+ .arg(
+ Arg::with_name("PODCAST")
+ .help("Regex for subscribed podcast")
+ .required(true)
+ .index(1),
+ )
+ .arg(
+ Arg::with_name("EPISODE")
+ .help("Episode index")
+ .required(true)
+ .index(2),
+ ),
+ )
+ .subcommand(
SubCommand::with_name("search")
.about("searches for podcasts")
.arg(
@@ -64,6 +82,16 @@ fn main() {
None => list_subscriptions(state),
}
}
+ Some("play") => {
+ let play_matches = matches.subcommand_matches("play").unwrap();
+ let podcast = play_matches.value_of("PODCAST").unwrap();
+ let episode = play_matches.value_of("EPISODE").unwrap();
+ stream_episode(state, podcast, episode);
+ // let file = File::open("rss.xml").unwrap();
+ // let channel = Channel::read_from(BufReader::new(file)).unwrap();
+ // let ep = Episode::from(channel.items()[20].clone());
+ // stream_episode(ep);
+ }
Some("subscribe") => {
state.subscribe(
matches