diff --git a/Cargo.lock b/Cargo.lock index 4be2696..99f8c87 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -571,7 +571,6 @@ dependencies = [ "hyper 0.11.7 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "mime_guess 1.8.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)", "reqwest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", ] diff --git a/README.md b/README.md index 8f507c3..f29d21f 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ Flatpak instructions... Soon™. ### Dependancies -* Rust stable 1.21 or later. +* Rust stable 1.22 or later. * Gtk+ 3.22 or later * Meson diff --git a/hammond-data/src/database.rs b/hammond-data/src/database.rs index bc35400..a5fc850 100644 --- a/hammond-data/src/database.rs +++ b/hammond-data/src/database.rs @@ -38,7 +38,6 @@ lazy_static! { } pub fn connection() -> Pool { - // Arc::clone(&DB) Arc::clone(&POOL) } diff --git a/hammond-downloader/Cargo.toml b/hammond-downloader/Cargo.toml index 2323b09..7d19efc 100644 --- a/hammond-downloader/Cargo.toml +++ b/hammond-downloader/Cargo.toml @@ -9,7 +9,6 @@ error-chain = "0.11.0" hyper = "0.11.7" log = "0.3.8" mime_guess = "1.8.2" -rand = "0.3.18" reqwest = "0.8.1" tempdir = "0.3.5" diff --git a/hammond-downloader/src/downloader.rs b/hammond-downloader/src/downloader.rs index 67a3f8c..84865eb 100644 --- a/hammond-downloader/src/downloader.rs +++ b/hammond-downloader/src/downloader.rs @@ -1,8 +1,6 @@ use reqwest; use hyper::header::*; use tempdir::TempDir; -use rand; -use rand::Rng; use mime_guess; use std::fs::{rename, DirBuilder, File}; @@ -62,13 +60,8 @@ fn download_into(dir: &str, file_title: &str, url: &str) -> Result { // Construct a temp file to save desired content. let tempdir = TempDir::new_in(dir, "")?; - let mut rng = rand::thread_rng(); - let out_file = format!( - "{}/{}.part", - tempdir.path().to_str().unwrap(), - rng.gen::() - ); + let out_file = format!("{}/temp.part", tempdir.path().to_str().unwrap(),); // Save requested content into the file. save_io(&out_file, &mut resp, ct_len)?; @@ -142,11 +135,7 @@ pub fn get_episode(ep: &mut Episode, download_folder: &str) -> Result<()> { } pub fn cache_image(pd: &Podcast) -> Option { - if pd.image_uri().is_none() { - return None; - } - - let url = pd.image_uri().unwrap().to_owned(); + let url = pd.image_uri()?.to_owned(); if url == "" { return None; } @@ -159,6 +148,7 @@ pub fn cache_image(pd: &Podcast) -> Option { // Hacky way // TODO: make it so it returns the first cover.* file encountered. + // Use glob instead let png = format!("{}/cover.png", download_fold); let jpg = format!("{}/cover.jpg", download_fold); let jpe = format!("{}/cover.jpe", download_fold); diff --git a/hammond-downloader/src/lib.rs b/hammond-downloader/src/lib.rs index db2caad..98f6678 100644 --- a/hammond-downloader/src/lib.rs +++ b/hammond-downloader/src/lib.rs @@ -8,7 +8,6 @@ extern crate hyper; #[macro_use] extern crate log; extern crate mime_guess; -extern crate rand; extern crate reqwest; extern crate tempdir;