From 4e02ef5a6cca76b852cbf212d22ac6d79d68c742 Mon Sep 17 00:00:00 2001 From: Mitch Bigelow Date: Sat, 14 Jan 2017 16:22:33 -0500 Subject: [PATCH 01/56] Stop pulseaudio sink when not in use --- src/audio_backend/pulseaudio.rs | 53 ++++++++++++++++++++------------- 1 file changed, 32 insertions(+), 21 deletions(-) diff --git a/src/audio_backend/pulseaudio.rs b/src/audio_backend/pulseaudio.rs index 05876fe6..b2afe50f 100644 --- a/src/audio_backend/pulseaudio.rs +++ b/src/audio_backend/pulseaudio.rs @@ -5,7 +5,12 @@ use std::ptr::{null, null_mut}; use std::mem::{transmute}; use std::ffi::CString; -pub struct PulseAudioSink(*mut pa_simple); +pub struct PulseAudioSink { + s : *mut pa_simple, + ss : pa_sample_spec, + name : CString, + desc : CString +} impl Open for PulseAudioSink { fn open(device: Option<&str>) -> PulseAudioSink { @@ -24,30 +29,40 @@ impl Open for PulseAudioSink { let name = CString::new("librespot").unwrap(); let description = CString::new("A spoty client library").unwrap(); - let s = unsafe { - pa_simple_new(null(), // Use the default server. - name.as_ptr(), // Our application's name. - PA_STREAM_PLAYBACK, - null(), // Use the default device. - description.as_ptr(), // Description of our stream. - &ss, // Our sample format. - null(), // Use default channel map - null(), // Use default buffering attributes. - null_mut(), // Ignore error code. - ) - }; - assert!(s != null_mut()); - - PulseAudioSink(s) + PulseAudioSink { + s: null_mut(), + ss: ss, + name: name, + desc: description + } } } impl Sink for PulseAudioSink { fn start(&mut self) -> io::Result<()> { + if self.s == null_mut() { + self.s = unsafe { + pa_simple_new(null(), // Use the default server. + self.name.as_ptr(), // Our application's name. + PA_STREAM_PLAYBACK, + null(), // Use the default device. + self.desc.as_ptr(), // desc of our stream. + &self.ss, // Our sample format. + null(), // Use default channel map + null(), // Use default buffering attributes. + null_mut(), // Ignore error code. + ) + }; + assert!(self.s != null_mut()); + } Ok(()) } fn stop(&mut self) -> io::Result<()> { + unsafe { + pa_simple_free(self.s); + } + self.s = null_mut(); Ok(()) } @@ -55,13 +70,9 @@ impl Sink for PulseAudioSink { unsafe { let ptr = transmute(data.as_ptr()); let bytes = data.len() as usize * 2; - pa_simple_write(self.0, ptr, bytes, null_mut()); + pa_simple_write(self.s, ptr, bytes, null_mut()); }; Ok(()) } } - - - - From 55812893517cc8b5a39d8582ce8bf66570022421 Mon Sep 17 00:00:00 2001 From: nsteel Date: Fri, 27 Oct 2017 18:45:02 +0100 Subject: [PATCH 02/56] Added repeat support --- src/spirc.rs | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/spirc.rs b/src/spirc.rs index 3b5fb77c..06f20635 100644 --- a/src/spirc.rs +++ b/src/spirc.rs @@ -396,6 +396,11 @@ impl SpircTask { self.notify(None); } + MessageType::kMessageTypeRepeat => { + self.state.set_repeat(frame.get_state().get_repeat()); + self.notify(None); + } + MessageType::kMessageTypeSeek => { let position = frame.get_position(); @@ -467,13 +472,19 @@ impl SpircTask { fn handle_next(&mut self) { let current_index = self.state.get_playing_track_index(); - let new_index = (current_index + 1) % (self.state.get_track().len() as u32); + let num_tracks = self.state.get_track().len() as u32; + let new_index = (current_index + 1) % num_tracks; + + let mut was_last_track = (current_index + 1) >= num_tracks; + if self.state.get_repeat() { + was_last_track = false; + } self.state.set_playing_track_index(new_index); self.state.set_position_ms(0); self.state.set_position_measured_at(now_ms() as u64); - self.load_track(true); + self.load_track(!was_last_track); } fn handle_prev(&mut self) { @@ -520,14 +531,7 @@ impl SpircTask { } fn handle_end_of_track(&mut self) { - let current_index = self.state.get_playing_track_index(); - let new_index = (current_index + 1) % (self.state.get_track().len() as u32); - - self.state.set_playing_track_index(new_index); - self.state.set_position_ms(0); - self.state.set_position_measured_at(now_ms() as u64); - - self.load_track(true); + self.handle_next(); self.notify(None); } From 628df27292e08d44400e4639a8ef25f50ecbb804 Mon Sep 17 00:00:00 2001 From: Nick Steel Date: Fri, 3 Nov 2017 01:15:27 +0000 Subject: [PATCH 03/56] Support for enabling shuffle. --- src/spirc.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/spirc.rs b/src/spirc.rs index 06f20635..750badc8 100644 --- a/src/spirc.rs +++ b/src/spirc.rs @@ -17,6 +17,9 @@ use protocol::spirc::{PlayStatus, State, MessageType, Frame, DeviceState}; use mixer::Mixer; use player::Player; +use rand; +use rand::Rng; + pub struct SpircTask { player: Player, mixer: Box, @@ -401,6 +404,26 @@ impl SpircTask { self.notify(None); } + MessageType::kMessageTypeShuffle => { + self.state.set_shuffle(frame.get_state().get_shuffle()); + if self.state.get_shuffle() + { + let current_index = self.state.get_playing_track_index(); + { + let tracks = self.state.mut_track(); + tracks.swap(0, current_index as usize); + if let Some((_, rest)) = tracks.split_first_mut() { + rand::thread_rng().shuffle(rest); + } + } + self.state.set_playing_track_index(0); + } else { + let context = self.state.get_context_uri(); + debug!("{:?}", context); + } + self.notify(None); + } + MessageType::kMessageTypeSeek => { let position = frame.get_position(); From 80493d8bbe5ab11570e3328644293a2eda844831 Mon Sep 17 00:00:00 2001 From: ComlOnline Date: Mon, 20 Nov 2017 00:55:34 +0000 Subject: [PATCH 04/56] README Upadte --- README.md | 39 ++++++++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index eead8760..1d749d6a 100644 --- a/README.md +++ b/README.md @@ -4,13 +4,16 @@ applications to use Spotify's service, without using the official but closed-source libspotify. Additionally, it will provide extra features which are not available in the official library. -Note: librespot only works with Spotify Premium. +Note: librespot needs to be logged in and only works with Spotify Premium -# Unmaintained -Unfortunately I am unable to maintain librespot anymore. It should still work, -but issues and Pull requests will be ignored. Feel free to fork it and continue -development there. If a fork gains traction I will happily point to it from the -README. +# THIS FORK +As the origin is no longer maintained I wanted to have a place for a version of librespot with other peoples forks and features merged. + +# THANKS +I've done noting more than make this pretty so big thanks to: +[plietar](https://github.com/plietar/) for making the thing in the first place. +[kingosticks](https://github.com/kingosticks/) For the Suffling and Repeat. +[ipha](https://github.com/ipha/) For the start stop audio sink. ## Building Rust 1.17.0 or later is required to build librespot. @@ -46,9 +49,27 @@ Once you've built *librespot*, run it using : target/release/librespot --username USERNAME --cache CACHEDIR --name DEVICENAME ``` -## Discovery mode -*librespot* can be run in discovery mode, in which case no password is required at startup. -For that, simply omit the `--username` argument. +### All options + +| Type | Short | Long | Description | Hint | +|----------|-------|---------------------|-------------------------------------------------|-------------| +| Option | c | cache | Path to a directory where files will be cached. | CACHE | +| Flag | | disable-audio-cache | Disable caching of the audio data. | | +| Required | n | name | Device name | NAME | +| Option | | device-type | Displayed device type | DEVICE_TYPE | +| Option | b | bitrate | Bitrate (96, 160 or 320). Defaults to 160 | BITRATE | +| Option | | onstart | Run PROGRAM when playback is about to begin. | | +| Option | | onstop | Run PROGRAM when playback has ended. | PROGRAM | +| Flag | v | verbose | Enable verbose output | PROGRAM | +| Option | u | username | Username to sign in with | USERNAME | +| Option | p | password | Password | PASSWORD | +| Flag | | disable-discovery | Disable discovery mode | | +| Option | | backend | Audio backend to use. Use '?' to list options | BACKEND | +| Option | | device | Audio device to use. Use '?' to list options | DEVICE | +| Option | | mixer | Mixer to use | MIXER | + +Taken from here: +https://github.com/ComlOnline/librespot/blob/master/src/main.rs#L88 ## Audio Backends *librespot* supports various audio backends. Multiple backends can be enabled at compile time by enabling the From 2a215278ef7841e4e516193c8c6d31f5c404b7b2 Mon Sep 17 00:00:00 2001 From: ComlOnline Date: Thu, 23 Nov 2017 00:14:29 +0000 Subject: [PATCH 05/56] Edit to puch for travis --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 1d749d6a..95ab3b4e 100644 --- a/README.md +++ b/README.md @@ -128,5 +128,4 @@ Come and hang out on gitter if you need help or want to offer some. https://gitter.im/sashahilton00/spotify-connect-resources ## License -Everything in this repository is licensed under the MIT license. - +Everything in this repository is licensed under the MIT license. \ No newline at end of file From 5141f434b576448e9667a5af9e23c5a4111159c0 Mon Sep 17 00:00:00 2001 From: ComlOnline Date: Thu, 23 Nov 2017 11:19:47 +0000 Subject: [PATCH 06/56] Add travis ci tag --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 95ab3b4e..d3629ce6 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +[![Build Status](https://travis-ci.org/ComlOnline/librespot.svg?branch=master)](https://travis-ci.org/ComlOnline/librespot) + # librespot *librespot* is an open source client library for Spotify. It enables applications to use Spotify's service, without using the official but @@ -9,6 +11,7 @@ Note: librespot needs to be logged in and only works with Spotify Premium # THIS FORK As the origin is no longer maintained I wanted to have a place for a version of librespot with other peoples forks and features merged. + # THANKS I've done noting more than make this pretty so big thanks to: [plietar](https://github.com/plietar/) for making the thing in the first place. From 20fc7649166feac0ca4008c0873304edc4dfafeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Federico=20Fossem=C3=B2?= Date: Sun, 3 Dec 2017 18:06:24 +0100 Subject: [PATCH 07/56] default volume to 50% --- src/spirc.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/spirc.rs b/src/spirc.rs index 3b5fb77c..642048fa 100644 --- a/src/spirc.rs +++ b/src/spirc.rs @@ -142,7 +142,7 @@ impl Spirc { let (cmd_tx, cmd_rx) = mpsc::unbounded(); - let volume = 0xFFFF; + let volume = 0x8000; let device = initial_device_state(config, volume); mixer.set_volume(volume); From c8a2190e9e35cab6de4bdaaa83b4e54dd9751c83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Federico=20Fossem=C3=B2?= Date: Mon, 4 Dec 2017 11:37:36 +0100 Subject: [PATCH 08/56] default volume to 20% (my config) --- src/spirc.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/spirc.rs b/src/spirc.rs index 642048fa..361c0f0d 100644 --- a/src/spirc.rs +++ b/src/spirc.rs @@ -142,7 +142,7 @@ impl Spirc { let (cmd_tx, cmd_rx) = mpsc::unbounded(); - let volume = 0x8000; + let volume = 0x3333; let device = initial_device_state(config, volume); mixer.set_volume(volume); From 9e51977885afc5ca2c02ab71cedbc24ae9604ea7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Federico=20Fossem=C3=B2?= Date: Mon, 4 Dec 2017 12:16:41 +0100 Subject: [PATCH 09/56] reset volume to 50% --- src/spirc.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/spirc.rs b/src/spirc.rs index 361c0f0d..642048fa 100644 --- a/src/spirc.rs +++ b/src/spirc.rs @@ -142,7 +142,7 @@ impl Spirc { let (cmd_tx, cmd_rx) = mpsc::unbounded(); - let volume = 0x3333; + let volume = 0x8000; let device = initial_device_state(config, volume); mixer.set_volume(volume); From 8313da522b835b98130298ec42678653b21ebc82 Mon Sep 17 00:00:00 2001 From: fossedihelm Date: Wed, 6 Dec 2017 14:37:34 +0100 Subject: [PATCH 10/56] --initial-volume as parameter --- Cargo.lock | 14 +++++++------- core/src/config.rs | 1 + src/main.rs | 13 +++++++++++-- src/spirc.rs | 4 ++-- 4 files changed, 21 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d8128db1..49d4eea9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,10 +1,3 @@ -[root] -name = "librespot-protocol" -version = "0.1.0" -dependencies = [ - "protobuf 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "aho-corasick" version = "0.6.3" @@ -353,6 +346,13 @@ dependencies = [ "protobuf 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "librespot-protocol" +version = "0.1.0" +dependencies = [ + "protobuf 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "linear-map" version = "1.2.0" diff --git a/core/src/config.rs b/core/src/config.rs index 7dcb97d3..46b22e41 100644 --- a/core/src/config.rs +++ b/core/src/config.rs @@ -121,4 +121,5 @@ impl Default for PlayerConfig { pub struct ConnectConfig { pub name: String, pub device_type: DeviceType, + pub volume: i32, } diff --git a/src/main.rs b/src/main.rs index c2850cdf..cd94842d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -100,7 +100,8 @@ fn setup(args: &[String]) -> Setup { .optflag("", "disable-discovery", "Disable discovery mode") .optopt("", "backend", "Audio backend to use. Use '?' to list options", "BACKEND") .optopt("", "device", "Audio device to use. Use '?' to list options", "DEVICE") - .optopt("", "mixer", "Mixer to use", "MIXER"); + .optopt("", "mixer", "Mixer to use", "MIXER") + .optopt("", "initial-volume", "Initial volume in %, once connected", "VOLUME"); let matches = match opts.parse(&args[1..]) { Ok(m) => m, @@ -133,6 +134,14 @@ fn setup(args: &[String]) -> Setup { let mixer_name = matches.opt_str("mixer"); let mixer = mixer::find(mixer_name.as_ref()) .expect("Invalid mixer"); + let initial_volume; + if matches.opt_present("initial-volume"){ + initial_volume = matches.opt_str("initial-volume").unwrap().parse::().unwrap()* 0xFFFF as i32 / 100 ; + } + else{ + initial_volume = 0x8000 as i32; + } + info!("Volume \"{}\" !", initial_volume); let name = matches.opt_str("name").unwrap(); let use_audio_cache = !matches.opt_present("disable-audio-cache"); @@ -180,6 +189,7 @@ fn setup(args: &[String]) -> Setup { ConnectConfig { name: name, device_type: device_type, + volume: initial_volume, } }; @@ -342,4 +352,3 @@ fn main() { core.run(Main::new(handle, setup(&args))).unwrap() } - diff --git a/src/spirc.rs b/src/spirc.rs index 642048fa..4ba7e485 100644 --- a/src/spirc.rs +++ b/src/spirc.rs @@ -142,9 +142,9 @@ impl Spirc { let (cmd_tx, cmd_rx) = mpsc::unbounded(); - let volume = 0x8000; + let volume = config.volume as u16; let device = initial_device_state(config, volume); - mixer.set_volume(volume); + mixer.set_volume(volume as u16); let mut task = SpircTask { player: player, From 1dc99e3a15043c84f55beba607eeb686ec07858d Mon Sep 17 00:00:00 2001 From: fossedihelm Date: Wed, 6 Dec 2017 14:47:46 +0100 Subject: [PATCH 11/56] check if argument of initial-value is a number --- README.md | 7 +++---- src/main.rs | 9 +++++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index eead8760..bfe526c4 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ README. ## Building Rust 1.17.0 or later is required to build librespot. -**If you are building librespot on macOS, the homebrew provided rust may fail due to the way in which homebrew installs rust. In this case, uninstall the homebrew version of rust and use [rustup](https://www.rustup.rs/), and librespot should then build.** +**If you are building librespot on macOS, the homebrew provided rust may fail due to the way in which homebrew installs rust. In this case, uninstall the homebrew version of rust and use [rustup](https://www.rustup.rs/), and librespot should then build.** It also requires a C, with portaudio. @@ -43,7 +43,7 @@ cargo build --release A sample program implementing a headless Spotify Connect receiver is provided. Once you've built *librespot*, run it using : ```shell -target/release/librespot --username USERNAME --cache CACHEDIR --name DEVICENAME +target/release/librespot --username USERNAME --cache CACHEDIR --name DEVICENAME [--initial-volume 20] ``` ## Discovery mode @@ -63,7 +63,7 @@ target/release/librespot [...] --backend portaudio The following backends are currently available : - ALSA -- PortAudio +- PortAudio - PulseAudio ## Cross-compiling @@ -108,4 +108,3 @@ https://gitter.im/sashahilton00/spotify-connect-resources ## License Everything in this repository is licensed under the MIT license. - diff --git a/src/main.rs b/src/main.rs index cd94842d..e59fac8a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -101,7 +101,7 @@ fn setup(args: &[String]) -> Setup { .optopt("", "backend", "Audio backend to use. Use '?' to list options", "BACKEND") .optopt("", "device", "Audio device to use. Use '?' to list options", "DEVICE") .optopt("", "mixer", "Mixer to use", "MIXER") - .optopt("", "initial-volume", "Initial volume in %, once connected", "VOLUME"); + .optopt("", "initial-volume", "Initial volume in %, once connected (must be from 0 to 100)", "VOLUME"); let matches = match opts.parse(&args[1..]) { Ok(m) => m, @@ -136,7 +136,12 @@ fn setup(args: &[String]) -> Setup { .expect("Invalid mixer"); let initial_volume; if matches.opt_present("initial-volume"){ - initial_volume = matches.opt_str("initial-volume").unwrap().parse::().unwrap()* 0xFFFF as i32 / 100 ; + if matches.opt_str("initial-volume").unwrap().parse::().is_ok(){ + initial_volume = matches.opt_str("initial-volume").unwrap().parse::().unwrap()* 0xFFFF as i32 / 100 ; + } + else { + initial_volume = 0x8000 as i32; + } } else{ initial_volume = 0x8000 as i32; From ac39da6c97303fde8267b0fc31f183b34257594e Mon Sep 17 00:00:00 2001 From: fossedihelm Date: Wed, 6 Dec 2017 15:22:28 +0100 Subject: [PATCH 12/56] check if argument of initial-value is in the [0,100 range --- src/main.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index e59fac8a..6bc7d5df 100644 --- a/src/main.rs +++ b/src/main.rs @@ -137,12 +137,21 @@ fn setup(args: &[String]) -> Setup { let initial_volume; if matches.opt_present("initial-volume"){ if matches.opt_str("initial-volume").unwrap().parse::().is_ok(){ - initial_volume = matches.opt_str("initial-volume").unwrap().parse::().unwrap()* 0xFFFF as i32 / 100 ; + if matches.opt_str("initial-volume").unwrap().parse::().unwrap() < 0 { + initial_volume = 0 as i32; } + else if matches.opt_str("initial-volume").unwrap().parse::().unwrap() > 100{ + initial_volume = 0xFFFF as i32; + } + else{ + initial_volume = matches.opt_str("initial-volume").unwrap().parse::().unwrap()* 0xFFFF as i32 / 100 ; + } + + } else { initial_volume = 0x8000 as i32; - } } + } else{ initial_volume = 0x8000 as i32; } From de2b4cc8e38ab33d440e60d822d8833ba9602b8c Mon Sep 17 00:00:00 2001 From: fossedihelm Date: Thu, 7 Dec 2017 11:36:26 +0100 Subject: [PATCH 13/56] added comments and edited README --- README.md | 1 + src/main.rs | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f7a20ddc..f288d2b7 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,7 @@ target/release/librespot --username USERNAME --cache CACHEDIR --name DEVICENAME | Option | | backend | Audio backend to use. Use '?' to list options | BACKEND | | Option | | device | Audio device to use. Use '?' to list options | DEVICE | | Option | | mixer | Mixer to use | MIXER | +| Option | | initial-volume | Initial volume in %, once connected [0-100] | VOLUME | Taken from here: https://github.com/ComlOnline/librespot/blob/master/src/main.rs#L88 diff --git a/src/main.rs b/src/main.rs index 6bc7d5df..c6208f2b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -135,27 +135,32 @@ fn setup(args: &[String]) -> Setup { let mixer = mixer::find(mixer_name.as_ref()) .expect("Invalid mixer"); let initial_volume; + // check if initial-volume argument is present if matches.opt_present("initial-volume"){ + // check if value is a number if matches.opt_str("initial-volume").unwrap().parse::().is_ok(){ + // check if value is in [0-100] range, otherwise put the bound values if matches.opt_str("initial-volume").unwrap().parse::().unwrap() < 0 { initial_volume = 0 as i32; } else if matches.opt_str("initial-volume").unwrap().parse::().unwrap() > 100{ initial_volume = 0xFFFF as i32; } + // checks ok else{ initial_volume = matches.opt_str("initial-volume").unwrap().parse::().unwrap()* 0xFFFF as i32 / 100 ; } - } + // if value is not a number use default value (50%) else { initial_volume = 0x8000 as i32; } } + // if argument not present use default values (50%) else{ initial_volume = 0x8000 as i32; } - info!("Volume \"{}\" !", initial_volume); + debug!("Volume \"{}\" !", initial_volume); let name = matches.opt_str("name").unwrap(); let use_audio_cache = !matches.opt_present("disable-audio-cache"); From 35ec580eac78ab43684f7d2c24de71153db582ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20B=C3=A4chler?= Date: Sun, 17 Dec 2017 14:29:58 +0100 Subject: [PATCH 14/56] Disable the "variable does not need to be mutable" compiler warning in generated code --- core/src/lib.in.rs | 1 + src/lib.in.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/core/src/lib.in.rs b/core/src/lib.in.rs index b3b606b4..c534cec4 100644 --- a/core/src/lib.in.rs +++ b/core/src/lib.in.rs @@ -1 +1,2 @@ +#[allow(unused_mut)] pub mod connection; diff --git a/src/lib.in.rs b/src/lib.in.rs index be92c5d8..9dc5e82c 100644 --- a/src/lib.in.rs +++ b/src/lib.in.rs @@ -1 +1,2 @@ +#[allow(unused_mut)] pub mod spirc; From f5d8019c18ef565b237bbefea9c2dbdde23cd374 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20B=C3=A4chler?= Date: Mon, 27 Nov 2017 20:01:30 +0100 Subject: [PATCH 15/56] Add proper error handling to the pulseaudio backend and ensure that no invalid pointers are passed to pulseaudio --- Cargo.lock | 15 +++--- Cargo.toml | 3 +- src/audio_backend/pulseaudio.rs | 92 +++++++++++++++++++++++---------- src/lib.rs | 3 ++ 4 files changed, 79 insertions(+), 34 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d8128db1..eaddea19 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,10 +1,3 @@ -[root] -name = "librespot-protocol" -version = "0.1.0" -dependencies = [ - "protobuf 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "aho-corasick" version = "0.6.3" @@ -271,6 +264,7 @@ dependencies = [ "futures 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", "libpulse-sys 0.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "librespot-audio 0.1.0", "librespot-core 0.1.0", @@ -353,6 +347,13 @@ dependencies = [ "protobuf 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "librespot-protocol" +version = "0.1.0" +dependencies = [ + "protobuf 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "linear-map" version = "1.2.0" diff --git a/Cargo.toml b/Cargo.toml index f4e63498..82bef079 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -52,6 +52,7 @@ url = "1.3" alsa = { git = "https://github.com/plietar/rust-alsa", optional = true } portaudio-rs = { version = "0.3.0", optional = true } libpulse-sys = { version = "0.0.0", optional = true } +libc = { version = "0.2", optional = true } [build-dependencies] rand = "0.3.13" @@ -61,7 +62,7 @@ protobuf_macros = { git = "https://github.com/plietar/rust-protobuf-macros", fea [features] alsa-backend = ["alsa"] portaudio-backend = ["portaudio-rs"] -pulseaudio-backend = ["libpulse-sys"] +pulseaudio-backend = ["libpulse-sys", "libc"] with-tremor = ["librespot-audio/with-tremor"] with-lewton = ["librespot-audio/with-lewton"] diff --git a/src/audio_backend/pulseaudio.rs b/src/audio_backend/pulseaudio.rs index 5e3b8c18..e9f0039b 100644 --- a/src/audio_backend/pulseaudio.rs +++ b/src/audio_backend/pulseaudio.rs @@ -2,8 +2,10 @@ use super::{Open, Sink}; use std::io; use libpulse_sys::*; use std::ptr::{null, null_mut}; -use std::mem::{transmute}; use std::ffi::CString; +use std::ffi::CStr; +use std::mem; +use libc; pub struct PulseAudioSink { s : *mut pa_simple, @@ -12,6 +14,39 @@ pub struct PulseAudioSink { desc : CString } +fn call_pulseaudio(f: F, fail_check: FailCheck, kind: io::ErrorKind) -> io::Result where + T: Copy, + F: Fn(*mut libc::c_int) -> T, + FailCheck: Fn(T) -> bool, +{ + let mut error: libc::c_int = 0; + let ret = f(&mut error); + if fail_check(ret) { + let err_cstr = unsafe { CStr::from_ptr(pa_strerror(error)) }; + let errstr = err_cstr.to_string_lossy().into_owned(); + Err(io::Error::new(kind, errstr)) + } else { + Ok(ret) + } +} + +impl PulseAudioSink { + fn free_connection(&mut self) { + if self.s != null_mut() { + unsafe { + pa_simple_free(self.s); + } + self.s = null_mut(); + } + } +} + +impl Drop for PulseAudioSink { + fn drop(&mut self) { + self.free_connection(); + } +} + impl Open for PulseAudioSink { fn open(device: Option) -> PulseAudioSink { debug!("Using PulseAudio sink"); @@ -27,7 +62,7 @@ impl Open for PulseAudioSink { }; let name = CString::new("librespot").unwrap(); - let description = CString::new("A spoty client library").unwrap(); + let description = CString::new("Spotify endpoint").unwrap(); PulseAudioSink { s: null_mut(), @@ -41,38 +76,43 @@ impl Open for PulseAudioSink { impl Sink for PulseAudioSink { fn start(&mut self) -> io::Result<()> { if self.s == null_mut() { - self.s = unsafe { - pa_simple_new(null(), // Use the default server. - self.name.as_ptr(), // Our application's name. - PA_STREAM_PLAYBACK, - null(), // Use the default device. - self.desc.as_ptr(), // desc of our stream. - &self.ss, // Our sample format. - null(), // Use default channel map - null(), // Use default buffering attributes. - null_mut(), // Ignore error code. - ) - }; - assert!(self.s != null_mut()); + self.s = call_pulseaudio( + |err| unsafe { + pa_simple_new(null(), // Use the default server. + self.name.as_ptr(), // Our application's name. + PA_STREAM_PLAYBACK, + null(), // Use the default device. + self.desc.as_ptr(), // desc of our stream. + &self.ss, // Our sample format. + null(), // Use default channel map + null(), // Use default buffering attributes. + err) + }, + |ptr| ptr == null_mut(), + io::ErrorKind::ConnectionRefused)?; } Ok(()) } fn stop(&mut self) -> io::Result<()> { - unsafe { - pa_simple_free(self.s); - } - self.s = null_mut(); + self.free_connection(); Ok(()) } fn write(&mut self, data: &[i16]) -> io::Result<()> { - unsafe { - let ptr = transmute(data.as_ptr()); - let bytes = data.len() as usize * 2; - pa_simple_write(self.s, ptr, bytes, null_mut()); - }; - - Ok(()) + if self.s == null_mut() { + Err(io::Error::new(io::ErrorKind::NotConnected, "Not connected to pulseaudio")) + } + else { + let ptr = data.as_ptr() as *const libc::c_void; + let len = data.len() as usize * mem::size_of::(); + call_pulseaudio( + |err| unsafe { + pa_simple_write(self.s, ptr, len, err) + }, + |ret| ret < 0, + io::ErrorKind::BrokenPipe)?; + Ok(()) + } } } diff --git a/src/lib.rs b/src/lib.rs index b9c920ec..5eaab011 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -34,6 +34,9 @@ extern crate portaudio_rs; #[cfg(feature = "libpulse-sys")] extern crate libpulse_sys; +#[cfg(feature = "libc")] +extern crate libc; + pub mod audio_backend; pub mod discovery; pub mod keymaster; From f250179fed78ecc5f26e55085f8f59043e6c3da5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20B=C3=A4chler?= Date: Tue, 28 Nov 2017 00:35:04 +0100 Subject: [PATCH 16/56] Join the player thread when the player is dropped --- src/player.rs | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/src/player.rs b/src/player.rs index 29380e33..c07082f6 100644 --- a/src/player.rs +++ b/src/player.rs @@ -16,9 +16,9 @@ use audio::{VorbisDecoder, VorbisPacket}; use metadata::{FileFormat, Track, Metadata}; use mixer::AudioFilter; -#[derive(Clone)] pub struct Player { - commands: std::sync::mpsc::Sender, + commands: Option>, + thread_handle: Option>, } struct PlayerInternal { @@ -47,7 +47,7 @@ impl Player { { let (cmd_tx, cmd_rx) = std::sync::mpsc::channel(); - thread::spawn(move || { + let handle = thread::spawn(move || { debug!("new Player[{}]", session.session_id()); let internal = PlayerInternal { @@ -64,12 +64,13 @@ impl Player { }); Player { - commands: cmd_tx, + commands: Some(cmd_tx), + thread_handle: Some(handle), } } fn command(&self, cmd: PlayerCommand) { - self.commands.send(cmd).unwrap(); + self.commands.as_ref().unwrap().send(cmd).unwrap(); } pub fn load(&self, track: SpotifyId, start_playing: bool, position_ms: u32) @@ -98,6 +99,19 @@ impl Player { } } +impl Drop for Player { + fn drop(&mut self) { + debug!("Shutting down player thread ..."); + self.commands = None; + if let Some(handle) = self.thread_handle.take() { + match handle.join() { + Ok(_) => (), + Err(_) => error!("Player thread panicked!") + } + } + } +} + type Decoder = VorbisDecoder>>; enum PlayerState { Stopped, From 4cda8affcd188815ef552889676eca0b6bf1724f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20B=C3=A4chler?= Date: Wed, 29 Nov 2017 00:18:12 +0100 Subject: [PATCH 17/56] Handle audio sink errors in the player Failing to open or write to the audio sink is not necessarily a fatal and permanent error. When the audio sink fails, the player now tries to restart the sink periodically. --- src/player.rs | 77 +++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 60 insertions(+), 17 deletions(-) diff --git a/src/player.rs b/src/player.rs index c07082f6..94df2e1c 100644 --- a/src/player.rs +++ b/src/player.rs @@ -2,8 +2,9 @@ use futures::sync::oneshot; use futures::{future, Future}; use std::borrow::Cow; use std::mem; -use std::sync::mpsc::{RecvError, TryRecvError}; +use std::sync::mpsc::{RecvError, TryRecvError, RecvTimeoutError}; use std::thread; +use std::time::Duration; use std; use core::config::{Bitrate, PlayerConfig}; @@ -28,6 +29,7 @@ struct PlayerInternal { state: PlayerState, sink: Box, + sink_running: bool, audio_filter: Option>, } @@ -57,6 +59,7 @@ impl Player { state: PlayerState::Stopped, sink: sink_builder(), + sink_running: false, audio_filter: audio_filter, }; @@ -191,10 +194,21 @@ impl PlayerInternal { fn run(mut self) { loop { let cmd = if self.state.is_playing() { - match self.commands.try_recv() { - Ok(cmd) => Some(cmd), - Err(TryRecvError::Empty) => None, - Err(TryRecvError::Disconnected) => return, + if self.sink_running + { + match self.commands.try_recv() { + Ok(cmd) => Some(cmd), + Err(TryRecvError::Empty) => None, + Err(TryRecvError::Disconnected) => return, + } + } + else + { + match self.commands.recv_timeout(Duration::from_secs(5)) { + Ok(cmd) => Some(cmd), + Err(RecvTimeoutError::Timeout) => None, + Err(RecvTimeoutError::Disconnected) => return, + } } } else { match self.commands.recv() { @@ -207,16 +221,42 @@ impl PlayerInternal { self.handle_command(cmd); } - let packet = if let PlayerState::Playing { ref mut decoder, .. } = self.state { - Some(decoder.next_packet().expect("Vorbis error")) - } else { None }; + if self.state.is_playing() && ! self.sink_running { + self.start_sink(); + } - if let Some(packet) = packet { - self.handle_packet(packet); + if self.sink_running { + let packet = if let PlayerState::Playing { ref mut decoder, .. } = self.state { + Some(decoder.next_packet().expect("Vorbis error")) + } else { + None + }; + + if let Some(packet) = packet { + self.handle_packet(packet); + } } } } + fn start_sink(&mut self) { + match self.sink.start() { + Ok(()) => self.sink_running = true, + Err(err) => error!("Could not start audio: {}", err), + } + } + + fn stop_sink_if_running(&mut self) { + if self.sink_running { + self.stop_sink(); + } + } + + fn stop_sink(&mut self) { + self.sink.stop().unwrap(); + self.sink_running = false; + } + fn handle_packet(&mut self, packet: Option) { match packet { Some(mut packet) => { @@ -224,11 +264,14 @@ impl PlayerInternal { editor.modify_stream(&mut packet.data_mut()) }; - self.sink.write(&packet.data()).unwrap(); + if let Err(err) = self.sink.write(&packet.data()) { + error!("Could not write audio: {}", err); + self.stop_sink(); + } } None => { - self.sink.stop().unwrap(); + self.stop_sink(); self.run_onstop(); let old_state = mem::replace(&mut self.state, PlayerState::Stopped); @@ -242,7 +285,7 @@ impl PlayerInternal { match cmd { PlayerCommand::Load(track_id, play, position, end_of_track) => { if self.state.is_playing() { - self.sink.stop().unwrap(); + self.stop_sink_if_running(); } match self.load_track(track_id, position as i64) { @@ -251,7 +294,7 @@ impl PlayerInternal { if !self.state.is_playing() { self.run_onstart(); } - self.sink.start().unwrap(); + self.start_sink(); self.state = PlayerState::Playing { decoder: decoder, @@ -294,7 +337,7 @@ impl PlayerInternal { self.state.paused_to_playing(); self.run_onstart(); - self.sink.start().unwrap(); + self.start_sink(); } else { warn!("Player::play called from invalid state"); } @@ -304,7 +347,7 @@ impl PlayerInternal { if let PlayerState::Playing { .. } = self.state { self.state.playing_to_paused(); - self.sink.stop().unwrap(); + self.stop_sink_if_running(); self.run_onstop(); } else { warn!("Player::pause called from invalid state"); @@ -314,7 +357,7 @@ impl PlayerInternal { PlayerCommand::Stop => { match self.state { PlayerState::Playing { .. } => { - self.sink.stop().unwrap(); + self.stop_sink_if_running(); self.run_onstop(); self.state = PlayerState::Stopped; } From 104dd61e6b51fc80649e6f5b4fb2d8c87e5f80bc Mon Sep 17 00:00:00 2001 From: Colm Date: Tue, 19 Dec 2017 21:53:58 +0000 Subject: [PATCH 18/56] Update README.md Added people to thanks --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index f288d2b7..34dec752 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,8 @@ I've done noting more than make this pretty so big thanks to: [plietar](https://github.com/plietar/) for making the thing in the first place. [kingosticks](https://github.com/kingosticks/) For the Suffling and Repeat. [ipha](https://github.com/ipha/) For the start stop audio sink. +[fossedihelm](https://github.com/fossedihelm/) for [addind a default inital volume and options for it](https://github.com/ComlOnline/librespot/pull/5) +[brain0](https://github.com/brain0/) for [making pluseaudio more robust against audio failures](https://github.com/ComlOnline/librespot/pull/6) ## Building Rust 1.17.0 or later is required to build librespot. From 5a71777a31c47c851e33b1d6fa49b0617190832b Mon Sep 17 00:00:00 2001 From: Colm Date: Tue, 19 Dec 2017 21:55:19 +0000 Subject: [PATCH 19/56] Update README.md Formatting --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 34dec752..cbd1bf3c 100644 --- a/README.md +++ b/README.md @@ -15,8 +15,8 @@ As the origin is no longer maintained I wanted to have a place for a version of # THANKS I've done noting more than make this pretty so big thanks to: [plietar](https://github.com/plietar/) for making the thing in the first place. -[kingosticks](https://github.com/kingosticks/) For the Suffling and Repeat. -[ipha](https://github.com/ipha/) For the start stop audio sink. +[kingosticks](https://github.com/kingosticks/) for the Suffling and Repeat. +[ipha](https://github.com/ipha/) for the start stop audio sink. [fossedihelm](https://github.com/fossedihelm/) for [addind a default inital volume and options for it](https://github.com/ComlOnline/librespot/pull/5) [brain0](https://github.com/brain0/) for [making pluseaudio more robust against audio failures](https://github.com/ComlOnline/librespot/pull/6) From b6a38780df75c89198c8ae2ef179b5b3a34f4f60 Mon Sep 17 00:00:00 2001 From: Colm Date: Mon, 8 Jan 2018 20:50:20 +0000 Subject: [PATCH 20/56] Changed requirements see #3 I jumped the gun --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cbd1bf3c..bd8bf64c 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ applications to use Spotify's service, without using the official but closed-source libspotify. Additionally, it will provide extra features which are not available in the official library. -Note: librespot needs to be logged in and only works with Spotify Premium +Note: librespot only works with Spotify Premium # THIS FORK As the origin is no longer maintained I wanted to have a place for a version of librespot with other peoples forks and features merged. From a1a3a2e7722355c43e5668cd1cc0dcfcc73aa062 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20B=C3=A4chler?= Date: Sun, 21 Jan 2018 19:47:25 +0100 Subject: [PATCH 21/56] core: Remove an unneeded use warning --- core/src/util/spotify_id.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/src/util/spotify_id.rs b/core/src/util/spotify_id.rs index dc22a972..8ebd5a84 100644 --- a/core/src/util/spotify_id.rs +++ b/core/src/util/spotify_id.rs @@ -2,6 +2,8 @@ use std; use std::fmt; use util::u128; use byteorder::{BigEndian, ByteOrder}; +// Unneeded since 1.21 +#[allow(unused_imports)] use std::ascii::AsciiExt; #[derive(Debug,Copy,Clone,PartialEq,Eq,Hash)] From 608e8249a2815b9332e590750b7f1bfece6901ac Mon Sep 17 00:00:00 2001 From: Colm Date: Tue, 23 Jan 2018 00:25:58 +0000 Subject: [PATCH 22/56] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index bd8bf64c..be46aebf 100644 --- a/README.md +++ b/README.md @@ -8,12 +8,12 @@ which are not available in the official library. Note: librespot only works with Spotify Premium -# THIS FORK +# This fork As the origin is no longer maintained I wanted to have a place for a version of librespot with other peoples forks and features merged. -# THANKS -I've done noting more than make this pretty so big thanks to: +# Credits +I've done nothing more than make this pretty so big thanks to: [plietar](https://github.com/plietar/) for making the thing in the first place. [kingosticks](https://github.com/kingosticks/) for the Suffling and Repeat. [ipha](https://github.com/ipha/) for the start stop audio sink. From 1442e9a1a11b92e37dbf8030d8fc576ff104e44c Mon Sep 17 00:00:00 2001 From: Colm Date: Tue, 23 Jan 2018 19:30:28 +0000 Subject: [PATCH 23/56] Update README.md --- README.md | 76 +++---------------------------------------------------- 1 file changed, 3 insertions(+), 73 deletions(-) diff --git a/README.md b/README.md index be46aebf..25c80d0d 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,8 @@ Note: librespot only works with Spotify Premium # This fork As the origin is no longer maintained I wanted to have a place for a version of librespot with other peoples forks and features merged. +# Wiki +More information can befound in the [wiki](https://github.com/ComlOnline/librespot/wiki) # Credits I've done nothing more than make this pretty so big thanks to: @@ -51,80 +53,8 @@ cargo build --release A sample program implementing a headless Spotify Connect receiver is provided. Once you've built *librespot*, run it using : ```shell -target/release/librespot --username USERNAME --cache CACHEDIR --name DEVICENAME [--initial-volume 20] +target/release/librespot --name DEVICENAME ``` - -### All options - -| Type | Short | Long | Description | Hint | -|----------|-------|---------------------|-------------------------------------------------|-------------| -| Option | c | cache | Path to a directory where files will be cached. | CACHE | -| Flag | | disable-audio-cache | Disable caching of the audio data. | | -| Required | n | name | Device name | NAME | -| Option | | device-type | Displayed device type | DEVICE_TYPE | -| Option | b | bitrate | Bitrate (96, 160 or 320). Defaults to 160 | BITRATE | -| Option | | onstart | Run PROGRAM when playback is about to begin. | | -| Option | | onstop | Run PROGRAM when playback has ended. | PROGRAM | -| Flag | v | verbose | Enable verbose output | PROGRAM | -| Option | u | username | Username to sign in with | USERNAME | -| Option | p | password | Password | PASSWORD | -| Flag | | disable-discovery | Disable discovery mode | | -| Option | | backend | Audio backend to use. Use '?' to list options | BACKEND | -| Option | | device | Audio device to use. Use '?' to list options | DEVICE | -| Option | | mixer | Mixer to use | MIXER | -| Option | | initial-volume | Initial volume in %, once connected [0-100] | VOLUME | - -Taken from here: -https://github.com/ComlOnline/librespot/blob/master/src/main.rs#L88 - -## Audio Backends -*librespot* supports various audio backends. Multiple backends can be enabled at compile time by enabling the -corresponding cargo feature. By default, only PortAudio is enabled. - -A specific backend can selected at runtime using the `--backend` switch. - -```shell -cargo build --features portaudio-backend -target/release/librespot [...] --backend portaudio -``` - -The following backends are currently available : -- ALSA -- PortAudio -- PulseAudio - -## Cross-compiling -A cross compilation environment is provided as a docker image. -Build the image from the root of the project with the following command : - -``` -$ docker build -t librespot-cross -f contrib/Dockerfile . -``` - -The resulting image can be used to build librespot for linux x86_64, armhf (compatible e. g. with Raspberry Pi 2 or 3, but not with Raspberry Pi 1 or Zero) and armel. -The compiled binaries will be located in /tmp/librespot-build - -``` -docker run -v /tmp/librespot-build:/build librespot-cross -``` - -If only one architecture is desired, cargo can be invoked directly with the appropriate options : -```shell -docker run -v /tmp/librespot-build:/build librespot-cross cargo build --release --no-default-features --features alsa-backend -docker run -v /tmp/librespot-build:/build librespot-cross cargo build --release --target arm-unknown-linux-gnueabihf --no-default-features --features alsa-backend -docker run -v /tmp/librespot-build:/build librespot-cross cargo build --release --target arm-unknown-linux-gnueabi --no-default-features --features alsa-backend -``` - -Don't forget to set the `with-tremor` feature flag if your target device does not have floating-point capabilities. - -## Development -When developing *librespot*, it is preferable to use Rust nightly, and build it using the following : -```shell -cargo build --no-default-features --features "nightly portaudio-backend" -``` - -This produces better compilation error messages than with the default configuration. - ## Disclaimer Using this code to connect to Spotify's API is probably forbidden by them. Use at your own risk. From 838523d49de7fac0b59aeabc0fc6120a230cb1f2 Mon Sep 17 00:00:00 2001 From: Colm Date: Tue, 23 Jan 2018 19:31:27 +0000 Subject: [PATCH 24/56] Update README.md --- README.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 25c80d0d..b02f1c25 100644 --- a/README.md +++ b/README.md @@ -14,14 +14,6 @@ As the origin is no longer maintained I wanted to have a place for a version of # Wiki More information can befound in the [wiki](https://github.com/ComlOnline/librespot/wiki) -# Credits -I've done nothing more than make this pretty so big thanks to: -[plietar](https://github.com/plietar/) for making the thing in the first place. -[kingosticks](https://github.com/kingosticks/) for the Suffling and Repeat. -[ipha](https://github.com/ipha/) for the start stop audio sink. -[fossedihelm](https://github.com/fossedihelm/) for [addind a default inital volume and options for it](https://github.com/ComlOnline/librespot/pull/5) -[brain0](https://github.com/brain0/) for [making pluseaudio more robust against audio failures](https://github.com/ComlOnline/librespot/pull/6) - ## Building Rust 1.17.0 or later is required to build librespot. @@ -55,6 +47,15 @@ Once you've built *librespot*, run it using : ```shell target/release/librespot --name DEVICENAME ``` + +# Credits +I've done nothing more than make this pretty so big thanks to: +[plietar](https://github.com/plietar/) for making the thing in the first place. +[kingosticks](https://github.com/kingosticks/) for the Suffling and Repeat. +[ipha](https://github.com/ipha/) for the start stop audio sink. +[fossedihelm](https://github.com/fossedihelm/) for [addind a default inital volume and options for it](https://github.com/ComlOnline/librespot/pull/5) +[brain0](https://github.com/brain0/) for [making pluseaudio more robust against audio failures](https://github.com/ComlOnline/librespot/pull/6) + ## Disclaimer Using this code to connect to Spotify's API is probably forbidden by them. Use at your own risk. From 977664f5fe22befd84938a21711ada7d196959b3 Mon Sep 17 00:00:00 2001 From: Colm Date: Tue, 23 Jan 2018 19:31:49 +0000 Subject: [PATCH 25/56] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b02f1c25..33a8ecd6 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ which are not available in the official library. Note: librespot only works with Spotify Premium -# This fork +## This fork As the origin is no longer maintained I wanted to have a place for a version of librespot with other peoples forks and features merged. # Wiki From b819f632cf9de164d0c6957511ca3095436c8318 Mon Sep 17 00:00:00 2001 From: Colm Date: Tue, 23 Jan 2018 19:32:29 +0000 Subject: [PATCH 26/56] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 33a8ecd6..fd8ec429 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ As the origin is no longer maintained I wanted to have a place for a version of # Wiki More information can befound in the [wiki](https://github.com/ComlOnline/librespot/wiki) -## Building +# Building Rust 1.17.0 or later is required to build librespot. **If you are building librespot on macOS, the homebrew provided rust may fail due to the way in which homebrew installs rust. In this case, uninstall the homebrew version of rust and use [rustup](https://www.rustup.rs/), and librespot should then build.** @@ -48,7 +48,7 @@ Once you've built *librespot*, run it using : target/release/librespot --name DEVICENAME ``` -# Credits +## Credits I've done nothing more than make this pretty so big thanks to: [plietar](https://github.com/plietar/) for making the thing in the first place. [kingosticks](https://github.com/kingosticks/) for the Suffling and Repeat. From f966440f987b1e9ce9bd4fb785b9ccef97df663d Mon Sep 17 00:00:00 2001 From: Colm Date: Thu, 25 Jan 2018 01:34:56 +0000 Subject: [PATCH 27/56] Updated links and Travis badge --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index fd8ec429..881663bb 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Build Status](https://travis-ci.org/ComlOnline/librespot.svg?branch=master)](https://travis-ci.org/ComlOnline/librespot) +[![Build Status](https://travis-ci.org/librespot-org/librespot.svg?branch=master)](https://travis-ci.org/librespot-org/librespot) # librespot *librespot* is an open source client library for Spotify. It enables @@ -12,7 +12,7 @@ Note: librespot only works with Spotify Premium As the origin is no longer maintained I wanted to have a place for a version of librespot with other peoples forks and features merged. # Wiki -More information can befound in the [wiki](https://github.com/ComlOnline/librespot/wiki) +More information can befound in the [wiki](https://github.com/librespot-org/librespot/wiki) # Building Rust 1.17.0 or later is required to build librespot. @@ -53,8 +53,8 @@ I've done nothing more than make this pretty so big thanks to: [plietar](https://github.com/plietar/) for making the thing in the first place. [kingosticks](https://github.com/kingosticks/) for the Suffling and Repeat. [ipha](https://github.com/ipha/) for the start stop audio sink. -[fossedihelm](https://github.com/fossedihelm/) for [addind a default inital volume and options for it](https://github.com/ComlOnline/librespot/pull/5) -[brain0](https://github.com/brain0/) for [making pluseaudio more robust against audio failures](https://github.com/ComlOnline/librespot/pull/6) +[fossedihelm](https://github.com/fossedihelm/) for [addind a default inital volume and options for it](https://github.com/librespot-org/librespot/pull/5) +[brain0](https://github.com/brain0/) for [making pluseaudio more robust against audio failures](https://github.com/librespot-org/librespot/pull/6) ## Disclaimer Using this code to connect to Spotify's API is probably forbidden by them. From 644355269e8825a4b6669fd2a058ae8d4be0e938 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20B=C3=A4chler?= Date: Sun, 21 Jan 2018 19:51:48 +0100 Subject: [PATCH 28/56] Use futures::sync::oneshot::Sender::send() instead of the deprecated complete() --- core/src/audio_key.rs | 4 ++-- core/src/mercury/mod.rs | 4 ++-- src/player.rs | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/core/src/audio_key.rs b/core/src/audio_key.rs index 2d6a21ee..e19c5b87 100644 --- a/core/src/audio_key.rs +++ b/core/src/audio_key.rs @@ -32,11 +32,11 @@ impl AudioKeyManager { 0xd => { let mut key = [0u8; 16]; key.copy_from_slice(data.as_ref()); - sender.complete(Ok(AudioKey(key))); + let _ = sender.send(Ok(AudioKey(key))); } 0xe => { warn!("error audio key {:x} {:x}", data.as_ref()[0], data.as_ref()[1]); - sender.complete(Err(AudioKeyError)); + let _ = sender.send(Err(AudioKeyError)); } _ => (), } diff --git a/core/src/mercury/mod.rs b/core/src/mercury/mod.rs index 2bf52a11..23a3224e 100644 --- a/core/src/mercury/mod.rs +++ b/core/src/mercury/mod.rs @@ -199,7 +199,7 @@ impl MercuryManager { if response.status_code >= 400 { warn!("error {} for uri {}", response.status_code, &response.uri); if let Some(cb) = pending.callback { - cb.complete(Err(MercuryError)); + let _ = cb.send(Err(MercuryError)); } } else { if cmd == 0xb5 { @@ -223,7 +223,7 @@ impl MercuryManager { } }) } else if let Some(cb) = pending.callback { - cb.complete(Ok(response)); + let _ = cb.send(Ok(response)); } } } diff --git a/src/player.rs b/src/player.rs index 94df2e1c..ffffa130 100644 --- a/src/player.rs +++ b/src/player.rs @@ -155,7 +155,7 @@ impl PlayerState { match self { Paused { end_of_track, .. } | Playing { end_of_track, .. } => { - end_of_track.complete(()) + let _ = end_of_track.send(()); } Stopped => warn!("signal_end_of_track from stopped state"), @@ -313,7 +313,7 @@ impl PlayerInternal { } None => { - end_of_track.complete(()); + let _ = end_of_track.send(()); if self.state.is_playing() { self.run_onstop(); } From 0bdf9aa08035b9fde2346cd196cd19ab38a72239 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20B=C3=A4chler?= Date: Sun, 21 Jan 2018 20:02:01 +0100 Subject: [PATCH 29/56] Update all dependencies --- Cargo.lock | 581 ++++++++++++++++++++++++++++------------------------- 1 file changed, 308 insertions(+), 273 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index eaddea19..a46d537e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,9 +1,9 @@ [[package]] name = "aho-corasick" -version = "0.6.3" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "memchr 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -11,7 +11,7 @@ name = "alsa" version = "0.0.1" source = "git+https://github.com/plietar/rust-alsa#8c63543fa0ccd971cf15f5675293d19febd6f79e" dependencies = [ - "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -27,15 +27,15 @@ name = "base64" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "base64" -version = "0.6.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "safemem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -67,6 +67,11 @@ name = "bitflags" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "bitflags" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "byteorder" version = "0.5.3" @@ -74,16 +79,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "byteorder" -version = "1.1.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "bytes" -version = "0.4.4" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "iovec 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "iovec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -91,19 +96,6 @@ name = "cfg-if" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "conv" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "custom_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "custom_derive" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "dns-parser" version = "0.3.2" @@ -111,12 +103,12 @@ source = "git+https://github.com/plietar/dns-parser#1d3e5a5591bc72eb061c23bd426c dependencies = [ "byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "quick-error 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "quick-error 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "dtoa" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -124,8 +116,8 @@ name = "env_logger" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -133,55 +125,70 @@ name = "error-chain" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "fuchsia-zircon" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "fuchsia-zircon-sys" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "futures" -version = "0.1.14" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "futures-cpupool" -version = "0.1.5" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "gcc" -version = "0.3.51" +version = "0.3.54" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "getopts" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "httparse" -version = "1.2.3" +version = "1.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "hyper" -version = "0.11.2" +version = "0.11.14" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "base64 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "bytes 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-cpupool 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "httparse 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "base64 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-cpupool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "httparse 1.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "mime 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "percent-encoding 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-core 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "mime 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", + "percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "relay 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-core 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-proto 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-service 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "unicase 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "unicase 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -196,16 +203,16 @@ dependencies = [ [[package]] name = "iovec" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "itoa" -version = "0.3.1" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -224,12 +231,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "lazy_static" -version = "0.2.8" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "lazy_static" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "lazycell" -version = "0.5.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -237,13 +249,13 @@ name = "lewton" version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "ogg 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "ogg 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libc" -version = "0.2.29" +version = "0.2.36" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -251,7 +263,7 @@ name = "libpulse-sys" version = "0.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -261,30 +273,30 @@ dependencies = [ "alsa 0.0.1 (git+https://github.com/plietar/rust-alsa)", "base64 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", - "getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "hyper 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "getopts 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper 0.11.14 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "libpulse-sys 0.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "librespot-audio 0.1.0", "librespot-core 0.1.0", "librespot-metadata 0.1.0", "librespot-protocol 0.1.0", - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "mdns 0.2.0 (git+https://github.com/plietar/rust-mdns)", - "num-bigint 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "num-bigint 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", "portaudio-rs 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "protobuf 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "protobuf 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "protobuf_macros 0.6.0 (git+https://github.com/plietar/rust-protobuf-macros)", - "rand 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)", "rpassword 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "rust-crypto 0.2.36 (git+https://github.com/awmath/rust-crypto.git?branch=avx2)", "serde 0.9.15 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 0.9.15 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 0.9.10 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-core 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-signal 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "url 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-core 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-signal 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "url 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "vergen 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -293,15 +305,15 @@ name = "librespot-audio" version = "0.1.0" dependencies = [ "bit-set 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "lewton 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "librespot-core 0.1.0", - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "num-bigint 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "num-bigint 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", "rust-crypto 0.2.36 (git+https://github.com/awmath/rust-crypto.git?branch=avx2)", - "tempfile 2.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "tremor 0.1.0 (git+https://github.com/plietar/rust-tremor)", "vorbis 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -311,26 +323,26 @@ name = "librespot-core" version = "0.1.0" dependencies = [ "base64 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "error-chain 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", - "hyper 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper 0.11.14 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "librespot-protocol 0.1.0", - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "num-bigint 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "num-bigint 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", "num-integer 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", - "protobuf 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", + "protobuf 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "protobuf_macros 0.6.0 (git+https://github.com/plietar/rust-protobuf-macros)", - "rand 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)", "rpassword 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "rust-crypto 0.2.36 (git+https://github.com/awmath/rust-crypto.git?branch=avx2)", "serde 0.9.15 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 0.9.15 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 0.9.10 (registry+https://github.com/rust-lang/crates.io-index)", "shannon 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-core 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-core 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "uuid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "vergen 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -339,19 +351,19 @@ dependencies = [ name = "librespot-metadata" version = "0.1.0" dependencies = [ - "byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "librespot-core 0.1.0", "librespot-protocol 0.1.0", "linear-map 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "protobuf 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "protobuf 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "librespot-protocol" version = "0.1.0" dependencies = [ - "protobuf 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "protobuf 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -361,24 +373,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "log" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "magenta" -version = "0.1.1" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "magenta-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "magenta-sys" -version = "0.1.1" +name = "log" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -391,48 +397,48 @@ name = "mdns" version = "0.2.0" source = "git+https://github.com/plietar/rust-mdns#c0fc73502d7d752a4ffeb5268a017561405e218c" dependencies = [ - "byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "dns-parser 0.3.2 (git+https://github.com/plietar/dns-parser)", - "futures 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "multimap 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "net2 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)", + "net2 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "nix 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-core 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-core 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "memchr" -version = "1.0.1" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "mime" -version = "0.3.2" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "unicase 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "unicase 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "mio" -version = "0.6.10" +version = "0.6.12" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "iovec 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "iovec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "lazycell 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "magenta 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "magenta-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lazycell 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "net2 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)", + "net2 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -442,8 +448,8 @@ name = "mio-uds" version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", - "mio 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -452,7 +458,7 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "net2 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)", + "net2 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -464,12 +470,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "net2" -version = "0.2.30" +version = "0.2.31" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -481,18 +487,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "num-bigint" -version = "0.1.40" +version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "num-integer 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -501,28 +507,28 @@ name = "num-integer" version = "0.1.35" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "num-traits" -version = "0.1.40" +version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "num_cpus" -version = "1.6.2" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "ogg" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -530,14 +536,14 @@ name = "ogg-sys" version = "0.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gcc 0.3.51 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.54 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "percent-encoding" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -551,7 +557,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "portaudio-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -560,13 +566,13 @@ name = "portaudio-sys" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "protobuf" -version = "1.4.1" +version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -581,7 +587,7 @@ dependencies = [ [[package]] name = "quick-error" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -591,42 +597,50 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "rand" -version = "0.3.16" +version = "0.3.20" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", - "magenta 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "redox_syscall" -version = "0.1.29" +version = "0.1.37" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "regex" -version = "0.2.2" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "aho-corasick 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "thread_local 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "thread_local 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "utf8-ranges 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex-syntax" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "relay" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rpassword" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "termios 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -636,11 +650,11 @@ name = "rust-crypto" version = "0.2.36" source = "git+https://github.com/awmath/rust-crypto.git?branch=avx2#394c247254dbe2ac5d44483232cf335d10cf0260" dependencies = [ - "gcc 0.3.51 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.54 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -648,14 +662,6 @@ name = "rustc-serialize" version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "rustc_version" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "semver 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "safemem" version = "0.2.0" @@ -666,11 +672,6 @@ name = "scoped-tls" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "semver" -version = "0.1.20" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "serde" version = "0.9.15" @@ -699,9 +700,9 @@ name = "serde_json" version = "0.9.10" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "dtoa 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "itoa 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.9.15 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -710,7 +711,7 @@ name = "shannon" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -718,6 +719,11 @@ name = "slab" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "slab" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "smallvec" version = "0.2.1" @@ -755,7 +761,7 @@ name = "syntex_errors" version = "0.58.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", "syntex_pos 0.58.1 (registry+https://github.com/rust-lang/crates.io-index)", "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -776,7 +782,7 @@ version = "0.58.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", "syntex_errors 0.58.1 (registry+https://github.com/rust-lang/crates.io-index)", "syntex_pos 0.58.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -790,12 +796,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "tempfile" -version = "2.1.6" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -813,52 +820,51 @@ name = "termios" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "thread_local" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "time" -version = "0.1.38" +version = "0.1.39" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tokio-core" -version = "0.1.9" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bytes 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", - "iovec 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "mio 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "iovec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", "scoped-tls 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "slab 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tokio-io" -version = "0.1.2" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bytes 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -866,15 +872,15 @@ name = "tokio-proto" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "net2 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "net2 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "take 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-core 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-core 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-service 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -883,21 +889,21 @@ name = "tokio-service" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tokio-signal" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", - "mio 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", "mio-uds 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-core 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-core 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -905,7 +911,7 @@ name = "tremor" version = "0.1.0" source = "git+https://github.com/plietar/rust-tremor#5958cc302e78f535dad90e9665da981ddff4000a" dependencies = [ - "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "tremor-sys 0.1.0 (git+https://github.com/plietar/rust-tremor)", ] @@ -914,18 +920,18 @@ name = "tremor-sys" version = "0.1.0" source = "git+https://github.com/plietar/rust-tremor#5958cc302e78f535dad90e9665da981ddff4000a" dependencies = [ - "gcc 0.3.51 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.54 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "ogg-sys 0.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "unicase" -version = "2.0.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "version_check 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -956,12 +962,12 @@ dependencies = [ [[package]] name = "url" -version = "1.5.1" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "idna 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "percent-encoding 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -974,7 +980,7 @@ name = "uuid" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -983,9 +989,14 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "version_check" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "void" version = "1.0.2" @@ -996,9 +1007,9 @@ name = "vorbis" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "ogg-sys 0.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)", "vorbis-encoder 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "vorbis-sys 0.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "vorbisfile-sys 0.0.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1009,8 +1020,8 @@ name = "vorbis-encoder" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gcc 0.3.51 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.54 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "ogg-sys 0.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "vorbis-sys 0.0.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1021,8 +1032,8 @@ name = "vorbis-sys" version = "0.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gcc 0.3.51 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.54 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "ogg-sys 0.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1032,8 +1043,8 @@ name = "vorbisfile-sys" version = "0.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gcc 0.3.51 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.54 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "ogg-sys 0.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "vorbis-sys 0.0.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1044,11 +1055,30 @@ name = "winapi" version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "winapi" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "winapi-build" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "ws2_32-sys" version = "0.2.1" @@ -1059,87 +1089,88 @@ dependencies = [ ] [metadata] -"checksum aho-corasick 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "500909c4f87a9e52355b26626d890833e9e1d53ac566db76c36faa984b889699" +"checksum aho-corasick 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d6531d44de723825aa81398a6415283229725a00fa30713812ab9323faa82fc4" "checksum alsa 0.0.1 (git+https://github.com/plietar/rust-alsa)" = "" "checksum aster 0.41.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4ccfdf7355d9db158df68f976ed030ab0f6578af811f5a7bb6dcf221ec24e0e0" "checksum base64 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "30e93c03064e7590d0466209155251b90c22e37fab1daf2771582598b5827557" -"checksum base64 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "96434f987501f0ed4eb336a411e0631ecd1afa11574fe148587adc4ff96143c9" +"checksum base64 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "229d032f1a99302697f10b27167ae6d03d49d032e6a8e2550e8d3fc13356d2b4" "checksum bit-set 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d9bf6104718e80d7b26a68fdbacff3481cfc05df670821affc7e9cbc1884400c" "checksum bit-vec 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "02b4ff8b16e6076c3e14220b39fbc1fabb6737522281a388998046859400895f" "checksum bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "32866f4d103c4e438b1db1158aa1b1a80ee078e5d77a59a2f906fd62a577389c" "checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d" "checksum bitflags 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1370e9fc2a6ae53aea8b7a5110edbd08836ed87c88736dfabccade1c2b44bff4" +"checksum bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b3c30d3802dfb7281680d6285f2ccdaa8c2d8fee41f93805dba5c4cf50dc23cf" "checksum byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0fc10e8cc6b2580fda3f36eb6dc5316657f812a3df879a44a66fc9f0fdbc4855" -"checksum byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ff81738b726f5d099632ceaffe7fb65b90212e8dce59d518729e7e8634032d3d" -"checksum bytes 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8b24f16593f445422331a5eed46b72f7f171f910fead4f2ea8f17e727e9c5c14" +"checksum byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "652805b7e73fada9d85e9a6682a4abd490cb52d96aeecc12e33a0de34dfd0d23" +"checksum bytes 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "1b7db437d718977f6dc9b2e3fd6fc343c02ac6b899b73fdd2179163447bd9ce9" "checksum cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c819a1287eb618df47cc647173c5c4c66ba19d888a6e50d605672aed3140de" -"checksum conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "78ff10625fd0ac447827aa30ea8b861fead473bb60aeb73af6c1c58caf0d1299" -"checksum custom_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9" "checksum dns-parser 0.3.2 (git+https://github.com/plietar/dns-parser)" = "" -"checksum dtoa 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "80c8b71fd71146990a9742fc06dcbbde19161a267e0ad4e572c35162f4578c90" +"checksum dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "09c3753c3db574d215cba4ea76018483895d7bff25a31b49ba45db21c48e50ab" "checksum env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3ddf21e73e016298f5cb37d6ef8e8da8e39f91f9ec8b0df44b7deb16a9f8cd5b" "checksum error-chain 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e92ecf0a508c8e074c0e6fa8fe0fa38414848ad4dfc4db6f74c5e9753330b248" -"checksum futures 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "4b63a4792d4f8f686defe3b39b92127fea6344de5d38202b2ee5a11bbbf29d6a" -"checksum futures-cpupool 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a283c84501e92cade5ea673a2a7ca44f71f209ccdd302a3e0896f50083d2c5ff" -"checksum gcc 0.3.51 (registry+https://github.com/rust-lang/crates.io-index)" = "120d07f202dcc3f72859422563522b66fe6463a4c513df062874daad05f85f0a" -"checksum getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9047cfbd08a437050b363d35ef160452c5fe8ea5187ae0a624708c91581d685" -"checksum httparse 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "af2f2dd97457e8fb1ae7c5a420db346af389926e36f43768b96f101546b04a07" -"checksum hyper 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)" = "641abc3e3fcf0de41165595f801376e01106bca1fd876dda937730e477ca004c" +"checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" +"checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" +"checksum futures 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)" = "118b49cac82e04121117cbd3121ede3147e885627d82c4546b87c702debb90c1" +"checksum futures-cpupool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "ab90cde24b3319636588d0c35fe03b1333857621051837ed769faefb4c2162e4" +"checksum gcc 0.3.54 (registry+https://github.com/rust-lang/crates.io-index)" = "5e33ec290da0d127825013597dbdfc28bee4964690c7ce1166cbc2a7bd08b1bb" +"checksum getopts 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)" = "65922871abd2f101a2eb0eaebadc66668e54a87ad9c3dd82520b5f86ede5eff9" +"checksum httparse 1.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "c2f407128745b78abc95c0ffbe4e5d37427fdc0d45470710cfef8c44522a2e37" +"checksum hyper 0.11.14 (registry+https://github.com/rust-lang/crates.io-index)" = "f57f74deb81fb91b776012ed7605e96b1ffb88c4fd5c031ce5c90534b604a6e0" "checksum idna 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "014b298351066f1512874135335d62a789ffe78a9974f94b43ed5621951eaf7d" -"checksum iovec 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "29d062ee61fccdf25be172e70f34c9f6efc597e1fb8f6526e8437b2046ab26be" -"checksum itoa 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "eb2f404fbc66fd9aac13e998248505e7ecb2ad8e44ab6388684c5fb11c6c251c" +"checksum iovec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b6e8b9c2247fcf6c6a1151f1156932be5606c9fd6f55a2d7f9fc1cb29386b2f7" +"checksum itoa 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8324a32baf01e2ae060e9de58ed0bc2320c9a2833491ee36cd3b4c414de4db8c" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a" -"checksum lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3b37545ab726dd833ec6420aaba8231c5b320814b9029ad585555d2a03e94fbf" -"checksum lazycell 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3b585b7a6811fb03aa10e74b278a0f00f8dd9b45dc681f148bb29fa5cb61859b" +"checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73" +"checksum lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c8f31047daa365f19be14b47c29df4f7c3b581832407daabe6ae77397619237d" +"checksum lazycell 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a6f08839bc70ef4a3fe1d566d5350f519c5912ea86be0df1740a7d247c7fc0ef" "checksum lewton 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0de1cca3399919efa65ae7e01ed6696c961bd0fc9e844c05c80f90b638300bbf" -"checksum libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)" = "8a014d9226c2cc402676fbe9ea2e15dd5222cd1dd57f576b5b283178c944a264" +"checksum libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)" = "1e5d97d6708edaa407429faa671b942dc0f2727222fb6b6539bf1db936e4b121" "checksum libpulse-sys 0.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9bb11b06faf883500c1b625cf4453e6c7737e9df9c7ba01df3f84b22b083e4ac" "checksum linear-map 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bfae20f6b19ad527b550c223fddc3077a547fc70cda94b9b566575423fd303ee" -"checksum log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "880f77541efa6e5cc74e76910c9884d9859683118839d6a1dc3b11e63512565b" -"checksum magenta 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4bf0336886480e671965f794bc9b6fce88503563013d1bfb7a502c81fe3ac527" -"checksum magenta-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "40d014c7011ac470ae28e2f76a02bfea4a8480f73e701353b49ad7a8d75f4699" +"checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" +"checksum log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "89f010e843f2b1a31dbd316b3b8d443758bc634bed37aabade59c686d644e0a2" "checksum matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "100aabe6b8ff4e4a7e32c1c13523379802df0772b82466207ac25b013f193376" "checksum mdns 0.2.0 (git+https://github.com/plietar/rust-mdns)" = "" -"checksum memchr 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1dbccc0e46f1ea47b9f17e6d67c5a96bd27030519c519c9c91327e31275a47b4" -"checksum mime 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c5ca99d8a021c1687882fd68dca26e601ceff5c26571c7cb41cf4ed60d57cb2d" -"checksum mio 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "dbd91d3bfbceb13897065e97b2ef177a09a438cb33612b2d371bf568819a9313" +"checksum memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "796fba70e76612589ed2ce7f45282f5af869e0fdd7cc6199fa1aa1f1d591ba9d" +"checksum mime 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e2e00e17be181010a91dbfefb01660b17311059dc8c7f48b9017677721e732bd" +"checksum mio 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)" = "75f72a93f046f1517e3cfddc0a096eb756a2ba727d36edc8227dee769a50a9b0" "checksum mio-uds 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "1731a873077147b626d89cc6c2a0db6288d607496c5d10c0cfcf3adc697ec673" "checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" "checksum multimap 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9223f4774d08e06185e44e555b9a7561243d387bac49c78a6205c42d6975fbf2" -"checksum net2 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)" = "94101fd932816f97eb9a5116f6c1a11511a1fed7db21c5ccd823b2dc11abf566" +"checksum net2 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)" = "3a80f842784ef6c9a958b68b7516bc7e35883c614004dd94959a4dca1b716c09" "checksum nix 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "47e49f6982987135c5e9620ab317623e723bd06738fd85377e8d55f57c8b6487" -"checksum num-bigint 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "8fd0f8dbb4c0960998958a796281d88c16fbe68d87b1baa6f31e2979e81fd0bd" +"checksum num-bigint 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "bdc1494b5912f088f260b775799468d9b9209ac60885d8186a547a0476289e23" "checksum num-integer 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)" = "d1452e8b06e448a07f0e6ebb0bb1d92b8890eea63288c0b627331d53514d0fba" -"checksum num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "99843c856d68d8b4313b03a17e33c4bb42ae8f6610ea81b28abe076ac721b9b0" -"checksum num_cpus 1.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "aec53c34f2d0247c5ca5d32cca1478762f301740468ee9ee6dcb7a0dd7a0c584" -"checksum ogg 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7137bf02687385302f4c0aecd77cfce052b69f5b4ee937be778e125c62f67e30" +"checksum num-traits 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "cacfcab5eb48250ee7d0c7896b51a2c5eec99c1feea5f32025635f5ae4b00070" +"checksum num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c51a3322e4bca9d212ad9a158a02abc6934d005490c054a2778df73a70aa0a30" +"checksum ogg 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3f8de5433300a8a0ba60a3207766a3ce9efdede6aaab23311b5a8cf1664fe2e9" "checksum ogg-sys 0.0.9 (registry+https://github.com/rust-lang/crates.io-index)" = "a95b8c172e17df1a41bf8d666301d3b2c4efeb90d9d0415e2a4dc0668b35fdb2" -"checksum percent-encoding 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "de154f638187706bde41d9b4738748933d64e6b37bdbffc0b47a97d16a6ae356" +"checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" "checksum pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "3a8b4c6b8165cd1a1cd4b9b120978131389f64bdaf456435caa41e630edba903" "checksum portaudio-rs 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "029e0ab393b44b2d825efbc755cae51c36be7a99d91356b2052be0ed05836636" "checksum portaudio-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5194a4fa953b4ffd851c320ef6f0484cd7278cb7169ea9d6c433e49b23f7b7f5" -"checksum protobuf 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "568a15e4d572d9a5e63ae3a55f84328c984842887db179b40b4cc6a608bac6a4" +"checksum protobuf 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "bec26e67194b7d991908145fdf21b7cae8b08423d96dcb9e860cd31f854b9506" "checksum protobuf_macros 0.6.0 (git+https://github.com/plietar/rust-protobuf-macros)" = "" -"checksum quick-error 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3c36987d4978eb1be2e422b1e0423a557923a5c3e7e6f31d5699e9aafaefa469" +"checksum quick-error 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "eda5fe9b71976e62bc81b781206aaa076401769b2143379d3eb2118388babac4" "checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" -"checksum rand 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)" = "eb250fd207a4729c976794d03db689c9be1d634ab5a1c9da9492a13d8fecbcdf" -"checksum redox_syscall 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)" = "3c9309631a35303bffb47e397198e3668cb544fe8834cd3da2a744441e70e524" -"checksum regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1731164734096285ec2a5ec7fea5248ae2f5485b3feeb0115af4fda2183b2d1b" -"checksum regex-syntax 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ad890a5eef7953f55427c50575c680c42841653abd2b028b68cd223d157f62db" +"checksum rand 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)" = "512870020642bb8c221bf68baa1b2573da814f6ccfe5c9699b1c303047abe9b1" +"checksum redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)" = "0d92eecebad22b767915e4d529f89f28ee96dbbf5a4810d2b844373f136417fd" +"checksum regex 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "744554e01ccbd98fff8c457c3b092cd67af62a555a43bfe97ae8a0451f7799fa" +"checksum regex-syntax 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8e931c58b93d86f080c734bfd2bce7dd0079ae2331235818133c8be7f422e20e" +"checksum relay 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f301bafeb60867c85170031bdb2fcf24c8041f33aee09e7b116a58d4e9f781c5" "checksum rpassword 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ec4bdede957362ec6fdd550f7e79c6d14cad2bc26b2d062786234c6ee0cb27bb" "checksum rust-crypto 0.2.36 (git+https://github.com/awmath/rust-crypto.git?branch=avx2)" = "" "checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" -"checksum rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "c5f5376ea5e30ce23c03eb77cbe4962b988deead10910c372b226388b594c084" "checksum safemem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e27a8b19b835f7aea908818e871f5cc3a5a186550c30773be987e155e8163d8f" "checksum scoped-tls 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f417c22df063e9450888a7561788e9bd46d3bb3c1466435b4eccb903807f147d" -"checksum semver 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)" = "d4f410fedcf71af0345d7607d246e7ad15faaadd49d240ee3b24e5dc21a820ac" "checksum serde 0.9.15 (registry+https://github.com/rust-lang/crates.io-index)" = "34b623917345a631dc9608d5194cc206b3fe6c3554cd1c75b937e55e285254af" "checksum serde_codegen_internals 0.14.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bc888bd283bd2420b16ad0d860e35ad8acb21941180a83a189bb2046f9d00400" "checksum serde_derive 0.9.15 (registry+https://github.com/rust-lang/crates.io-index)" = "978fd866f4d4872084a81ccc35e275158351d3b9fe620074e7d7504b816b74ba" "checksum serde_json 0.9.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ad8bcf487be7d2e15d3d543f04312de991d631cfe1b43ea0ade69e6a8a5b16a1" "checksum shannon 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7ea5b41c9427b56caa7b808cb548a04fb50bb5b9e98590b53f28064ff4174561" "checksum slab 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "17b4fcaed89ab08ef143da37bc52adbcc04d4a69014f4c1208d6b51f0c47bc23" +"checksum slab 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fdeff4cd9ecff59ec7e3744cbca73dfe5ac35c2aedb2cfba8a1c715a18912e9d" "checksum smallvec 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4c8cbcd6df1e117c2210e13ab5109635ad68a929fcbb8964dc965b76cb5ee013" "checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" "checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" @@ -1148,32 +1179,36 @@ dependencies = [ "checksum syntex_pos 0.58.1 (registry+https://github.com/rust-lang/crates.io-index)" = "13ad4762fe52abc9f4008e85c4fb1b1fe3aa91ccb99ff4826a439c7c598e1047" "checksum syntex_syntax 0.58.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6e0e4dbae163dd98989464c23dd503161b338790640e11537686f2ef0f25c791" "checksum take 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b157868d8ac1f56b64604539990685fa7611d8fa9e5476cf0c02cf34d32917c5" -"checksum tempfile 2.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "5b92290d7f1ce2d221405d5c78b9c568c9f1debb314aa92a513cd99db709f931" +"checksum tempfile 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "11ce2fe9db64b842314052e2421ac61a73ce41b898dc8e3750398b219c5fc1e0" "checksum term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "fa63644f74ce96fbeb9b794f66aff2a52d601cbd5e80f4b97123e3899f4570f1" "checksum termios 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d5d9cf598a6d7ce700a4e6a9199da127e6819a61e64b68609683cc9a01b5683a" -"checksum thread_local 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "1697c4b57aeeb7a536b647165a2825faddffb1d3bad386d507709bd51a90bb14" -"checksum time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)" = "d5d788d3aa77bc0ef3e9621256885555368b47bd495c13dd2e7413c89f845520" -"checksum tokio-core 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e85d419699ec4b71bfe35bbc25bb8771e52eff0471a7f75c853ad06e200b4f86" -"checksum tokio-io 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c2c3ce9739f7387a0fa65b5421e81feae92e04d603f008898f4257790ce8c2db" +"checksum thread_local 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "279ef31c19ededf577bfd12dfae728040a21f635b06a24cd670ff510edd38963" +"checksum time 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "a15375f1df02096fb3317256ce2cee6a1f42fc84ea5ad5fc8c421cfe40c73098" +"checksum tokio-core 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "52b4e32d8edbf29501aabb3570f027c6ceb00ccef6538f4bddba0200503e74e8" +"checksum tokio-io 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "514aae203178929dbf03318ad7c683126672d4d96eccb77b29603d33c9e25743" "checksum tokio-proto 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8fbb47ae81353c63c487030659494b295f6cb6576242f907f203473b191b0389" "checksum tokio-service 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "24da22d077e0f15f55162bdbdc661228c1581892f52074fb242678d015b45162" -"checksum tokio-signal 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3d121715f6917878a0df69f39365d01dd66c4463e4ba19efdcddcdfeb1bcb2bc" +"checksum tokio-signal 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "57c4031b97651d28c87a0a071e1c2809d70609d3120ce285b302eb7d52c96906" "checksum tremor 0.1.0 (git+https://github.com/plietar/rust-tremor)" = "" "checksum tremor-sys 0.1.0 (git+https://github.com/plietar/rust-tremor)" = "" -"checksum unicase 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2e01da42520092d0cd2d6ac3ae69eb21a22ad43ff195676b86f8c37f487d6b80" +"checksum unicase 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "284b6d3db520d67fbe88fd778c21510d1b0ba4a551e5d0fbb023d33405f6de8a" "checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" "checksum unicode-normalization 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "51ccda9ef9efa3f7ef5d91e8f9b83bbe6955f9bf86aec89d5cce2c874625920f" "checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" "checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" -"checksum url 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "eeb819346883532a271eb626deb43c4a1bb4c4dd47c519bd78137c3e72a4fe27" +"checksum url 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fa35e768d4daf1d85733418a49fb42e10d7f633e394fccab4ab7aba897053fe2" "checksum utf8-ranges 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "662fab6525a98beff2921d7f61a39e7d59e0b425ebc7d0d9e66d316e55124122" "checksum uuid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7cfec50b0842181ba6e713151b72f4ec84a6a7e2c9c8a8a3ffc37bb1cd16b231" "checksum vergen 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c3365f36c57e5df714a34be40902b27a992eeddb9996eca52d0584611cf885d" +"checksum version_check 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6b772017e347561807c1aa192438c5fd74242a670a6cffacc40f2defd1dc069d" "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" "checksum vorbis 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "760993e54524128b88d4d7aff09c773c2f16a9f18db3c8ae1ccca5afd1287656" "checksum vorbis-encoder 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3fb66bcdde056dd230991bb86669a1269778fe8ad1f6cee403428ac7985391bc" "checksum vorbis-sys 0.0.8 (registry+https://github.com/rust-lang/crates.io-index)" = "729e1f15395850b4e6d19ca0cd1d42ef44707503a53b69d40ff49182b3c5589d" "checksum vorbisfile-sys 0.0.8 (registry+https://github.com/rust-lang/crates.io-index)" = "4f4306d7e1ac4699b55e20de9483750b90c250913188efd7484db6bfbe9042d1" "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" +"checksum winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "04e3bd221fcbe8a271359c04f21a76db7d0c6028862d1bb5512d85e1e2eb5bb3" "checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" +"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" "checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" From 5237203899c416b772d5ec797b3fdb911922677c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20B=C3=A4chler?= Date: Sun, 21 Jan 2018 20:29:31 +0100 Subject: [PATCH 30/56] Remove usage of deprecated BoxFuture, BoxStream and BoxSink --- core/src/connection/mod.rs | 12 ++++++------ core/src/mercury/mod.rs | 8 ++++---- core/src/session.rs | 8 ++++---- metadata/src/lib.rs | 8 ++++---- src/discovery.rs | 8 ++++---- src/keymaster.rs | 8 ++++---- src/main.rs | 2 +- src/spirc.rs | 20 +++++++++----------- 8 files changed, 36 insertions(+), 38 deletions(-) diff --git a/core/src/connection/mod.rs b/core/src/connection/mod.rs index 1d6f1f07..5df5c097 100644 --- a/core/src/connection/mod.rs +++ b/core/src/connection/mod.rs @@ -4,7 +4,7 @@ mod handshake; pub use self::codec::APCodec; pub use self::handshake::handshake; -use futures::{Future, Sink, Stream, BoxFuture}; +use futures::{Future, Sink, Stream}; use std::io; use std::net::ToSocketAddrs; use tokio_core::net::TcpStream; @@ -17,18 +17,18 @@ use version; pub type Transport = Framed; -pub fn connect(addr: A, handle: &Handle) -> BoxFuture { +pub fn connect(addr: A, handle: &Handle) -> Box> { let addr = addr.to_socket_addrs().unwrap().next().unwrap(); let socket = TcpStream::connect(&addr, handle); let connection = socket.and_then(|socket| { handshake(socket) }); - connection.boxed() + Box::new(connection) } pub fn authenticate(transport: Transport, credentials: Credentials, device_id: String) - -> BoxFuture<(Transport, Credentials), io::Error> + -> Box> { use protocol::authentication::{APWelcome, ClientResponseEncrypted, CpuFamily, Os}; @@ -50,7 +50,7 @@ pub fn authenticate(transport: Transport, credentials: Credentials, device_id: S let cmd = 0xab; let data = packet.write_to_bytes().unwrap(); - transport.send((cmd, data)).and_then(|transport| { + Box::new(transport.send((cmd, data)).and_then(|transport| { transport.into_future().map_err(|(err, _stream)| err) }).and_then(|(packet, transport)| { match packet { @@ -71,5 +71,5 @@ pub fn authenticate(transport: Transport, credentials: Credentials, device_id: S Some((cmd, _)) => panic!("Unexpected packet {:?}", cmd), None => panic!("EOF"), } - }).boxed() + })) } diff --git a/core/src/mercury/mod.rs b/core/src/mercury/mod.rs index 23a3224e..45e12f18 100644 --- a/core/src/mercury/mod.rs +++ b/core/src/mercury/mod.rs @@ -1,6 +1,6 @@ use byteorder::{BigEndian, ByteOrder}; use futures::sync::{oneshot, mpsc}; -use futures::{Async, Poll, BoxFuture, Future}; +use futures::{Async, Poll, Future}; use protobuf; use protocol; use std::collections::HashMap; @@ -99,7 +99,7 @@ impl MercuryManager { } pub fn subscribe>(&self, uri: T) - -> BoxFuture, MercuryError> + -> Box, Error = MercuryError>> { let uri = uri.into(); let request = self.request(MercuryRequest { @@ -110,7 +110,7 @@ impl MercuryManager { }); let manager = self.clone(); - request.map(move |response| { + Box::new(request.map(move |response| { let (tx, rx) = mpsc::unbounded(); manager.lock(move |inner| { @@ -133,7 +133,7 @@ impl MercuryManager { }); rx - }).boxed() + })) } pub fn dispatch(&self, cmd: u8, mut data: EasyBuf) { diff --git a/core/src/session.rs b/core/src/session.rs index 9a45df89..067b685b 100644 --- a/core/src/session.rs +++ b/core/src/session.rs @@ -1,7 +1,7 @@ use crypto::digest::Digest; use crypto::sha1::Sha1; use futures::sync::mpsc; -use futures::{Future, Stream, BoxFuture, IntoFuture, Poll, Async}; +use futures::{Future, Stream, IntoFuture, Poll, Async}; use std::io; use std::sync::{RwLock, Arc, Weak}; use tokio_core::io::EasyBuf; @@ -90,7 +90,7 @@ impl Session { fn create(handle: &Handle, transport: connection::Transport, config: SessionConfig, cache: Option, username: String) - -> (Session, BoxFuture<(), io::Error>) + -> (Session, Box>) { let (sink, stream) = transport.split(); @@ -124,8 +124,8 @@ impl Session { .forward(sink).map(|_| ()); let receiver_task = DispatchTask(stream, session.weak()); - let task = (receiver_task, sender_task).into_future() - .map(|((), ())| ()).boxed(); + let task = Box::new((receiver_task, sender_task).into_future() + .map(|((), ())| ())); (session, task) } diff --git a/metadata/src/lib.rs b/metadata/src/lib.rs index 3ad5c4e5..f76cd224 100644 --- a/metadata/src/lib.rs +++ b/metadata/src/lib.rs @@ -8,7 +8,7 @@ extern crate librespot_protocol as protocol; pub mod cover; -use futures::{Future, BoxFuture}; +use futures::Future; use linear_map::LinearMap; use core::mercury::MercuryError; @@ -57,17 +57,17 @@ pub trait Metadata : Send + Sized + 'static { fn base_url() -> &'static str; fn parse(msg: &Self::Message, session: &Session) -> Self; - fn get(session: &Session, id: SpotifyId) -> BoxFuture { + fn get(session: &Session, id: SpotifyId) -> Box> { let uri = format!("{}/{}", Self::base_url(), id.to_base16()); let request = session.mercury().get(uri); let session = session.clone(); - request.and_then(move |response| { + Box::new(request.and_then(move |response| { let data = response.payload.first().expect("Empty payload"); let msg: Self::Message = protobuf::parse_from_bytes(data).unwrap(); Ok(Self::parse(&msg, &session)) - }).boxed() + })) } } diff --git a/src/discovery.rs b/src/discovery.rs index 3eaa5f0a..46f44dd0 100644 --- a/src/discovery.rs +++ b/src/discovery.rs @@ -3,7 +3,7 @@ use crypto::digest::Digest; use crypto::mac::Mac; use crypto; use futures::sync::mpsc; -use futures::{Future, Stream, BoxFuture, Poll, Async}; +use futures::{Future, Stream, Poll, Async}; use hyper::server::{Service, NewService, Request, Response, Http}; use hyper::{self, Get, Post, StatusCode}; use mdns; @@ -159,7 +159,7 @@ impl Service for Discovery { type Request = Request; type Response = Response; type Error = hyper::Error; - type Future = BoxFuture; + type Future = Box>; fn call(&self, request: Request) -> Self::Future { let mut params = BTreeMap::new(); @@ -174,7 +174,7 @@ impl Service for Discovery { } let this = self.clone(); - body.fold(Vec::new(), |mut acc, chunk| { + Box::new(body.fold(Vec::new(), |mut acc, chunk| { acc.extend_from_slice(chunk.as_ref()); Ok::<_, hyper::Error>(acc) }).map(move |body| { @@ -186,7 +186,7 @@ impl Service for Discovery { (Post, Some("addUser")) => this.handle_add_user(¶ms), _ => this.not_found(), } - }).boxed() + })) } } diff --git a/src/keymaster.rs b/src/keymaster.rs index 6ed11fd7..e803a959 100644 --- a/src/keymaster.rs +++ b/src/keymaster.rs @@ -1,4 +1,4 @@ -use futures::{Future, BoxFuture}; +use futures::Future; use serde_json; use core::mercury::MercuryError; @@ -13,14 +13,14 @@ pub struct Token { pub scope: Vec, } -pub fn get_token(session: &Session, client_id: &str, scopes: &str) -> BoxFuture { +pub fn get_token(session: &Session, client_id: &str, scopes: &str) -> Box> { let url = format!("hm://keymaster/token/authenticated?client_id={}&scope={}", client_id, scopes); - session.mercury().get(url).map(move |response| { + Box::new(session.mercury().get(url).map(move |response| { let data = response.payload.first().expect("Empty payload"); let data = String::from_utf8(data.clone()).unwrap(); let token : Token = serde_json::from_str(&data).unwrap(); token - }).boxed() + })) } diff --git a/src/main.rs b/src/main.rs index c6208f2b..2e05b607 100644 --- a/src/main.rs +++ b/src/main.rs @@ -264,7 +264,7 @@ impl Main { spirc: None, spirc_task: None, shutdown: false, - signal: tokio_signal::ctrl_c(&handle).flatten_stream().boxed(), + signal: Box::new(tokio_signal::ctrl_c(&handle).flatten_stream()), }; if setup.enable_discovery { diff --git a/src/spirc.rs b/src/spirc.rs index 795ba68f..f2265a6e 100644 --- a/src/spirc.rs +++ b/src/spirc.rs @@ -1,8 +1,6 @@ use futures::future; -use futures::sink::BoxSink; -use futures::stream::BoxStream; use futures::sync::{oneshot, mpsc}; -use futures::{Future, Stream, Sink, Async, Poll, BoxFuture}; +use futures::{Future, Stream, Sink, Async, Poll}; use protobuf::{self, Message}; use core::config::ConnectConfig; @@ -30,10 +28,10 @@ pub struct SpircTask { device: DeviceState, state: State, - subscription: BoxStream, - sender: BoxSink, + subscription: Box>, + sender: Box>, commands: mpsc::UnboundedReceiver, - end_of_track: BoxFuture<(), oneshot::Canceled>, + end_of_track: Box>, shutdown: bool, session: Session, @@ -134,10 +132,10 @@ impl Spirc { let subscription = session.mercury().subscribe(&uri as &str); let subscription = subscription.map(|stream| stream.map_err(|_| MercuryError)).flatten_stream(); - let subscription = subscription.map(|response| -> Frame { + let subscription = Box::new(subscription.map(|response| -> Frame { let data = response.payload.first().unwrap(); protobuf::parse_from_bytes(data).unwrap() - }).boxed(); + })); let sender = Box::new(session.mercury().sender(uri).with(|frame: Frame| { Ok(frame.write_to_bytes().unwrap()) @@ -163,7 +161,7 @@ impl Spirc { subscription: subscription, sender: sender, commands: cmd_rx, - end_of_track: future::empty().boxed(), + end_of_track: Box::new(future::empty()), shutdown: false, session: session.clone(), @@ -238,7 +236,7 @@ impl Future for SpircTask { } Ok(Async::NotReady) => (), Err(oneshot::Canceled) => { - self.end_of_track = future::empty().boxed() + self.end_of_track = Box::new(future::empty()) } } } @@ -587,7 +585,7 @@ impl SpircTask { self.state.set_status(PlayStatus::kPlayStatusPause); } - self.end_of_track = end_of_track.boxed(); + self.end_of_track = Box::new(end_of_track); } fn hello(&mut self) { From 630de8c0a9b09981f5cdfa418fd26a07756665bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20B=C3=A4chler?= Date: Sun, 21 Jan 2018 20:38:30 +0100 Subject: [PATCH 31/56] Use futures::sync::mpsc::UnboundedSender::unbounded_send() instead of the deprecated send() --- audio/src/fetch.rs | 2 +- core/src/channel.rs | 2 +- core/src/mercury/mod.rs | 2 +- core/src/session.rs | 2 +- src/discovery.rs | 2 +- src/spirc.rs | 16 ++++++++-------- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/audio/src/fetch.rs b/audio/src/fetch.rs index df5eeef7..f9bd11a9 100644 --- a/audio/src/fetch.rs +++ b/audio/src/fetch.rs @@ -340,7 +340,7 @@ impl Seek for AudioFileStreaming { // Notify the fetch thread to get the correct block // This can fail if fetch thread has completed, in which case the // block is ready. Just ignore the error. - let _ = self.seek.send(self.position); + let _ = self.seek.unbounded_send(self.position); Ok(self.position) } } diff --git a/core/src/channel.rs b/core/src/channel.rs index 30a9e00e..8370da44 100644 --- a/core/src/channel.rs +++ b/core/src/channel.rs @@ -61,7 +61,7 @@ impl ChannelManager { self.lock(|inner| { if let Entry::Occupied(entry) = inner.channels.entry(id) { - let _ = entry.get().send((cmd, data)); + let _ = entry.get().unbounded_send((cmd, data)); } }); } diff --git a/core/src/mercury/mod.rs b/core/src/mercury/mod.rs index 45e12f18..37514876 100644 --- a/core/src/mercury/mod.rs +++ b/core/src/mercury/mod.rs @@ -211,7 +211,7 @@ impl MercuryManager { // if send fails, remove from list of subs // TODO: send unsub message - sub.send(response.clone()).is_ok() + sub.unbounded_send(response.clone()).is_ok() } else { // URI doesn't match true diff --git a/core/src/session.rs b/core/src/session.rs index 067b685b..1534d3ed 100644 --- a/core/src/session.rs +++ b/core/src/session.rs @@ -177,7 +177,7 @@ impl Session { } pub fn send_packet(&self, cmd: u8, data: Vec) { - self.0.tx_connection.send((cmd, data)).unwrap(); + self.0.tx_connection.unbounded_send((cmd, data)).unwrap(); } pub fn cache(&self) -> Option<&Arc> { diff --git a/src/discovery.rs b/src/discovery.rs index 46f44dd0..0b6e4ad1 100644 --- a/src/discovery.rs +++ b/src/discovery.rs @@ -136,7 +136,7 @@ impl Discovery { let credentials = Credentials::with_blob(username.to_owned(), &decrypted, &self.0.device_id); - self.0.tx.send(credentials).unwrap(); + self.0.tx.unbounded_send(credentials).unwrap(); let result = json!({ "status": 101, diff --git a/src/spirc.rs b/src/spirc.rs index f2265a6e..a36d0b1d 100644 --- a/src/spirc.rs +++ b/src/spirc.rs @@ -177,28 +177,28 @@ impl Spirc { } pub fn play(&self) { - let _ = mpsc::UnboundedSender::send(&self.commands, SpircCommand::Play); + let _ = self.commands.unbounded_send(SpircCommand::Play); } pub fn play_pause(&self) { - let _ = mpsc::UnboundedSender::send(&self.commands, SpircCommand::PlayPause); + let _ = self.commands.unbounded_send(SpircCommand::PlayPause); } pub fn pause(&self) { - let _ = mpsc::UnboundedSender::send(&self.commands, SpircCommand::Pause); + let _ = self.commands.unbounded_send(SpircCommand::Pause); } pub fn prev(&self) { - let _ = mpsc::UnboundedSender::send(&self.commands, SpircCommand::Prev); + let _ = self.commands.unbounded_send(SpircCommand::Prev); } pub fn next(&self) { - let _ = mpsc::UnboundedSender::send(&self.commands, SpircCommand::Next); + let _ = self.commands.unbounded_send(SpircCommand::Next); } pub fn volume_up(&self) { - let _ = mpsc::UnboundedSender::send(&self.commands, SpircCommand::VolumeUp); + let _ = self.commands.unbounded_send(SpircCommand::VolumeUp); } pub fn volume_down(&self) { - let _ = mpsc::UnboundedSender::send(&self.commands, SpircCommand::VolumeDown); + let _ = self.commands.unbounded_send(SpircCommand::VolumeDown); } pub fn shutdown(&self) { - let _ = mpsc::UnboundedSender::send(&self.commands, SpircCommand::Shutdown); + let _ = self.commands.unbounded_send(SpircCommand::Shutdown); } } From d36017d6f06bc8ba9f455d856e68da1983a77fe7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20B=C3=A4chler?= Date: Sun, 21 Jan 2018 21:52:31 +0100 Subject: [PATCH 32/56] Remove usage of deprecated tokio_core::io --- Cargo.lock | 3 +++ Cargo.toml | 1 + core/Cargo.toml | 2 ++ core/build.rs | 4 +++- core/src/audio_key.rs | 6 +++--- core/src/channel.rs | 26 ++++++++++++------------ core/src/connection/codec.rs | 35 +++++++++++++++++++------------- core/src/connection/handshake.rs | 20 ++++++++++-------- core/src/connection/mod.rs | 2 +- core/src/lib.rs | 5 ++--- core/src/mercury/mod.rs | 18 ++++++++-------- core/src/session.rs | 10 ++++----- src/main.rs | 6 ++---- 13 files changed, 76 insertions(+), 62 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a46d537e..1bee8116 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -295,6 +295,7 @@ dependencies = [ "serde_derive 0.9.15 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 0.9.10 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-core 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-signal 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "vergen 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -324,6 +325,7 @@ version = "0.1.0" dependencies = [ "base64 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "error-chain 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.11.14 (registry+https://github.com/rust-lang/crates.io-index)", @@ -343,6 +345,7 @@ dependencies = [ "serde_json 0.9.10 (registry+https://github.com/rust-lang/crates.io-index)", "shannon 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-core 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "uuid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "vergen 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] diff --git a/Cargo.toml b/Cargo.toml index 82bef079..277e149f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -46,6 +46,7 @@ serde = "0.9.6" serde_derive = "0.9.6" serde_json = "0.9.5" tokio-core = "0.1.2" +tokio-io = "0.1" tokio-signal = "0.1.2" url = "1.3" diff --git a/core/Cargo.toml b/core/Cargo.toml index bf34de0b..86722f07 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -10,6 +10,7 @@ path = "../protocol" [dependencies] base64 = "0.5.0" byteorder = "1.0" +bytes = "0.4" error-chain = { version = "0.9.0", default_features = false } futures = "0.1.8" hyper = "0.11.2" @@ -27,6 +28,7 @@ serde_derive = "0.9.6" serde_json = "0.9.5" shannon = "0.2.0" tokio-core = "0.1.2" +tokio-io = "0.1" uuid = { version = "0.4", features = ["v4"] } [build-dependencies] diff --git a/core/build.rs b/core/build.rs index 01fd14a1..5a2e5db8 100644 --- a/core/build.rs +++ b/core/build.rs @@ -39,5 +39,7 @@ pub fn build_id() -> &'static str {{ protobuf_macros::expand("src/lib.in.rs", &out.join("lib.rs")).unwrap(); println!("cargo:rerun-if-changed=src/lib.in.rs"); - println!("cargo:rerun-if-changed=src/connection"); + println!("cargo:rerun-if-changed=src/connection/mod.rs"); + println!("cargo:rerun-if-changed=src/connection/codec.rs"); + println!("cargo:rerun-if-changed=src/connection/handshake.rs"); } diff --git a/core/src/audio_key.rs b/core/src/audio_key.rs index e19c5b87..41424880 100644 --- a/core/src/audio_key.rs +++ b/core/src/audio_key.rs @@ -1,9 +1,9 @@ use byteorder::{BigEndian, ByteOrder, WriteBytesExt}; +use bytes::Bytes; use futures::sync::oneshot; use futures::{Async, Future, Poll}; use std::collections::HashMap; use std::io::Write; -use tokio_core::io::EasyBuf; use util::SeqGenerator; use util::{SpotifyId, FileId}; @@ -22,8 +22,8 @@ component! { } impl AudioKeyManager { - pub fn dispatch(&self, cmd: u8, mut data: EasyBuf) { - let seq = BigEndian::read_u32(data.drain_to(4).as_ref()); + pub fn dispatch(&self, cmd: u8, mut data: Bytes) { + let seq = BigEndian::read_u32(data.split_to(4).as_ref()); let sender = self.lock(|inner| inner.pending.remove(&seq)); diff --git a/core/src/channel.rs b/core/src/channel.rs index 8370da44..d7c74e50 100644 --- a/core/src/channel.rs +++ b/core/src/channel.rs @@ -1,15 +1,15 @@ use byteorder::{BigEndian, ByteOrder}; +use bytes::Bytes; use futures::sync::{BiLock, mpsc}; use futures::{Poll, Async, Stream}; use std::collections::HashMap; -use tokio_core::io::EasyBuf; use util::SeqGenerator; component! { ChannelManager : ChannelManagerInner { sequence: SeqGenerator = SeqGenerator::new(0), - channels: HashMap> = HashMap::new(), + channels: HashMap> = HashMap::new(), } } @@ -17,7 +17,7 @@ component! { pub struct ChannelError; pub struct Channel { - receiver: mpsc::UnboundedReceiver<(u8, EasyBuf)>, + receiver: mpsc::UnboundedReceiver<(u8, Bytes)>, state: ChannelState, } @@ -26,12 +26,12 @@ pub struct ChannelData(BiLock); pub enum ChannelEvent { Header(u8, Vec), - Data(EasyBuf), + Data(Bytes), } #[derive(Clone)] enum ChannelState { - Header(EasyBuf), + Header(Bytes), Data, Closed, } @@ -48,16 +48,16 @@ impl ChannelManager { let channel = Channel { receiver: rx, - state: ChannelState::Header(EasyBuf::new()), + state: ChannelState::Header(Bytes::new()), }; (seq, channel) } - pub fn dispatch(&self, cmd: u8, mut data: EasyBuf) { + pub fn dispatch(&self, cmd: u8, mut data: Bytes) { use std::collections::hash_map::Entry; - let id: u16 = BigEndian::read_u16(data.drain_to(2).as_ref()); + let id: u16 = BigEndian::read_u16(data.split_to(2).as_ref()); self.lock(|inner| { if let Entry::Occupied(entry) = inner.channels.entry(id) { @@ -68,7 +68,7 @@ impl ChannelManager { } impl Channel { - fn recv_packet(&mut self) -> Poll { + fn recv_packet(&mut self) -> Poll { let (cmd, packet) = match self.receiver.poll() { Ok(Async::Ready(t)) => t.expect("channel closed"), Ok(Async::NotReady) => return Ok(Async::NotReady), @@ -107,13 +107,13 @@ impl Stream for Channel { data = try_ready!(self.recv_packet()); } - let length = BigEndian::read_u16(data.drain_to(2).as_ref()) as usize; + let length = BigEndian::read_u16(data.split_to(2).as_ref()) as usize; if length == 0 { assert_eq!(data.len(), 0); self.state = ChannelState::Data; } else { - let header_id = data.drain_to(1).as_ref()[0]; - let header_data = data.drain_to(length - 1).as_ref().to_owned(); + let header_id = data.split_to(1).as_ref()[0]; + let header_data = data.split_to(length - 1).as_ref().to_owned(); self.state = ChannelState::Header(data); @@ -139,7 +139,7 @@ impl Stream for Channel { } impl Stream for ChannelData { - type Item = EasyBuf; + type Item = Bytes; type Error = ChannelError; fn poll(&mut self) -> Poll, Self::Error> { diff --git a/core/src/connection/codec.rs b/core/src/connection/codec.rs index 6529d3d9..6fbede13 100644 --- a/core/src/connection/codec.rs +++ b/core/src/connection/codec.rs @@ -1,7 +1,8 @@ -use byteorder::{BigEndian, ByteOrder, WriteBytesExt}; +use byteorder::{BigEndian, ByteOrder}; +use bytes::{Bytes, BytesMut, BufMut}; use shannon::Shannon; use std::io; -use tokio_core::io::{Codec, EasyBuf}; +use tokio_io::codec::{Decoder, Encoder}; const HEADER_SIZE: usize = 3; const MAC_SIZE: usize = 4; @@ -34,16 +35,17 @@ impl APCodec { } } -impl Codec for APCodec { - type Out = (u8, Vec); - type In = (u8, EasyBuf); +impl Encoder for APCodec { + type Item = (u8, Vec); + type Error = io::Error; - fn encode(&mut self, item: (u8, Vec), buf: &mut Vec) -> io::Result<()> { + fn encode(&mut self, item: (u8, Vec), buf: &mut BytesMut) -> io::Result<()> { let (cmd, payload) = item; let offset = buf.len(); - buf.write_u8(cmd).unwrap(); - buf.write_u16::(payload.len() as u16).unwrap(); + buf.reserve(3 + payload.len()); + buf.put_u8(cmd); + buf.put_u16::(payload.len() as u16); buf.extend_from_slice(&payload); self.encode_cipher.nonce_u32(self.encode_nonce); @@ -57,12 +59,17 @@ impl Codec for APCodec { Ok(()) } +} - fn decode(&mut self, buf: &mut EasyBuf) -> io::Result> { +impl Decoder for APCodec { + type Item = (u8, Bytes); + type Error = io::Error; + + fn decode(&mut self, buf: &mut BytesMut) -> io::Result> { if let DecodeState::Header = self.decode_state { if buf.len() >= HEADER_SIZE { let mut header = [0u8; HEADER_SIZE]; - header.copy_from_slice(buf.drain_to(HEADER_SIZE).as_slice()); + header.copy_from_slice(buf.split_to(HEADER_SIZE).as_ref()); self.decode_cipher.nonce_u32(self.decode_nonce); self.decode_nonce += 1; @@ -79,13 +86,13 @@ impl Codec for APCodec { if buf.len() >= size + MAC_SIZE { self.decode_state = DecodeState::Header; - let mut payload = buf.drain_to(size + MAC_SIZE); + let mut payload = buf.split_to(size + MAC_SIZE); - self.decode_cipher.decrypt(&mut payload.get_mut()[..size]); + self.decode_cipher.decrypt(&mut payload.get_mut(..size).unwrap()); let mac = payload.split_off(size); - self.decode_cipher.check_mac(mac.as_slice())?; + self.decode_cipher.check_mac(mac.as_ref())?; - return Ok(Some((cmd, payload))); + return Ok(Some((cmd, payload.freeze()))); } } diff --git a/core/src/connection/handshake.rs b/core/src/connection/handshake.rs index 83b0b37a..5b94f709 100644 --- a/core/src/connection/handshake.rs +++ b/core/src/connection/handshake.rs @@ -3,9 +3,11 @@ use crypto::hmac::Hmac; use crypto::mac::Mac;use byteorder::{BigEndian, ByteOrder, WriteBytesExt}; use protobuf::{self, Message, MessageStatic}; use rand::thread_rng; -use std::io::{self, Read, Write}; +use std::io::{self, Read}; use std::marker::PhantomData; -use tokio_core::io::{Io, Framed, write_all, WriteAll, read_exact, ReadExact, Window}; +use tokio_io::{AsyncRead, AsyncWrite}; +use tokio_io::codec::Framed; +use tokio_io::io::{write_all, WriteAll, read_exact, ReadExact, Window}; use futures::{Poll, Async, Future}; use diffie_hellman::DHLocalKeys; @@ -25,7 +27,7 @@ enum HandshakeState { ClientResponse(Option, WriteAll>), } -pub fn handshake(connection: T) -> Handshake { +pub fn handshake(connection: T) -> Handshake { let local_keys = DHLocalKeys::random(&mut thread_rng()); let client_hello = client_hello(connection, local_keys.public_key()); @@ -35,7 +37,7 @@ pub fn handshake(connection: T) -> Handshake { } } -impl Future for Handshake { +impl Future for Handshake { type Item = Framed; type Error = io::Error; @@ -78,7 +80,7 @@ impl Future for Handshake { } } -fn client_hello(connection: T, gc: Vec) -> WriteAll> { +fn client_hello(connection: T, gc: Vec) -> WriteAll> { let packet = protobuf_init!(ClientHello::new(), { build_info => { product: protocol::keyexchange::Product::PRODUCT_PARTNER, @@ -104,7 +106,7 @@ fn client_hello(connection: T, gc: Vec) -> WriteAll> { write_all(connection, buffer) } -fn client_response(connection: T, challenge: Vec) -> WriteAll> { +fn client_response(connection: T, challenge: Vec) -> WriteAll> { let packet = protobuf_init!(ClientResponsePlaintext::new(), { login_crypto_response.diffie_hellman => { hmac: challenge @@ -126,14 +128,14 @@ enum RecvPacket { Body(ReadExact>>, PhantomData), } -fn recv_packet(connection: T, acc: Vec) -> RecvPacket +fn recv_packet(connection: T, acc: Vec) -> RecvPacket where T: Read, M: MessageStatic { RecvPacket::Header(read_into_accumulator(connection, 4, acc), PhantomData) } -impl Future for RecvPacket +impl Future for RecvPacket where T: Read, M: MessageStatic { @@ -165,7 +167,7 @@ impl Future for RecvPacket } } -fn read_into_accumulator(connection: T, size: usize, mut acc: Vec) -> ReadExact>> { +fn read_into_accumulator(connection: T, size: usize, mut acc: Vec) -> ReadExact>> { let offset = acc.len(); acc.resize(offset + size, 0); diff --git a/core/src/connection/mod.rs b/core/src/connection/mod.rs index 5df5c097..91c220b6 100644 --- a/core/src/connection/mod.rs +++ b/core/src/connection/mod.rs @@ -9,7 +9,7 @@ use std::io; use std::net::ToSocketAddrs; use tokio_core::net::TcpStream; use tokio_core::reactor::Handle; -use tokio_core::io::Framed; +use tokio_io::codec::Framed; use protobuf::{self, Message}; use authentication::Credentials; diff --git a/core/src/lib.rs b/core/src/lib.rs index 052c1236..17515a49 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -1,8 +1,5 @@ #![cfg_attr(feature = "cargo-clippy", allow(unused_io_amount))] -// TODO: many items from tokio-core::io have been deprecated in favour of tokio-io -#![allow(deprecated)] - #[macro_use] extern crate error_chain; #[macro_use] extern crate futures; #[macro_use] extern crate lazy_static; @@ -11,6 +8,7 @@ extern crate base64; extern crate byteorder; +extern crate bytes; extern crate crypto; extern crate hyper; extern crate num_bigint; @@ -23,6 +21,7 @@ extern crate serde; extern crate serde_json; extern crate shannon; extern crate tokio_core; +extern crate tokio_io; extern crate uuid; extern crate librespot_protocol as protocol; diff --git a/core/src/mercury/mod.rs b/core/src/mercury/mod.rs index 37514876..b37ed92b 100644 --- a/core/src/mercury/mod.rs +++ b/core/src/mercury/mod.rs @@ -1,11 +1,11 @@ use byteorder::{BigEndian, ByteOrder}; +use bytes::Bytes; use futures::sync::{oneshot, mpsc}; use futures::{Async, Poll, Future}; use protobuf; use protocol; use std::collections::HashMap; use std::mem; -use tokio_core::io::EasyBuf; use util::SeqGenerator; @@ -136,12 +136,12 @@ impl MercuryManager { })) } - pub fn dispatch(&self, cmd: u8, mut data: EasyBuf) { - let seq_len = BigEndian::read_u16(data.drain_to(2).as_ref()) as usize; - let seq = data.drain_to(seq_len).as_ref().to_owned(); + pub fn dispatch(&self, cmd: u8, mut data: Bytes) { + let seq_len = BigEndian::read_u16(data.split_to(2).as_ref()) as usize; + let seq = data.split_to(seq_len).as_ref().to_owned(); - let flags = data.drain_to(1).as_ref()[0]; - let count = BigEndian::read_u16(data.drain_to(2).as_ref()) as usize; + let flags = data.split_to(1).as_ref()[0]; + let count = BigEndian::read_u16(data.split_to(2).as_ref()) as usize; let pending = self.lock(|inner| inner.pending.remove(&seq)); @@ -181,9 +181,9 @@ impl MercuryManager { } } - fn parse_part(data: &mut EasyBuf) -> Vec { - let size = BigEndian::read_u16(data.drain_to(2).as_ref()) as usize; - data.drain_to(size).as_ref().to_owned() + fn parse_part(data: &mut Bytes) -> Vec { + let size = BigEndian::read_u16(data.split_to(2).as_ref()) as usize; + data.split_to(size).as_ref().to_owned() } fn complete_request(&self, cmd: u8, mut pending: MercuryPending) { diff --git a/core/src/session.rs b/core/src/session.rs index 1534d3ed..e3b474bf 100644 --- a/core/src/session.rs +++ b/core/src/session.rs @@ -1,10 +1,10 @@ +use bytes::Bytes; use crypto::digest::Digest; use crypto::sha1::Sha1; use futures::sync::mpsc; use futures::{Future, Stream, IntoFuture, Poll, Async}; use std::io; use std::sync::{RwLock, Arc, Weak}; -use tokio_core::io::EasyBuf; use tokio_core::reactor::{Handle, Remote}; use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering}; @@ -156,7 +156,7 @@ impl Session { } #[cfg_attr(feature = "cargo-clippy", allow(match_same_arms))] - fn dispatch(&self, cmd: u8, data: EasyBuf) { + fn dispatch(&self, cmd: u8, data: Bytes) { match cmd { 0x4 => { self.debug_info(); @@ -229,10 +229,10 @@ impl Drop for SessionInternal { } struct DispatchTask(S, SessionWeak) - where S: Stream; + where S: Stream; impl Future for DispatchTask - where S: Stream + where S: Stream { type Item = (); type Error = S::Error; @@ -253,7 +253,7 @@ impl Future for DispatchTask } impl Drop for DispatchTask - where S: Stream + where S: Stream { fn drop(&mut self) { debug!("drop Dispatch"); diff --git a/src/main.rs b/src/main.rs index 2e05b607..85131ee9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,12 +1,10 @@ -// TODO: many items from tokio-core::io have been deprecated in favour of tokio-io -#![allow(deprecated)] - #[macro_use] extern crate log; extern crate env_logger; extern crate futures; extern crate getopts; extern crate librespot; extern crate tokio_core; +extern crate tokio_io; extern crate tokio_signal; use env_logger::LogBuilder; @@ -17,7 +15,7 @@ use std::path::PathBuf; use std::process::exit; use std::str::FromStr; use tokio_core::reactor::{Handle, Core}; -use tokio_core::io::IoStream; +use tokio_io::IoStream; use std::mem; use librespot::core::authentication::{get_credentials, Credentials}; From 2465b0f57ff2224b704bfaddb548a6eb115483a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20B=C3=A4chler?= Date: Sun, 21 Jan 2018 23:35:50 +0100 Subject: [PATCH 33/56] Refactor the discovery module to remove usage of deprecated functions --- src/discovery.rs | 52 ++++++++++++++++++------------------------------ src/lib.rs | 3 --- 2 files changed, 19 insertions(+), 36 deletions(-) diff --git a/src/discovery.rs b/src/discovery.rs index 0b6e4ad1..fc168d5c 100644 --- a/src/discovery.rs +++ b/src/discovery.rs @@ -3,8 +3,8 @@ use crypto::digest::Digest; use crypto::mac::Mac; use crypto; use futures::sync::mpsc; -use futures::{Future, Stream, Poll, Async}; -use hyper::server::{Service, NewService, Request, Response, Http}; +use futures::{Future, Stream, Poll}; +use hyper::server::{Service, Request, Response, Http}; use hyper::{self, Get, Post, StatusCode}; use mdns; use num_bigint::BigUint; @@ -12,7 +12,6 @@ use rand; use std::collections::BTreeMap; use std::io; use std::sync::Arc; -use tokio_core::net::TcpListener; use tokio_core::reactor::Handle; use url; @@ -32,7 +31,7 @@ struct DiscoveryInner { } impl Discovery { - pub fn new(config: ConnectConfig, device_id: String) + fn new(config: ConnectConfig, device_id: String) -> (Discovery, mpsc::UnboundedReceiver) { let (tx, rx) = mpsc::unbounded(); @@ -190,21 +189,9 @@ impl Service for Discovery { } } -impl NewService for Discovery { - type Request = Request; - type Response = Response; - type Error = hyper::Error; - type Instance = Self; - - fn new_service(&self) -> io::Result { - Ok(self.clone()) - } -} - pub struct DiscoveryStream { credentials: mpsc::UnboundedReceiver, _svc: mdns::Service, - task: Box>, } pub fn discovery(handle: &Handle, config: ConnectConfig, device_id: String) @@ -212,15 +199,20 @@ pub fn discovery(handle: &Handle, config: ConnectConfig, device_id: String) { let (discovery, creds_rx) = Discovery::new(config.clone(), device_id); - let listener = TcpListener::bind(&"0.0.0.0:0".parse().unwrap(), handle)?; - let addr = listener.local_addr()?; - - let http = Http::new(); - let handle_ = handle.clone(); - let task = Box::new(listener.incoming().for_each(move |(socket, addr)| { - http.bind_connection(&handle_, socket, addr, discovery.clone()); - Ok(()) - })); + let serve = { + let http = Http::new(); + http.serve_addr_handle(&"0.0.0.0:0".parse().unwrap(), &handle, move || Ok(discovery.clone())).unwrap() + }; + let addr = serve.incoming_ref().local_addr(); + let server_future = { + let handle = handle.clone(); + serve.for_each(move |connection| { + handle.spawn(connection.then(|_| Ok(()))); + Ok(()) + }) + .then(|_| Ok(())) + }; + handle.spawn(server_future); let responder = mdns::Responder::spawn(&handle)?; let svc = responder.register( @@ -232,20 +224,14 @@ pub fn discovery(handle: &Handle, config: ConnectConfig, device_id: String) Ok(DiscoveryStream { credentials: creds_rx, _svc: svc, - task: task, }) } impl Stream for DiscoveryStream { type Item = Credentials; - type Error = io::Error; + type Error = (); fn poll(&mut self) -> Poll, Self::Error> { - match self.task.poll()? { - Async::Ready(()) => unreachable!(), - Async::NotReady => (), - } - - Ok(self.credentials.poll().unwrap()) + self.credentials.poll() } } diff --git a/src/lib.rs b/src/lib.rs index 5eaab011..53257a8a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2,9 +2,6 @@ #![cfg_attr(feature = "cargo-clippy", allow(unused_io_amount))] -// TODO: many items from tokio-core::io have been deprecated in favour of tokio-io -#![allow(deprecated)] - #[macro_use] extern crate log; #[macro_use] extern crate serde_json; #[macro_use] extern crate serde_derive; From 6b8a21db9fe17d3d1d703fbfd9c82b75b7f70150 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20B=C3=A4chler?= Date: Mon, 22 Jan 2018 00:50:24 +0100 Subject: [PATCH 34/56] Increase required Rust version to 1.18.0. --- .travis.yml | 6 ++---- README.md | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 94da7c93..86263773 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: rust rust: - - 1.17.0 + - 1.18.0 - stable - beta - nightly @@ -24,13 +24,11 @@ before_script: script: - cargo build --no-default-features - cargo build --no-default-features --features "with-tremor" + - cargo build --no-default-features --features "with-lewton"; - cargo build --no-default-features --features "portaudio-backend" - cargo build --no-default-features --features "pulseaudio-backend" - cargo build --no-default-features --features "alsa-backend" - cargo build --no-default-features --target armv7-unknown-linux-gnueabihf - - if [[ $TRAVIS_RUST_VERSION != *"1.17.0"* ]]; then - cargo build --no-default-features --features "with-lewton"; - fi notifications: email: false diff --git a/README.md b/README.md index bd8bf64c..c23fade7 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ I've done noting more than make this pretty so big thanks to: [brain0](https://github.com/brain0/) for [making pluseaudio more robust against audio failures](https://github.com/ComlOnline/librespot/pull/6) ## Building -Rust 1.17.0 or later is required to build librespot. +Rust 1.18.0 or later is required to build librespot. **If you are building librespot on macOS, the homebrew provided rust may fail due to the way in which homebrew installs rust. In this case, uninstall the homebrew version of rust and use [rustup](https://www.rustup.rs/), and librespot should then build.** From 4870acd572c8de86b9c71d308363485111c3725a Mon Sep 17 00:00:00 2001 From: Robert Date: Thu, 25 Jan 2018 23:37:28 +0100 Subject: [PATCH 35/56] Add --progressive-volume option. Increase volume slowly at low level, faster at higher level --- core/src/config.rs | 1 + src/main.rs | 11 ++++++++--- src/spirc.rs | 49 ++++++++++++++++++++++++++++++++++++---------- 3 files changed, 48 insertions(+), 13 deletions(-) diff --git a/core/src/config.rs b/core/src/config.rs index 46b22e41..aab65e69 100644 --- a/core/src/config.rs +++ b/core/src/config.rs @@ -122,4 +122,5 @@ pub struct ConnectConfig { pub name: String, pub device_type: DeviceType, pub volume: i32, + pub progressive_volume: bool, } diff --git a/src/main.rs b/src/main.rs index c6208f2b..27d91d21 100644 --- a/src/main.rs +++ b/src/main.rs @@ -101,7 +101,8 @@ fn setup(args: &[String]) -> Setup { .optopt("", "backend", "Audio backend to use. Use '?' to list options", "BACKEND") .optopt("", "device", "Audio device to use. Use '?' to list options", "DEVICE") .optopt("", "mixer", "Mixer to use", "MIXER") - .optopt("", "initial-volume", "Initial volume in %, once connected (must be from 0 to 100)", "VOLUME"); + .optopt("", "initial-volume", "Initial volume in %, once connected (must be from 0 to 100)", "VOLUME") + .optflag("", "progressive-volume", "Increase volume slowly at low level, faster at high level"); let matches = match opts.parse(&args[1..]) { Ok(m) => m, @@ -159,8 +160,11 @@ fn setup(args: &[String]) -> Setup { // if argument not present use default values (50%) else{ initial_volume = 0x8000 as i32; - } - debug!("Volume \"{}\" !", initial_volume); + } + + let progressive_volume = matches.opt_present("progressive-volume"); + info!("Volume:{}, progressive_volume: {}.", initial_volume, progressive_volume); + let name = matches.opt_str("name").unwrap(); let use_audio_cache = !matches.opt_present("disable-audio-cache"); @@ -209,6 +213,7 @@ fn setup(args: &[String]) -> Setup { name: name, device_type: device_type, volume: initial_volume, + progressive_volume, } }; diff --git a/src/spirc.rs b/src/spirc.rs index 795ba68f..f60d7ac0 100644 --- a/src/spirc.rs +++ b/src/spirc.rs @@ -17,12 +17,14 @@ use protocol::spirc::{PlayStatus, State, MessageType, Frame, DeviceState}; use mixer::Mixer; use player::Player; +use std; use rand; use rand::Rng; pub struct SpircTask { player: Player, mixer: Box, + progressive_volume:bool, sequence: SeqGenerator, @@ -122,6 +124,33 @@ fn initial_device_state(config: ConnectConfig, volume: u16) -> DeviceState { }) } +fn volume_to_mixer(volume: u16, progressive: bool) -> u16 { + if progressive { + // Some by trail determined volume calculation algorithm. Start increasing slowly, + // then after 50% increase in bigger steps. + let d = volume / (std::u16::MAX / 100); + let mut v:u32 = 0; + let mut incr:u32 = 0; + for i in 0..d { + v += incr; + incr +=3; + if i > 50 { + // Increase faster to reach max volume + incr += 42; + } + } + + // Clip the vulume to the max + if v > std::u16::MAX as u32 {v = std::u16::MAX as u32;} + debug!("volume_to_mixer {} {}", volume, v); + return v as u16; + } else { + debug!("volume_to_mixer {}", volume); + return volume; + } +} + + impl Spirc { pub fn new(config: ConnectConfig, session: Session, player: Player, mixer: Box) -> (Spirc, SpircTask) @@ -144,15 +173,15 @@ impl Spirc { })); let (cmd_tx, cmd_rx) = mpsc::unbounded(); - + let progressive_volume = config.progressive_volume; let volume = config.volume as u16; let device = initial_device_state(config, volume); - mixer.set_volume(volume as u16); + mixer.set_volume(volume_to_mixer(volume as u16, progressive_volume)); let mut task = SpircTask { player: player, mixer: mixer, - + progressive_volume, sequence: SeqGenerator::new(1), ident: ident, @@ -439,9 +468,9 @@ impl SpircTask { } MessageType::kMessageTypeVolume => { - let volume = frame.get_volume(); - self.device.set_volume(volume); - self.mixer.set_volume(frame.get_volume() as u16); + self.device.set_volume(frame.get_volume()); + self.mixer.set_volume( + volume_to_mixer(frame.get_volume() as u16, self.progressive_volume)); self.notify(None); } @@ -536,21 +565,21 @@ impl SpircTask { } fn handle_volume_up(&mut self) { - let mut volume: u32 = self.mixer.volume() as u32 + 4096; + let mut volume: u32 = self.device.get_volume() as u32 + 4096; if volume > 0xFFFF { volume = 0xFFFF; } self.device.set_volume(volume); - self.mixer.set_volume(volume as u16); + self.mixer.set_volume(volume_to_mixer(volume as u16, self.progressive_volume)); } fn handle_volume_down(&mut self) { - let mut volume: i32 = self.mixer.volume() as i32 - 4096; + let mut volume: i32 = self.device.get_volume() as i32 - 4096; if volume < 0 { volume = 0; } self.device.set_volume(volume as u32); - self.mixer.set_volume(volume as u16); + self.mixer.set_volume(volume_to_mixer(volume as u16, self.progressive_volume)); } fn handle_end_of_track(&mut self) { From 67adb06859d951755369ecd887e152e48f34fea4 Mon Sep 17 00:00:00 2001 From: Robert Date: Fri, 26 Jan 2018 01:10:52 +0100 Subject: [PATCH 36/56] update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index bd8bf64c..f1d648b9 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,7 @@ target/release/librespot --username USERNAME --cache CACHEDIR --name DEVICENAME | Option | | device | Audio device to use. Use '?' to list options | DEVICE | | Option | | mixer | Mixer to use | MIXER | | Option | | initial-volume | Initial volume in %, once connected [0-100] | VOLUME | +| Flag | | progressive-volume | Increase volume slowly at low level | | Taken from here: https://github.com/ComlOnline/librespot/blob/master/src/main.rs#L88 From f5b70c4cb6fd09e49e3f4851819853fb0c46005e Mon Sep 17 00:00:00 2001 From: Robert Date: Fri, 26 Jan 2018 01:10:52 +0100 Subject: [PATCH 37/56] update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index bd8bf64c..f1d648b9 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,7 @@ target/release/librespot --username USERNAME --cache CACHEDIR --name DEVICENAME | Option | | device | Audio device to use. Use '?' to list options | DEVICE | | Option | | mixer | Mixer to use | MIXER | | Option | | initial-volume | Initial volume in %, once connected [0-100] | VOLUME | +| Flag | | progressive-volume | Increase volume slowly at low level | | Taken from here: https://github.com/ComlOnline/librespot/blob/master/src/main.rs#L88 From de7d341faa3505b1ff4160f4819196ad9be32b88 Mon Sep 17 00:00:00 2001 From: thekr1s Date: Fri, 26 Jan 2018 01:17:31 +0100 Subject: [PATCH 38/56] update README.md --- README.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 README.md diff --git a/README.md b/README.md old mode 100644 new mode 100755 From 364f912885eb1880c70e1c709d6c40f245411d86 Mon Sep 17 00:00:00 2001 From: Colm Date: Fri, 26 Jan 2018 21:21:36 +0000 Subject: [PATCH 39/56] Update README.md --- README.md | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/README.md b/README.md index 881663bb..a2b0f4b2 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ which are not available in the official library. Note: librespot only works with Spotify Premium ## This fork -As the origin is no longer maintained I wanted to have a place for a version of librespot with other peoples forks and features merged. +As the origin by [plietar](https://github.com/plietar/) is no longer actively maintained I wanted to have a place for a version of librespot with other peoples forks and features merged. # Wiki More information can befound in the [wiki](https://github.com/librespot-org/librespot/wiki) @@ -48,14 +48,6 @@ Once you've built *librespot*, run it using : target/release/librespot --name DEVICENAME ``` -## Credits -I've done nothing more than make this pretty so big thanks to: -[plietar](https://github.com/plietar/) for making the thing in the first place. -[kingosticks](https://github.com/kingosticks/) for the Suffling and Repeat. -[ipha](https://github.com/ipha/) for the start stop audio sink. -[fossedihelm](https://github.com/fossedihelm/) for [addind a default inital volume and options for it](https://github.com/librespot-org/librespot/pull/5) -[brain0](https://github.com/brain0/) for [making pluseaudio more robust against audio failures](https://github.com/librespot-org/librespot/pull/6) - ## Disclaimer Using this code to connect to Spotify's API is probably forbidden by them. Use at your own risk. From 08959c23c41f29c969e67639211ea9a4c433e725 Mon Sep 17 00:00:00 2001 From: Colm Date: Fri, 26 Jan 2018 21:29:24 +0000 Subject: [PATCH 40/56] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a2b0f4b2..596a7edc 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ As the origin by [plietar](https://github.com/plietar/) is no longer actively ma More information can befound in the [wiki](https://github.com/librespot-org/librespot/wiki) # Building -Rust 1.17.0 or later is required to build librespot. +Rust 1.18.0 or later is required to build librespot. **If you are building librespot on macOS, the homebrew provided rust may fail due to the way in which homebrew installs rust. In this case, uninstall the homebrew version of rust and use [rustup](https://www.rustup.rs/), and librespot should then build.** From 1358fc7995382ba9d98510ba277051380a9b9c2c Mon Sep 17 00:00:00 2001 From: Colm Date: Fri, 26 Jan 2018 21:44:57 +0000 Subject: [PATCH 41/56] Typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 596a7edc..277a1b56 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Note: librespot only works with Spotify Premium As the origin by [plietar](https://github.com/plietar/) is no longer actively maintained I wanted to have a place for a version of librespot with other peoples forks and features merged. # Wiki -More information can befound in the [wiki](https://github.com/librespot-org/librespot/wiki) +More information can be found in the [wiki](https://github.com/librespot-org/librespot/wiki) # Building Rust 1.18.0 or later is required to build librespot. From b495f57676be3ebbddf1aed26d9f123bd6b45d70 Mon Sep 17 00:00:00 2001 From: Sasha Hilton Date: Sun, 28 Jan 2018 17:51:00 +0100 Subject: [PATCH 42/56] Proposed update to Readme. This is just a simple update to the readme to reflect this repo's intention as the replacement repo for plietar/librespot, and adds a to-do list for feature requests/problems that need resolving. --- README.md | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 277a1b56..3cd7e281 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ which are not available in the official library. Note: librespot only works with Spotify Premium ## This fork -As the origin by [plietar](https://github.com/plietar/) is no longer actively maintained I wanted to have a place for a version of librespot with other peoples forks and features merged. +As the origin by [plietar](https://github.com/plietar/) is no longer actively maintained, this organisation and repository have been set up so that the project may be maintained and upgraded in the future. # Wiki More information can be found in the [wiki](https://github.com/librespot-org/librespot/wiki) @@ -17,7 +17,7 @@ More information can be found in the [wiki](https://github.com/librespot-org/lib # Building Rust 1.18.0 or later is required to build librespot. -**If you are building librespot on macOS, the homebrew provided rust may fail due to the way in which homebrew installs rust. In this case, uninstall the homebrew version of rust and use [rustup](https://www.rustup.rs/), and librespot should then build.** +**If you are building librespot on macOS, the homebrew provided rust may fail due to the way in which homebrew installs rust. In this case, uninstall the homebrew version of rust and use [rustup](https://www.rustup.rs/), and librespot should then build. This should have been fixed in more recent versions of Homebrew, but we're leaving this notice here as a warning.** It also requires a C, with portaudio. @@ -48,13 +48,21 @@ Once you've built *librespot*, run it using : target/release/librespot --name DEVICENAME ``` -## Disclaimer -Using this code to connect to Spotify's API is probably forbidden by them. -Use at your own risk. - ## Contact Come and hang out on gitter if you need help or want to offer some. https://gitter.im/sashahilton00/spotify-connect-resources +## To-Do/Feature Requests +If there is a feature request that is being considered, or has been widely requested, it should be listed below. Please do not use this for bug reports or special use case feature requests. + +[ ] Document the Spotify Protocol and provide reference example. +[ ] Implement API to allow wrappers to be written for librespot. +[ ] Logarithmic volume scaling +[ ] Provide automatic release binaries for download + +## Disclaimer +Using this code to connect to Spotify's API is probably forbidden by them. +Use at your own risk. + ## License Everything in this repository is licensed under the MIT license. From a855fe62af65ab17bface0548907c7f7927b1fa6 Mon Sep 17 00:00:00 2001 From: Colm Date: Sun, 28 Jan 2018 16:57:05 +0000 Subject: [PATCH 43/56] Added metadata feature request and added link to logarithmic volume --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3cd7e281..a6ce9587 100644 --- a/README.md +++ b/README.md @@ -57,8 +57,9 @@ If there is a feature request that is being considered, or has been widely reque [ ] Document the Spotify Protocol and provide reference example. [ ] Implement API to allow wrappers to be written for librespot. -[ ] Logarithmic volume scaling +[ ] Logarithmic volume scaling (#10) [ ] Provide automatic release binaries for download +[ ] Provide an adequate method for exporting metadata (#7) ## Disclaimer Using this code to connect to Spotify's API is probably forbidden by them. From ad7162530cb5d3e61c2278cf99fbad5283effd5e Mon Sep 17 00:00:00 2001 From: Sasha Hilton Date: Sun, 28 Jan 2018 18:16:44 +0100 Subject: [PATCH 44/56] Fix formatting, add detail to metadata request. --- README.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index a6ce9587..d736595c 100644 --- a/README.md +++ b/README.md @@ -55,11 +55,13 @@ https://gitter.im/sashahilton00/spotify-connect-resources ## To-Do/Feature Requests If there is a feature request that is being considered, or has been widely requested, it should be listed below. Please do not use this for bug reports or special use case feature requests. -[ ] Document the Spotify Protocol and provide reference example. -[ ] Implement API to allow wrappers to be written for librespot. -[ ] Logarithmic volume scaling (#10) -[ ] Provide automatic release binaries for download -[ ] Provide an adequate method for exporting metadata (#7) +- [ ] Document the Spotify Protocol and provide reference example. +- [ ] Implement API to allow wrappers to be written for librespot. +- [ ] Logarithmic volume scaling (#10) +- [ ] Provide automatic release binaries for download +- [ ] Provide an adequate method for exporting metadata (#7) + - [ ] Provide API Documentation + - [ ] Provide Schema/Versioning ## Disclaimer Using this code to connect to Spotify's API is probably forbidden by them. From e0d31bc972a05b9ad6b894dff09a8e4675a50efe Mon Sep 17 00:00:00 2001 From: Sasha Hilton Date: Sun, 28 Jan 2018 18:53:24 +0100 Subject: [PATCH 45/56] Add Travis notifications to Gitter. --- .travis.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 86263773..402b32ae 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,4 +31,10 @@ script: - cargo build --no-default-features --target armv7-unknown-linux-gnueabihf notifications: - email: false + email: false + webhooks: + urls: + - https://webhooks.gitter.im/e/780b178b15811059752e + on_success: change # options: [always|never|change] default: always + on_failure: always # options: [always|never|change] default: always + on_start: never # options: [always|never|change] default: always From 43b5e02260cb6216aa3100d02546bdc99769bb21 Mon Sep 17 00:00:00 2001 From: Sasha Hilton Date: Sun, 28 Jan 2018 19:02:32 +0100 Subject: [PATCH 46/56] Add Gitter Badge --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 277a1b56..03b1ff98 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ [![Build Status](https://travis-ci.org/librespot-org/librespot.svg?branch=master)](https://travis-ci.org/librespot-org/librespot) +[![Gitter chat](https://badges.gitter.im/librespot-org/librespot.png)](https://gitter.im/sashahilton00/spotify-connect-resources) # librespot *librespot* is an open source client library for Spotify. It enables From 5f21c2582887b6f58aeb4a0900c5c28ee634ef98 Mon Sep 17 00:00:00 2001 From: Sasha Hilton Date: Sun, 28 Jan 2018 19:43:34 +0100 Subject: [PATCH 47/56] [ci skip] Fix formatting --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 907779f1..623a56f9 100644 --- a/README.md +++ b/README.md @@ -58,9 +58,9 @@ If there is a feature request that is being considered, or has been widely reque - [ ] Document the Spotify Protocol and provide reference example. - [ ] Implement API to allow wrappers to be written for librespot. -- [ ] Logarithmic volume scaling (#10) +- [ ] Logarithmic volume scaling ([#10](https://github.com/librespot-org/librespot/issues/10)) - [ ] Provide automatic release binaries for download -- [ ] Provide an adequate method for exporting metadata (#7) +- [ ] Provide an adequate method for exporting metadata ([#7](https://github.com/librespot-org/librespot/issues/7)) - [ ] Provide API Documentation - [ ] Provide Schema/Versioning From bec6b8c512ff2d2e7c4aa3d7819e02dd8fca73f8 Mon Sep 17 00:00:00 2001 From: Robert Date: Mon, 29 Jan 2018 23:37:30 +0100 Subject: [PATCH 48/56] Changed volume control after discussion: https://github.com/librespot-org/librespot/pull/10 implement exponential volume control only --- README.md | 1 - core/src/config.rs | 1 - src/main.rs | 11 +++------ src/spirc.rs | 56 +++++++++++++++++++++------------------------- 4 files changed, 28 insertions(+), 41 deletions(-) mode change 100755 => 100644 README.md diff --git a/README.md b/README.md old mode 100755 new mode 100644 index f1d648b9..bd8bf64c --- a/README.md +++ b/README.md @@ -73,7 +73,6 @@ target/release/librespot --username USERNAME --cache CACHEDIR --name DEVICENAME | Option | | device | Audio device to use. Use '?' to list options | DEVICE | | Option | | mixer | Mixer to use | MIXER | | Option | | initial-volume | Initial volume in %, once connected [0-100] | VOLUME | -| Flag | | progressive-volume | Increase volume slowly at low level | | Taken from here: https://github.com/ComlOnline/librespot/blob/master/src/main.rs#L88 diff --git a/core/src/config.rs b/core/src/config.rs index aab65e69..46b22e41 100644 --- a/core/src/config.rs +++ b/core/src/config.rs @@ -122,5 +122,4 @@ pub struct ConnectConfig { pub name: String, pub device_type: DeviceType, pub volume: i32, - pub progressive_volume: bool, } diff --git a/src/main.rs b/src/main.rs index 27d91d21..c6208f2b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -101,8 +101,7 @@ fn setup(args: &[String]) -> Setup { .optopt("", "backend", "Audio backend to use. Use '?' to list options", "BACKEND") .optopt("", "device", "Audio device to use. Use '?' to list options", "DEVICE") .optopt("", "mixer", "Mixer to use", "MIXER") - .optopt("", "initial-volume", "Initial volume in %, once connected (must be from 0 to 100)", "VOLUME") - .optflag("", "progressive-volume", "Increase volume slowly at low level, faster at high level"); + .optopt("", "initial-volume", "Initial volume in %, once connected (must be from 0 to 100)", "VOLUME"); let matches = match opts.parse(&args[1..]) { Ok(m) => m, @@ -160,11 +159,8 @@ fn setup(args: &[String]) -> Setup { // if argument not present use default values (50%) else{ initial_volume = 0x8000 as i32; - } - - let progressive_volume = matches.opt_present("progressive-volume"); - info!("Volume:{}, progressive_volume: {}.", initial_volume, progressive_volume); - + } + debug!("Volume \"{}\" !", initial_volume); let name = matches.opt_str("name").unwrap(); let use_audio_cache = !matches.opt_present("disable-audio-cache"); @@ -213,7 +209,6 @@ fn setup(args: &[String]) -> Setup { name: name, device_type: device_type, volume: initial_volume, - progressive_volume, } }; diff --git a/src/spirc.rs b/src/spirc.rs index f60d7ac0..422340ae 100644 --- a/src/spirc.rs +++ b/src/spirc.rs @@ -24,7 +24,6 @@ use rand::Rng; pub struct SpircTask { player: Player, mixer: Box, - progressive_volume:bool, sequence: SeqGenerator, @@ -124,30 +123,26 @@ fn initial_device_state(config: ConnectConfig, volume: u16) -> DeviceState { }) } -fn volume_to_mixer(volume: u16, progressive: bool) -> u16 { - if progressive { - // Some by trail determined volume calculation algorithm. Start increasing slowly, - // then after 50% increase in bigger steps. - let d = volume / (std::u16::MAX / 100); - let mut v:u32 = 0; - let mut incr:u32 = 0; - for i in 0..d { - v += incr; - incr +=3; - if i > 50 { - // Increase faster to reach max volume - incr += 42; - } - } - - // Clip the vulume to the max - if v > std::u16::MAX as u32 {v = std::u16::MAX as u32;} - debug!("volume_to_mixer {} {}", volume, v); - return v as u16; - } else { - debug!("volume_to_mixer {}", volume); - return volume; +fn volume_to_mixer(volume: u16) -> u16 { + // Volume conversion taken from https://www.dr-lex.be/info-stuff/volumecontrols.html#ideal2 + // Convert the given volume [0..0xffff] to a dB gain + // We assume a dB range of 60dB. + // Use the equatation: a * exp(b * x) + // in which a = IDEAL_FACTOR, b = 1/1000 + const IDEAL_FACTOR: f64 = 6.908; + let normalized_volume = volume as f64 / std::u16::MAX as f64; // To get a value between 0 and 1 + + let mut val = std::u16::MAX; + // Prevent val > std::u16::MAX due to rounding errors + if normalized_volume < 0.999 { + let new_volume = (normalized_volume * IDEAL_FACTOR).exp() / 1000.0; + val = (new_volume * std::u16::MAX as f64) as u16; } + + debug!("input volume:{} to mixer: {}", volume, val); + + // return the scale factor (0..0xffff) (equivalent to a voltage multiplier). + val } @@ -173,15 +168,15 @@ impl Spirc { })); let (cmd_tx, cmd_rx) = mpsc::unbounded(); - let progressive_volume = config.progressive_volume; + let volume = config.volume as u16; let device = initial_device_state(config, volume); - mixer.set_volume(volume_to_mixer(volume as u16, progressive_volume)); + mixer.set_volume(volume_to_mixer(volume as u16)); let mut task = SpircTask { player: player, mixer: mixer, - progressive_volume, + sequence: SeqGenerator::new(1), ident: ident, @@ -469,8 +464,7 @@ impl SpircTask { MessageType::kMessageTypeVolume => { self.device.set_volume(frame.get_volume()); - self.mixer.set_volume( - volume_to_mixer(frame.get_volume() as u16, self.progressive_volume)); + self.mixer.set_volume(volume_to_mixer(frame.get_volume() as u16)); self.notify(None); } @@ -570,7 +564,7 @@ impl SpircTask { volume = 0xFFFF; } self.device.set_volume(volume); - self.mixer.set_volume(volume_to_mixer(volume as u16, self.progressive_volume)); + self.mixer.set_volume(volume_to_mixer(volume as u16)); } fn handle_volume_down(&mut self) { @@ -579,7 +573,7 @@ impl SpircTask { volume = 0; } self.device.set_volume(volume as u32); - self.mixer.set_volume(volume_to_mixer(volume as u16, self.progressive_volume)); + self.mixer.set_volume(volume_to_mixer(volume as u16)); } fn handle_end_of_track(&mut self) { From bc7ceb3f65107f68ed7d2ee1db4e66e981a855b6 Mon Sep 17 00:00:00 2001 From: Sasha Hilton Date: Tue, 30 Jan 2018 17:42:32 +0100 Subject: [PATCH 49/56] Update To-Do --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 623a56f9..a56ed869 100644 --- a/README.md +++ b/README.md @@ -56,9 +56,11 @@ https://gitter.im/sashahilton00/spotify-connect-resources ## To-Do/Feature Requests If there is a feature request that is being considered, or has been widely requested, it should be listed below. Please do not use this for bug reports or special use case feature requests. +- [ ] Add support for contexts (used by dynamic playlists, Spotify Radio, green now-playing bar, etc.) ([#57](https://github.com/librespot-org/librespot/issues/57)) - [ ] Document the Spotify Protocol and provide reference example. - [ ] Implement API to allow wrappers to be written for librespot. -- [ ] Logarithmic volume scaling ([#10](https://github.com/librespot-org/librespot/issues/10)) +- [x] Logarithmic volume scaling ([#10](https://github.com/librespot-org/librespot/issues/10)) +- [ ] Fix Shuffle & Repeat functionality - [ ] Provide automatic release binaries for download - [ ] Provide an adequate method for exporting metadata ([#7](https://github.com/librespot-org/librespot/issues/7)) - [ ] Provide API Documentation From 8e8bab03d5eb787b4efd564a5ebdbe1a7eeaec6d Mon Sep 17 00:00:00 2001 From: Sasha Hilton Date: Tue, 30 Jan 2018 21:38:54 +0100 Subject: [PATCH 50/56] Add zeroconf-port option --- src/discovery.rs | 5 +++-- src/main.rs | 18 ++++++++++++++++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/discovery.rs b/src/discovery.rs index fc168d5c..e39c1738 100644 --- a/src/discovery.rs +++ b/src/discovery.rs @@ -194,14 +194,15 @@ pub struct DiscoveryStream { _svc: mdns::Service, } -pub fn discovery(handle: &Handle, config: ConnectConfig, device_id: String) +pub fn discovery(handle: &Handle, config: ConnectConfig, device_id: String, port: u16) -> io::Result { let (discovery, creds_rx) = Discovery::new(config.clone(), device_id); let serve = { let http = Http::new(); - http.serve_addr_handle(&"0.0.0.0:0".parse().unwrap(), &handle, move || Ok(discovery.clone())).unwrap() + debug!("Zeroconf server listening on 0.0.0.0:{}", port); + http.serve_addr_handle(&format!("0.0.0.0:{}", port).parse().unwrap(), &handle, move || Ok(discovery.clone())).unwrap() }; let addr = serve.incoming_ref().local_addr(); let server_future = { diff --git a/src/main.rs b/src/main.rs index 85131ee9..fd3f1c2c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -81,6 +81,7 @@ struct Setup { connect_config: ConnectConfig, credentials: Option, enable_discovery: bool, + zeroconf_port: u16, } fn setup(args: &[String]) -> Setup { @@ -99,7 +100,8 @@ fn setup(args: &[String]) -> Setup { .optopt("", "backend", "Audio backend to use. Use '?' to list options", "BACKEND") .optopt("", "device", "Audio device to use. Use '?' to list options", "DEVICE") .optopt("", "mixer", "Mixer to use", "MIXER") - .optopt("", "initial-volume", "Initial volume in %, once connected (must be from 0 to 100)", "VOLUME"); + .optopt("", "initial-volume", "Initial volume in %, once connected (must be from 0 to 100)", "VOLUME") + .optopt("z", "zeroconf-port", "The port the internal server advertised over zeroconf uses.", "ZEROCONF_PORT"); let matches = match opts.parse(&args[1..]) { Ok(m) => m, @@ -160,6 +162,17 @@ fn setup(args: &[String]) -> Setup { } debug!("Volume \"{}\" !", initial_volume); + let zeroconf_port: u16; + if matches.opt_present("zeroconf-port") && matches.opt_str("zeroconf-port").unwrap().parse::().is_ok() { + let z = matches.opt_str("zeroconf-port").unwrap().parse::().unwrap(); + match z { + z if z >= 1024 => { zeroconf_port = z } + _ => { zeroconf_port = 0 } + } + } else { + zeroconf_port = 0 + } + let name = matches.opt_str("name").unwrap(); let use_audio_cache = !matches.opt_present("disable-audio-cache"); @@ -221,6 +234,7 @@ fn setup(args: &[String]) -> Setup { credentials: credentials, device: device, enable_discovery: enable_discovery, + zeroconf_port: zeroconf_port, mixer: mixer, } } @@ -269,7 +283,7 @@ impl Main { let config = task.connect_config.clone(); let device_id = task.session_config.device_id.clone(); - task.discovery = Some(discovery(&handle, config, device_id).unwrap()); + task.discovery = Some(discovery(&handle, config, device_id, setup.zeroconf_port).unwrap()); } if let Some(credentials) = setup.credentials { From 863ea9c976235f28c086fb50baf99b3f08099f13 Mon Sep 17 00:00:00 2001 From: ComlOnline Date: Tue, 30 Jan 2018 20:52:25 +0000 Subject: [PATCH 51/56] removed and optimised --- src/main.rs | 32 +++++++++----------------------- 1 file changed, 9 insertions(+), 23 deletions(-) diff --git a/src/main.rs b/src/main.rs index 85131ee9..cccfb268 100644 --- a/src/main.rs +++ b/src/main.rs @@ -132,33 +132,19 @@ fn setup(args: &[String]) -> Setup { let mixer_name = matches.opt_str("mixer"); let mixer = mixer::find(mixer_name.as_ref()) .expect("Invalid mixer"); + let initial_volume; - // check if initial-volume argument is present - if matches.opt_present("initial-volume"){ - // check if value is a number - if matches.opt_str("initial-volume").unwrap().parse::().is_ok(){ - // check if value is in [0-100] range, otherwise put the bound values - if matches.opt_str("initial-volume").unwrap().parse::().unwrap() < 0 { - initial_volume = 0 as i32; + if matches.opt_present("initial-volume") && matches.opt_str("initial-volume").unwrap().parse::().is_ok() { + let iv = matches.opt_str("zeroconf-port").unwrap().parse::().unwrap(); + if iv => 0 && iv <= 100 { + initial_volume = iv * 0xFFFF as i32 / 100 ; + } else { + debug!("Volume needs to be a value from 0-100; set as 50%"); + initial_volume = 0x8000 as i32; } - else if matches.opt_str("initial-volume").unwrap().parse::().unwrap() > 100{ - initial_volume = 0xFFFF as i32; - } - // checks ok - else{ - initial_volume = matches.opt_str("initial-volume").unwrap().parse::().unwrap()* 0xFFFF as i32 / 100 ; - } - } - // if value is not a number use default value (50%) - else { + } else { initial_volume = 0x8000 as i32; } - } - // if argument not present use default values (50%) - else{ - initial_volume = 0x8000 as i32; - } - debug!("Volume \"{}\" !", initial_volume); let name = matches.opt_str("name").unwrap(); let use_audio_cache = !matches.opt_present("disable-audio-cache"); From 46de5a704b08d42a8d57b62ef103f0529c0195af Mon Sep 17 00:00:00 2001 From: ComlOnline Date: Tue, 30 Jan 2018 21:30:37 +0000 Subject: [PATCH 52/56] Thats what I get for copypasta --- src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index cccfb268..45c5ec87 100644 --- a/src/main.rs +++ b/src/main.rs @@ -135,8 +135,8 @@ fn setup(args: &[String]) -> Setup { let initial_volume; if matches.opt_present("initial-volume") && matches.opt_str("initial-volume").unwrap().parse::().is_ok() { - let iv = matches.opt_str("zeroconf-port").unwrap().parse::().unwrap(); - if iv => 0 && iv <= 100 { + let matches.opt_str("initial-volume").unwrap().parse::().unwrap(); + if 0 <= iv && iv <= 100 { initial_volume = iv * 0xFFFF as i32 / 100 ; } else { debug!("Volume needs to be a value from 0-100; set as 50%"); From 618eceb740113d25d58977f941e4a8ef2ce81481 Mon Sep 17 00:00:00 2001 From: ComlOnline Date: Tue, 30 Jan 2018 21:46:57 +0000 Subject: [PATCH 53/56] lost `iv -` due to previous --- src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 45c5ec87..499bb613 100644 --- a/src/main.rs +++ b/src/main.rs @@ -135,7 +135,7 @@ fn setup(args: &[String]) -> Setup { let initial_volume; if matches.opt_present("initial-volume") && matches.opt_str("initial-volume").unwrap().parse::().is_ok() { - let matches.opt_str("initial-volume").unwrap().parse::().unwrap(); + let iv = matches.opt_str("initial-volume").unwrap().parse::().unwrap(); if 0 <= iv && iv <= 100 { initial_volume = iv * 0xFFFF as i32 / 100 ; } else { From fddcbbcd8261563009436e9444275913317c0711 Mon Sep 17 00:00:00 2001 From: Sasha Hilton Date: Wed, 31 Jan 2018 00:05:54 +0100 Subject: [PATCH 54/56] Tidied up Syntax --- src/main.rs | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/main.rs b/src/main.rs index 499bb613..1ca16165 100644 --- a/src/main.rs +++ b/src/main.rs @@ -132,19 +132,20 @@ fn setup(args: &[String]) -> Setup { let mixer_name = matches.opt_str("mixer"); let mixer = mixer::find(mixer_name.as_ref()) .expect("Invalid mixer"); - - let initial_volume; - if matches.opt_present("initial-volume") && matches.opt_str("initial-volume").unwrap().parse::().is_ok() { - let iv = matches.opt_str("initial-volume").unwrap().parse::().unwrap(); - if 0 <= iv && iv <= 100 { - initial_volume = iv * 0xFFFF as i32 / 100 ; - } else { - debug!("Volume needs to be a value from 0-100; set as 50%"); - initial_volume = 0x8000 as i32; + + let initial_volume: i32; + if matches.opt_present("initial-volume") && matches.opt_str("initial-volume").unwrap().parse::().is_ok() { + let iv = matches.opt_str("initial-volume").unwrap().parse::().unwrap(); + match iv { + iv if iv >= 0 && iv <= 100 => { initial_volume = iv * 0xFFFF / 100 } + _ => { + debug!("Volume needs to be a value from 0-100; set volume level to 50%"); + initial_volume = 0x8000; } - } else { - initial_volume = 0x8000 as i32; } + } else { + initial_volume = 0x8000; + } let name = matches.opt_str("name").unwrap(); let use_audio_cache = !matches.opt_present("disable-audio-cache"); From d923f3bad377fc17add533e8de294fdf8bfcee3d Mon Sep 17 00:00:00 2001 From: Sasha Hilton Date: Wed, 31 Jan 2018 12:00:53 +0100 Subject: [PATCH 55/56] Add with-dns-sd feature flag --- Cargo.lock | 11 +++++++++++ Cargo.toml | 7 +++++-- src/discovery.rs | 30 +++++++++++++++++++++++++++++- src/lib.rs | 7 ++++++- 4 files changed, 51 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1bee8116..d01def63 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -106,6 +106,15 @@ dependencies = [ "quick-error 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "dns-sd" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "dtoa" version = "0.4.2" @@ -272,6 +281,7 @@ version = "0.1.0" dependencies = [ "alsa 0.0.1 (git+https://github.com/plietar/rust-alsa)", "base64 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "dns-sd 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1108,6 +1118,7 @@ dependencies = [ "checksum bytes 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "1b7db437d718977f6dc9b2e3fd6fc343c02ac6b899b73fdd2179163447bd9ce9" "checksum cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c819a1287eb618df47cc647173c5c4c66ba19d888a6e50d605672aed3140de" "checksum dns-parser 0.3.2 (git+https://github.com/plietar/dns-parser)" = "" +"checksum dns-sd 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d748509dea20228f63ba519bf142ce2593396386125b01f5b0d6412dab972087" "checksum dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "09c3753c3db574d215cba4ea76018483895d7bff25a31b49ba45db21c48e50ab" "checksum env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3ddf21e73e016298f5cb37d6ef8e8da8e39f91f9ec8b0df44b7deb16a9f8cd5b" "checksum error-chain 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e92ecf0a508c8e074c0e6fa8fe0fa38414848ad4dfc4db6f74c5e9753330b248" diff --git a/Cargo.toml b/Cargo.toml index 277e149f..dfe27524 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -54,6 +54,7 @@ alsa = { git = "https://github.com/plietar/rust-alsa", optional = tru portaudio-rs = { version = "0.3.0", optional = true } libpulse-sys = { version = "0.0.0", optional = true } libc = { version = "0.2", optional = true } +dns-sd = { version = "0.1.3", optional = true } [build-dependencies] rand = "0.3.13" @@ -68,11 +69,13 @@ pulseaudio-backend = ["libpulse-sys", "libc"] with-tremor = ["librespot-audio/with-tremor"] with-lewton = ["librespot-audio/with-lewton"] +with-dns-sd = ["dns-sd"] + default = ["portaudio-backend"] [package.metadata.deb] -maintainer = "nobody" -copyright = "2016 Paul Liétar" +maintainer = "librespot-org" +copyright = "2018 Paul Liétar" license_file = ["LICENSE", "4"] depends = "$auto" extended_description = """\ diff --git a/src/discovery.rs b/src/discovery.rs index fc168d5c..1f4617b4 100644 --- a/src/discovery.rs +++ b/src/discovery.rs @@ -6,7 +6,13 @@ use futures::sync::mpsc; use futures::{Future, Stream, Poll}; use hyper::server::{Service, Request, Response, Http}; use hyper::{self, Get, Post, StatusCode}; + +#[cfg(feature = "with-dns-sd")] +use dns_sd::DNSService; + +#[cfg(not(feature = "with-dns-sd"))] use mdns; + use num_bigint::BigUint; use rand; use std::collections::BTreeMap; @@ -189,6 +195,13 @@ impl Service for Discovery { } } +#[cfg(feature = "with-dns-sd")] +pub struct DiscoveryStream { + credentials: mpsc::UnboundedReceiver, + _svc: DNSService, +} + +#[cfg(not(feature = "with-dns-sd"))] pub struct DiscoveryStream { credentials: mpsc::UnboundedReceiver, _svc: mdns::Service, @@ -203,7 +216,10 @@ pub fn discovery(handle: &Handle, config: ConnectConfig, device_id: String) let http = Http::new(); http.serve_addr_handle(&"0.0.0.0:0".parse().unwrap(), &handle, move || Ok(discovery.clone())).unwrap() }; - let addr = serve.incoming_ref().local_addr(); + + #[cfg(feature = "with-dns-sd")] + let port = serve.incoming_ref().local_addr().port(); + let server_future = { let handle = handle.clone(); serve.for_each(move |connection| { @@ -214,7 +230,19 @@ pub fn discovery(handle: &Handle, config: ConnectConfig, device_id: String) }; handle.spawn(server_future); + #[cfg(feature = "with-dns-sd")] + let svc = DNSService::register(Some(&*config.name), + "_spotify-connect._tcp", + None, + None, + port, + &["VERSION=1.0", "CPath=/"]).unwrap(); + + #[cfg(not(feature = "with-dns-sd"))] + let addr = serve.incoming_ref().local_addr(); + #[cfg(not(feature = "with-dns-sd"))] let responder = mdns::Responder::spawn(&handle)?; + #[cfg(not(feature = "with-dns-sd"))] let svc = responder.register( "_spotify-connect._tcp".to_owned(), config.name, diff --git a/src/lib.rs b/src/lib.rs index 53257a8a..a08f2f5c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -10,7 +10,6 @@ extern crate base64; extern crate crypto; extern crate futures; extern crate hyper; -extern crate mdns; extern crate num_bigint; extern crate protobuf; extern crate rand; @@ -34,6 +33,12 @@ extern crate libpulse_sys; #[cfg(feature = "libc")] extern crate libc; +#[cfg(feature = "with-dns-sd")] +extern crate dns_sd; + +#[cfg(not(feature = "with-dns-sd"))] +extern crate mdns; + pub mod audio_backend; pub mod discovery; pub mod keymaster; From 7a58e6d561d91aa5d41d2da3ab641074aea68147 Mon Sep 17 00:00:00 2001 From: Sasha Hilton Date: Wed, 31 Jan 2018 12:08:23 +0100 Subject: [PATCH 56/56] fix addr in wrong place --- src/discovery.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/discovery.rs b/src/discovery.rs index 1f4617b4..0a621339 100644 --- a/src/discovery.rs +++ b/src/discovery.rs @@ -220,6 +220,9 @@ pub fn discovery(handle: &Handle, config: ConnectConfig, device_id: String) #[cfg(feature = "with-dns-sd")] let port = serve.incoming_ref().local_addr().port(); + #[cfg(not(feature = "with-dns-sd"))] + let addr = serve.incoming_ref().local_addr(); + let server_future = { let handle = handle.clone(); serve.for_each(move |connection| { @@ -238,10 +241,9 @@ pub fn discovery(handle: &Handle, config: ConnectConfig, device_id: String) port, &["VERSION=1.0", "CPath=/"]).unwrap(); - #[cfg(not(feature = "with-dns-sd"))] - let addr = serve.incoming_ref().local_addr(); #[cfg(not(feature = "with-dns-sd"))] let responder = mdns::Responder::spawn(&handle)?; + #[cfg(not(feature = "with-dns-sd"))] let svc = responder.register( "_spotify-connect._tcp".to_owned(),