Merge pull request #131 from librespot-org/modularise

Move discovery functionality into new crate.
This commit is contained in:
Sasha Hilton 2018-02-08 09:30:50 +01:00 committed by GitHub
commit 682df767a6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 56 additions and 13 deletions

View file

@ -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"]

29
discovery/Cargo.toml Normal file
View file

@ -0,0 +1,29 @@
[package]
name = "librespot-discovery"
version = "0.1.0"
authors = ["Paul Lietar <paul@lietar.net>"]
[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"]

22
discovery/src/lib.rs Normal file
View file

@ -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;

View file

@ -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;

View file

@ -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};