From e3516ebd9baaeb48740e4c6f50aca1bae7e07463 Mon Sep 17 00:00:00 2001 From: awiouy Date: Tue, 6 Feb 2018 01:00:00 +0100 Subject: [PATCH] Move discovery to its own module. --- Cargo.toml | 6 +++--- discovery/Cargo.toml | 29 +++++++++++++++++++++++++++++ {src => discovery/src}/discovery.rs | 0 discovery/src/lib.rs | 22 ++++++++++++++++++++++ src/lib.rs | 10 +--------- src/main.rs | 2 +- 6 files changed, 56 insertions(+), 13 deletions(-) create mode 100644 discovery/Cargo.toml rename {src => discovery/src}/discovery.rs (100%) create mode 100644 discovery/src/lib.rs diff --git a/Cargo.toml b/Cargo.toml index 6e3a798d..4623702e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,6 +24,8 @@ doc = false path = "audio" [dependencies.librespot-core] path = "core" +[dependencies.librespot-discovery] +path = "discovery" [dependencies.librespot-metadata] path = "metadata" [dependencies.librespot-protocol] @@ -36,7 +38,6 @@ futures = "0.1.8" getopts = "0.2.14" hyper = "0.11.2" log = "0.3.5" -mdns = { git = "https://github.com/plietar/rust-mdns" } num-bigint = "0.1.35" protobuf = "1.1" rand = "0.3.13" @@ -55,7 +56,6 @@ portaudio-rs = { version = "0.3.0", optional = true } libpulse-sys = { version = "0.0.0", optional = true } jack = { version = "0.5.3", optional = true } libc = { version = "0.2", optional = true } -dns-sd = { version = "0.1.3", optional = true } [build-dependencies] rand = "0.3.13" @@ -71,7 +71,7 @@ jackaudio-backend = ["jack"] with-tremor = ["librespot-audio/with-tremor"] with-lewton = ["librespot-audio/with-lewton"] -with-dns-sd = ["dns-sd"] +with-dns-sd = ["librespot-discovery/dns-sd"] default = ["portaudio-backend"] diff --git a/discovery/Cargo.toml b/discovery/Cargo.toml new file mode 100644 index 00000000..f69185a0 --- /dev/null +++ b/discovery/Cargo.toml @@ -0,0 +1,29 @@ +[package] +name = "librespot-discovery" +version = "0.1.0" +authors = ["Paul Lietar "] + +[dependencies.librespot-core] +path = "../core" + +[dependencies] +base64 = "0.5.0" +futures = "0.1.8" +hyper = "0.11.2" +log = "0.3.5" +num-bigint = "0.1.35" +protobuf = "1.1" +rand = "0.3.13" +rust-crypto = { git = "https://github.com/awmath/rust-crypto.git", branch = "avx2" } +serde = "0.9.6" +serde_derive = "0.9.6" +serde_json = "0.9.5" +tokio-core = "0.1.2" +url = "1.3" + +dns-sd = { version = "0.1.3", optional = true } +mdns = { git = "https://github.com/plietar/rust-mdns", optional = true } + +[features] +default = ["mdns"] +with-dns-sd = ["dns-sd"] diff --git a/src/discovery.rs b/discovery/src/discovery.rs similarity index 100% rename from src/discovery.rs rename to discovery/src/discovery.rs diff --git a/discovery/src/lib.rs b/discovery/src/lib.rs new file mode 100644 index 00000000..d8775b8a --- /dev/null +++ b/discovery/src/lib.rs @@ -0,0 +1,22 @@ +#[macro_use] extern crate log; +#[macro_use] extern crate serde_json; + +extern crate base64; +extern crate crypto; +extern crate futures; +extern crate hyper; +extern crate num_bigint; +extern crate protobuf; +extern crate rand; +extern crate tokio_core; +extern crate url; + +#[cfg(feature = "with-dns-sd")] +extern crate dns_sd; + +#[cfg(not(feature = "with-dns-sd"))] +extern crate mdns; + +extern crate librespot_core as core; + +pub mod discovery; diff --git a/src/lib.rs b/src/lib.rs index 753827c6..2d9aad1b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,8 +3,6 @@ #![cfg_attr(feature = "cargo-clippy", allow(unused_io_amount))] #[macro_use] extern crate log; -#[macro_use] extern crate serde_json; -#[macro_use] extern crate serde_derive; extern crate base64; extern crate crypto; @@ -18,6 +16,7 @@ extern crate url; pub extern crate librespot_audio as audio; pub extern crate librespot_core as core; +pub extern crate librespot_discovery as discovery; pub extern crate librespot_protocol as protocol; pub extern crate librespot_metadata as metadata; @@ -36,14 +35,7 @@ extern crate jack; #[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 mixer; pub mod player; diff --git a/src/main.rs b/src/main.rs index cbf495dc..4200fc16 100644 --- a/src/main.rs +++ b/src/main.rs @@ -25,7 +25,7 @@ use librespot::core::session::Session; use librespot::core::version; use librespot::audio_backend::{self, Sink, BACKENDS}; -use librespot::discovery::{discovery, DiscoveryStream}; +use librespot::discovery::discovery::{discovery, DiscoveryStream}; use librespot::mixer::{self, Mixer}; use librespot::player::Player; use librespot::spirc::{Spirc, SpircTask};