diff --git a/Cargo.lock b/Cargo.lock index 602b6ab..0f84b3a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -843,6 +843,7 @@ dependencies = [ "aes-ctr 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "bit-set 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", "lewton 0.9.4 (registry+https://github.com/rust-lang/crates.io-index)", "librespot-core 0.1.0", diff --git a/audio/Cargo.toml b/audio/Cargo.toml index 49902c5..a7237da 100644 --- a/audio/Cargo.toml +++ b/audio/Cargo.toml @@ -9,6 +9,7 @@ path = "../core" [dependencies] bit-set = "0.5" byteorder = "1.3" +bytes = "0.4" futures = "0.1" lewton = "0.9" log = "0.4" diff --git a/audio/src/fetch.rs b/audio/src/fetch.rs index c464a9a..9bde9c3 100644 --- a/audio/src/fetch.rs +++ b/audio/src/fetch.rs @@ -67,7 +67,7 @@ impl StreamLoaderController { pub fn range_available(&self, range: Range) -> bool { if let Some(ref shared) = self.stream_shared { - let mut download_status = shared.download_status.lock().unwrap(); + let download_status = shared.download_status.lock().unwrap(); if range.length <= download_status.downloaded.contained_length_from_value(range.start) { return true; } else { @@ -218,7 +218,7 @@ impl AudioFileOpenStreaming { }); let mut write_file = NamedTempFile::new().unwrap(); - write_file.set_len(size as u64).unwrap(); + write_file.as_file().set_len(size as u64).unwrap(); write_file.seek(SeekFrom::Start(0)).unwrap(); let read_file = write_file.reopen().unwrap(); @@ -450,7 +450,7 @@ impl Future for AudioFileFetchDataReceiver { Ok(Async::Ready(Some(data))) => { if let Some(request_sent_time) = self.request_sent_time { let duration = Instant::now() - request_sent_time; - let mut duration_ms: u64; + let duration_ms: u64; if duration.as_secs() > MAXIMUM_ASSUMED_PING_TIME_SECONDS { duration_ms = MAXIMUM_ASSUMED_PING_TIME_SECONDS * 1000; }else {