O3VZ5J3LIYD3KBZLZA6HOJI7MVOV5DEODDPCPOMIBTPCO3CZW4YQC QTMCROQ5GDS3HX2XNNHSCCNTI4ECVVJRI6IE2WMHNS3YWTY6QLKAC L3I4GC7R74HPQS3VCQ44UTBAKKBOW6UDVXV2EF7XSWH7H2Z3RRJQC DP6ASS5FJGSZUG2B4SQOKZVHFAVZLEHFVEWBNFG3BHMC6FZAJNHQC O53GR2OQHGRKAVJT2RVPRHYFB54W5LM4DQYT7EYVGKU7HDK5CJJQC XIHPYOWDLQY2MVMVUQPH23O3TBALRG4G2CHSLWSCAYMY5NVJ32WQC FRLZDOAN7A3N623TLAPO66JVWBLBI45AG6P3DMQMDKGEZ2OBPYAAC FBQOBNZ6JJQXSHYQK7MCFA4U7NBNB47FXED7Y7HPRTOQVXJFIAGAC ADXMUSFXOKBPCHW4XS3T4KLWMPGQPYDMZW6YFFSHZPAQKEGIKCBQC UIMZBURR7KOWSREO4GDH5C2LZDUTEZBKQNYWBYSFGUTRYJ4GKSNQC 3YR56Y65UIAL3J7PUXWVJMOOHYZYDIX4V54OT2TJPZ25WQ6MXHCQC NUYITHNW2PMOOUBX2ZT3JHSK3MQUFP4W3GEZ5HFJFDOMT56R4QSAC H5MQEP35FJNDLARTAB7J5GEHRNBSL6RTHFUGURG5HIVGLCG4FGUAC JYSIHNS67XTGAR4HN7ZHWFMGGYSK5IY6J6EHO4YUZOR7UMMWAORQC 5FEMSWRS6SMVKBJAV4IYJLEJ2CML6QNZM75UGQFIIMAR5FBAACXAC ZSO6T3AM36JCKVGEZEIC6NA7WWESSW73TVM67W3BOWUPOSBHZEFQC if let Some(title) = episode.title() {let mut filename = title;filename.push_str(episode.extension().chain_err(|| "unable to retrieve extension")?,);path.push(filename);if !path.exists() {{let mut handle = stdout.lock();writeln!(&mut handle, "Downloading: {:?}", &path).ok();}let mut file = File::create(&path).chain_err(|| UNABLE_TO_CREATE_FILE)?;let mut resp = reqwest::get(url).chain_err(|| UNABLE_TO_GET_HTTP_RESPONSE)?;let mut content: Vec<u8> = Vec::new();resp.read_to_end(&mut content).chain_err(|| UNABLE_TO_READ_RESPONSE_TO_END)?;file.write_all(&content).chain_err(|| UNABLE_TO_WRITE_FILE)?;} else {
if let Some(title) = episode.title() {let mut filename = title;filename.push_str(episode.extension().chain_err(|| "unable to retrieve extension")?,);path.push(filename);if !path.exists() {{
let mut file = File::create(&path).chain_err(|| UNABLE_TO_CREATE_FILE)?;let mut resp = reqwest::get(url).chain_err(|| UNABLE_TO_GET_HTTP_RESPONSE)?;let mut content: Vec<u8> = Vec::new();resp.read_to_end(&mut content).chain_err(|| UNABLE_TO_READ_RESPONSE_TO_END)?;file.write_all(&content).chain_err(|| UNABLE_TO_WRITE_FILE)?;} else {let mut handle = stdout.lock();writeln!(&mut handle, "File already exists: {:?}", &path).ok();
}pub fn print_completion(arg: &str) {let zsh = r#"#compdef podcast#autoload# Copyright (C) 2019:# 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]"
"zsh" => println!("{}", zsh),//"bash" => println!("{}", bash),//"sh" => println!("{}", sh),_ => println!("Only options avaliable are: zsh"),
"zsh" => app.gen_completions_to("podcast", Shell::Zsh, &mut io::stdout()),"bash" => app.gen_completions_to("podcast", Shell::Bash, &mut io::stdout()),"powershell" => app.gen_completions_to("podcast", Shell::PowerShell, &mut io::stdout()),"fish" => app.gen_completions_to("podcast", Shell::Fish, &mut io::stdout()),"elvish" => app.gen_completions_to("podcast", Shell::Elvish, &mut io::stdout()),other => eprintln!("Completions are not available for {}", other),
let matches = parser::get_matches(&VERSION);match_handler::handle_matches(&VERSION, &mut state, &config, &matches)?;
let mut app = parser::get_app(&VERSION);let matches = app.clone().get_matches();match_handler::handle_matches(&VERSION, &mut state, &config, &mut app, &matches)?;
Some(shell) => print_completion(shell),None => print_completion(""),
Some(shell) => print_completion(app, shell),None => {let shell_path_env = env::var("SHELL");if let Ok(p) = shell_path_env {let shell_path = Path::new(&p);if let Some(shell) = shell_path.file_name() {print_completion(app, shell.to_str().chain_err(|| format!("Unable to convert {:?} to string", shell))?)}}}
let mut path = get_xml_dir()?;let mut filename = String::from(title);filename.push_str(".xml");path.push(filename);fs::remove_file(path).chain_err(|| UNABLE_TO_REMOVE_FILE)}
let mut path = get_xml_dir()?;let mut filename = String::from(title);filename.push_str(".xml");path.push(filename);fs::remove_file(path).chain_err(|| UNABLE_TO_REMOVE_FILE)}