From 359db5a9b323d93855db20508b474bee755ca7b7 Mon Sep 17 00:00:00 2001 From: njaremko Date: Mon, 17 Jul 2017 23:31:32 -0400 Subject: Cleanup --- src/actions.rs | 16 ++++++++-------- src/structs.rs | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/actions.rs b/src/actions.rs index f6fb679..9152918 100644 --- a/src/actions.rs +++ b/src/actions.rs @@ -1,11 +1,11 @@ use regex::Regex; +use reqwest; +use rss::Channel; +use std::fs::{DirBuilder, File}; +use std::io::{Read, Write}; use std::process::Command; use structs::*; -use reqwest; use utils::*; -use std::io::{Read, Write}; -use std::fs::{DirBuilder, File}; -use rss::Channel; pub fn list_episodes(state: &State, search: &str) { let re = Regex::new(search).unwrap(); @@ -79,12 +79,11 @@ pub fn download_all(state: &State, p_search: &str) { pub fn play_episode(state: &State, p_search: &str, ep_num_string: &str) { let re_pod = Regex::new(p_search).unwrap(); let ep_num = ep_num_string.parse::().unwrap(); + let mut path = get_podcast_dir(); + path.push(".rss"); + DirBuilder::new().recursive(true).create(&path).unwrap(); for subscription in state.subscriptions() { if re_pod.is_match(&subscription.name) { - let mut path = get_podcast_dir(); - path.push(".rss"); - DirBuilder::new().recursive(true).create(&path).unwrap(); - let mut filename = String::from(subscription.name); filename.push_str(".xml"); path.push(filename); @@ -107,6 +106,7 @@ pub fn play_episode(state: &State, p_search: &str, ep_num_string: &str) { } else { launch_mpv(episode.url().unwrap()); } + return; } } } diff --git a/src/structs.rs b/src/structs.rs index 923a0b1..5fdca3b 100644 --- a/src/structs.rs +++ b/src/structs.rs @@ -1,3 +1,4 @@ +use actions::*; use reqwest; use rss::{self, Channel, Item}; use serde_json; @@ -5,7 +6,6 @@ use std::collections::BTreeSet; use std::fs::{DirBuilder, File}; use std::io::{self, Read, Write}; use utils::*; -use actions::*; #[derive(Serialize, Deserialize, Clone)] pub struct Subscription { -- cgit v1.2.3