O53GR2OQHGRKAVJT2RVPRHYFB54W5LM4DQYT7EYVGKU7HDK5CJJQC M4FCDZ745GHHL3OLH64EVYOEOEGGGVIBCVFGX5JUJDJRE5OLCXLQC XIHPYOWDLQY2MVMVUQPH23O3TBALRG4G2CHSLWSCAYMY5NVJ32WQC 76TBVFPIFU3LSMXY5NAHZBH6HRJLSLK43PGOPL6QQ2YYVBJ64QAQC THSENT35O3PIXQ343QPPE3DJGR4YVULN6YPS5ETW5PXSVGZZQIZAC UIMZBURR7KOWSREO4GDH5C2LZDUTEZBKQNYWBYSFGUTRYJ4GKSNQC 2CKX4R6ONNXDXGRYZ5NZEBJZFX5Z6BYPGNJ7LMXUHHFB4MUFJRCAC JJ4SMY257MAHSJSZH5PJZMLBH3GJX5VKH2ZZSBGWLL7FWP7OA7TQC ZYS43ILR4OXI7S2AYNGYSTK3IU2UVELIWVCCWDS7RVZQDSNJMDHQC 6FJACP6KUOZ4HWK4PSS5PFPGDYXZSCAWSKIARWBDGCZTPJWXA62AC H5MQEP35FJNDLARTAB7J5GEHRNBSL6RTHFUGURG5HIVGLCG4FGUAC BSPWOOHZMN3RAOHGJ2A3XKUOUCFFAOXS7YR67E3AARPPPIA5YPDAC 5JMYBRF3UYX4LFH7JK6S4BEDKRVKDFIL4YKTCWKMKP4TMNNGQFKQC ADXMUSFXOKBPCHW4XS3T4KLWMPGQPYDMZW6YFFSHZPAQKEGIKCBQC 476KTQSS5NXVCTVLVZQRGSYD5OAFBYG75VTSWBN26Q45RSMRT5YQC JPN37V6Q35ZAW7A2DTGX2WJ3IJ66BAGHXHWXOGHQRHGFAOETFQ7AC #compdef podcast#autoload# Copyright (C) 2017:# Nathan Jaremko <njaremko@gmail.com># All Rights Reserved.# This file is licensed under the GPLv2+. Please see COPYING for more information._podcast() {local ret=1_arguments -C \'1: :_podcast_cmds' \&& ret=0}_podcast_cmds () {local subcommands;subcommands=("download:Download episodes of podcast""help:Prints this message or the help of the given subcommand(s)""ls:List podcasts or episodes of a podcast""play:Play episodes of a podcast""refresh:Refreshes subscribed podcasts""rm:Delete podcast""search:Searches for podcasts""subscribe:Subscribe to a podcast RSS feed""update:check for updates")_describe -t commands 'podcast' subcommands_arguments : \"--version[Output version information]" \"--help[Output help message]"}_podcast
reqwest = "0.7.1"rss = {version = "0.7", features = ["from_url"] }serde = "1.0.10"serde_derive = "1.0.10"serde_json = "1.0.2"yaml-rust = "0.3.5"
reqwest = "0.8"rss = {version = "1.2", features = ["from_url"] }serde = "1.0"serde_derive = "1.0"serde_json = "1.0"yaml-rust = "0.3"toml = "0.4"
let resp: String = reqwest::get("https://raw.githubusercontent.com/njaremko/podcast/master/Cargo.toml",).unwrap().text().unwrap();//println!("{}", resp);match resp.parse::<toml::Value>() {Ok(config) => {let latest = config["package"]["version"].as_str().unwrap();if version != latest {println!("New version avaliable: {}", latest);}},Err(err) => eprintln!("{}", err),}
}}}pub fn remove_podcast(state: &mut State, p_search: &str) {if p_search == "*" {match Podcast::delete_all() {Ok(_) => println!("Success"),Err(err) => eprintln!("Error: {}", err),}return;}let re_pod = Regex::new(&format!("(?i){}", &p_search)).expect("Failed to parse regex");for subscription in 0..state.subs.len() {let title = state.subs[subscription].title.clone();if re_pod.is_match(&title) {state.subs.remove(subscription);match Podcast::delete(&title) {Ok(_) => println!("Success"),Err(err) => eprintln!("Error: {}", err),}break;
}}pub fn print_completion(arg: &str) {let zsh = r#"#compdef podcast#autoload# Copyright (C) 2017:# Nathan Jaremko <njaremko@gmail.com># All Rights Reserved.# This file is licensed under the GPLv2+. Please see COPYING for more information._podcast() {local ret=1_arguments -C \'1: :_podcast_cmds' \&& ret=0}_podcast_cmds () {local subcommands;subcommands=("download:Download episodes of podcast""help:Prints this message or the help of the given subcommand(s)""ls:List podcasts or episodes of a podcast""play:Play episodes of a podcast""refresh:Refreshes subscribed podcasts""rm:Unsubscribe from a podcast""completion:Shell Completions""search:Searches for podcasts""subscribe:Subscribe to a podcast RSS feed""update:check for updates")_describe -t commands 'podcast' subcommands_arguments : \"--version[Output version information]" \"--help[Output help message]"}_podcast"#;//let bash = "";//let sh = "";match arg {"zsh" => println!("{}", zsh),//"bash" => println!("{}", bash),//"sh" => println!("{}", sh),_ => println!("Only options avaliable are: zsh"),
.subcommand(SubCommand::with_name("rm").about("delete podcast")).subcommand(SubCommand::with_name("completions").about("install shell completions"))
.subcommand(SubCommand::with_name("rm").about("unsubscribe from a podcast").arg(Arg::with_name("PODCAST").help("Podcast to delete").index(1)),).subcommand(SubCommand::with_name("completion").about("install shell completion").arg(Arg::with_name("SHELL").help("Shell to print completion for").index(1),),)
Some("search") => (),Some("rm") => (),Some("completions") => (),
Some("search") => println!("This feature is coming soon..."),Some("rm") => {let rm_matches = matches.subcommand_matches("rm").unwrap();match rm_matches.value_of("PODCAST") {Some(regex) => remove_podcast(&mut state, regex),None => println!(""),}}Some("completion") => {let matches = matches.subcommand_matches("completion").unwrap();match matches.value_of("SHELL") {Some(shell) => print_completion(shell),None => print_completion(""),}}
}pub fn delete(title: &str) -> io::Result<()> {let mut path = get_xml_dir();let mut filename = String::from(title);filename.push_str(".xml");path.push(filename);return remove_file(path);}pub fn delete_all() -> io::Result<()> {let path = get_xml_dir();return remove_dir_all(path);