mirror of
https://github.com/librespot-org/librespot.git
synced 2024-12-18 17:11:53 +00:00
Clean up librespot-connect dependencies
This commit is contained in:
parent
d064ffc670
commit
59c556635e
6 changed files with 42 additions and 65 deletions
4
Cargo.lock
generated
4
Cargo.lock
generated
|
@ -1406,7 +1406,8 @@ dependencies = [
|
||||||
"base64",
|
"base64",
|
||||||
"block-modes",
|
"block-modes",
|
||||||
"dns-sd",
|
"dns-sd",
|
||||||
"futures",
|
"futures-core",
|
||||||
|
"futures-util",
|
||||||
"hmac",
|
"hmac",
|
||||||
"hyper",
|
"hyper",
|
||||||
"libmdns",
|
"libmdns",
|
||||||
|
@ -1418,7 +1419,6 @@ dependencies = [
|
||||||
"protobuf",
|
"protobuf",
|
||||||
"rand 0.8.3",
|
"rand 0.8.3",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_derive",
|
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"sha-1 0.9.4",
|
"sha-1 0.9.4",
|
||||||
"tokio",
|
"tokio",
|
||||||
|
|
|
@ -7,39 +7,42 @@ license = "MIT"
|
||||||
repository = "https://github.com/librespot-org/librespot"
|
repository = "https://github.com/librespot-org/librespot"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
[dependencies.librespot-core]
|
|
||||||
path = "../core"
|
|
||||||
version = "0.1.6"
|
|
||||||
[dependencies.librespot-playback]
|
|
||||||
path = "../playback"
|
|
||||||
version = "0.1.6"
|
|
||||||
[dependencies.librespot-protocol]
|
|
||||||
path = "../protocol"
|
|
||||||
version = "0.1.6"
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
aes-ctr = "0.6"
|
aes-ctr = "0.6"
|
||||||
base64 = "0.13"
|
base64 = "0.13"
|
||||||
block-modes = "0.7"
|
block-modes = "0.7"
|
||||||
futures = "0.3"
|
futures-core = "0.3"
|
||||||
|
futures-util = "0.3"
|
||||||
hmac = "0.10"
|
hmac = "0.10"
|
||||||
hyper = { version = "0.14", features = ["server", "http1"] }
|
hyper = { version = "0.14", features = ["server", "http1"] }
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
num-bigint = "0.3"
|
num-bigint = "0.3"
|
||||||
protobuf = "~2.14.0"
|
protobuf = "~2.14.0"
|
||||||
rand = "0.8"
|
rand = "0.8"
|
||||||
serde = "1.0"
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
serde_derive = "1.0"
|
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
sha-1 = "0.9"
|
sha-1 = "0.9"
|
||||||
tokio = { version = "1.0", features = ["macros"] }
|
tokio = { version = "1.0", features = ["macros", "sync"] }
|
||||||
tokio-stream = { version = "0.1" }
|
tokio-stream = { version = "0.1" }
|
||||||
url = "1.7"
|
url = "1.7"
|
||||||
|
|
||||||
dns-sd = { version = "0.1.3", optional = true }
|
dns-sd = { version = "0.1.3", optional = true }
|
||||||
libmdns = { version = "0.6", optional = true }
|
libmdns = { version = "0.6", optional = true }
|
||||||
|
|
||||||
|
[dependencies.librespot-core]
|
||||||
|
path = "../core"
|
||||||
|
version = "0.1.6"
|
||||||
|
|
||||||
|
[dependencies.librespot-playback]
|
||||||
|
path = "../playback"
|
||||||
|
version = "0.1.6"
|
||||||
|
|
||||||
|
[dependencies.librespot-protocol]
|
||||||
|
path = "../protocol"
|
||||||
|
version = "0.1.6"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["libmdns"]
|
with-libmdns = ["libmdns"]
|
||||||
with-dns-sd = ["dns-sd"]
|
with-dns-sd = ["dns-sd"]
|
||||||
|
|
||||||
|
default = ["with-libmdns"]
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
use crate::core::spotify_id::SpotifyId;
|
||||||
use crate::protocol::spirc::TrackRef;
|
use crate::protocol::spirc::TrackRef;
|
||||||
use librespot_core::spotify_id::SpotifyId;
|
|
||||||
|
|
||||||
use serde;
|
use serde::Deserialize;
|
||||||
|
|
||||||
#[derive(Deserialize, Debug)]
|
#[derive(Deserialize, Debug)]
|
||||||
pub struct StationContext {
|
pub struct StationContext {
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
use aes_ctr::cipher::generic_array::GenericArray;
|
use aes_ctr::cipher::generic_array::GenericArray;
|
||||||
use aes_ctr::cipher::{NewStreamCipher, SyncStreamCipher};
|
use aes_ctr::cipher::{NewStreamCipher, SyncStreamCipher};
|
||||||
use aes_ctr::Aes128Ctr;
|
use aes_ctr::Aes128Ctr;
|
||||||
use base64;
|
use futures_core::Stream;
|
||||||
use futures::channel::{mpsc, oneshot};
|
|
||||||
use futures::{Stream, StreamExt};
|
|
||||||
use hmac::{Hmac, Mac, NewMac};
|
use hmac::{Hmac, Mac, NewMac};
|
||||||
use hyper::service::{make_service_fn, service_fn};
|
use hyper::service::{make_service_fn, service_fn};
|
||||||
use hyper::{Body, Method, Request, Response, StatusCode};
|
use hyper::{Body, Method, Request, Response, StatusCode};
|
||||||
|
use serde_json::json;
|
||||||
use sha1::{Digest, Sha1};
|
use sha1::{Digest, Sha1};
|
||||||
|
use tokio::sync::{mpsc, oneshot};
|
||||||
|
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::convert::Infallible;
|
use std::convert::Infallible;
|
||||||
|
@ -50,7 +50,7 @@ impl Discovery {
|
||||||
config: ConnectConfig,
|
config: ConnectConfig,
|
||||||
device_id: String,
|
device_id: String,
|
||||||
) -> (Discovery, mpsc::UnboundedReceiver<Credentials>) {
|
) -> (Discovery, mpsc::UnboundedReceiver<Credentials>) {
|
||||||
let (tx, rx) = mpsc::unbounded();
|
let (tx, rx) = mpsc::unbounded_channel();
|
||||||
|
|
||||||
let key_data = util::rand_vec(&mut rand::thread_rng(), 95);
|
let key_data = util::rand_vec(&mut rand::thread_rng(), 95);
|
||||||
let private_key = BigUint::from_bytes_be(&key_data);
|
let private_key = BigUint::from_bytes_be(&key_data);
|
||||||
|
@ -155,7 +155,7 @@ impl Discovery {
|
||||||
let credentials =
|
let credentials =
|
||||||
Credentials::with_blob(username.to_string(), &decrypted, &self.0.device_id);
|
Credentials::with_blob(username.to_string(), &decrypted, &self.0.device_id);
|
||||||
|
|
||||||
self.0.tx.unbounded_send(credentials).unwrap();
|
self.0.tx.send(credentials).unwrap();
|
||||||
|
|
||||||
let result = json!({
|
let result = json!({
|
||||||
"status": 101,
|
"status": 101,
|
||||||
|
@ -273,6 +273,6 @@ impl Stream for DiscoveryStream {
|
||||||
type Item = Credentials;
|
type Item = Credentials;
|
||||||
|
|
||||||
fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
|
fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
|
||||||
self.credentials.poll_next_unpin(cx)
|
self.credentials.poll_recv(cx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,34 +1,9 @@
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate log;
|
extern crate log;
|
||||||
#[macro_use]
|
|
||||||
extern crate serde_json;
|
|
||||||
#[macro_use]
|
|
||||||
extern crate serde_derive;
|
|
||||||
extern crate serde;
|
|
||||||
|
|
||||||
extern crate base64;
|
use librespot_core as core;
|
||||||
extern crate futures;
|
use librespot_playback as playback;
|
||||||
extern crate hyper;
|
use librespot_protocol as protocol;
|
||||||
extern crate num_bigint;
|
|
||||||
extern crate protobuf;
|
|
||||||
extern crate rand;
|
|
||||||
extern crate tokio;
|
|
||||||
extern crate url;
|
|
||||||
|
|
||||||
extern crate aes_ctr;
|
|
||||||
extern crate block_modes;
|
|
||||||
extern crate hmac;
|
|
||||||
extern crate sha1;
|
|
||||||
|
|
||||||
#[cfg(feature = "with-dns-sd")]
|
|
||||||
extern crate dns_sd;
|
|
||||||
|
|
||||||
#[cfg(not(feature = "with-dns-sd"))]
|
|
||||||
extern crate libmdns;
|
|
||||||
|
|
||||||
extern crate librespot_core;
|
|
||||||
extern crate librespot_playback as playback;
|
|
||||||
extern crate librespot_protocol as protocol;
|
|
||||||
|
|
||||||
pub mod context;
|
pub mod context;
|
||||||
pub mod discovery;
|
pub mod discovery;
|
||||||
|
|
|
@ -1,26 +1,25 @@
|
||||||
|
use std::future::Future;
|
||||||
use std::pin::Pin;
|
use std::pin::Pin;
|
||||||
use std::time::{SystemTime, UNIX_EPOCH};
|
use std::time::{SystemTime, UNIX_EPOCH};
|
||||||
|
|
||||||
use crate::context::StationContext;
|
use crate::context::StationContext;
|
||||||
|
use crate::core::config::{ConnectConfig, VolumeCtrl};
|
||||||
|
use crate::core::mercury::{MercuryError, MercurySender};
|
||||||
|
use crate::core::session::Session;
|
||||||
|
use crate::core::spotify_id::{SpotifyAudioType, SpotifyId, SpotifyIdError};
|
||||||
|
use crate::core::util::url_encode;
|
||||||
|
use crate::core::util::SeqGenerator;
|
||||||
|
use crate::core::version;
|
||||||
use crate::playback::mixer::Mixer;
|
use crate::playback::mixer::Mixer;
|
||||||
use crate::playback::player::{Player, PlayerEvent, PlayerEventChannel};
|
use crate::playback::player::{Player, PlayerEvent, PlayerEventChannel};
|
||||||
use crate::protocol;
|
use crate::protocol;
|
||||||
use crate::protocol::spirc::{DeviceState, Frame, MessageType, PlayStatus, State, TrackRef};
|
use crate::protocol::spirc::{DeviceState, Frame, MessageType, PlayStatus, State, TrackRef};
|
||||||
|
|
||||||
use futures::future::{self, FusedFuture};
|
use futures_util::future::{self, FusedFuture};
|
||||||
use futures::stream::FusedStream;
|
use futures_util::stream::FusedStream;
|
||||||
use futures::{Future, FutureExt, StreamExt};
|
use futures_util::{FutureExt, StreamExt};
|
||||||
use librespot_core::config::{ConnectConfig, VolumeCtrl};
|
|
||||||
use librespot_core::mercury::{MercuryError, MercurySender};
|
|
||||||
use librespot_core::session::Session;
|
|
||||||
use librespot_core::spotify_id::{SpotifyAudioType, SpotifyId, SpotifyIdError};
|
|
||||||
use librespot_core::util::url_encode;
|
|
||||||
use librespot_core::util::SeqGenerator;
|
|
||||||
use librespot_core::version;
|
|
||||||
use protobuf::{self, Message};
|
use protobuf::{self, Message};
|
||||||
use rand;
|
|
||||||
use rand::seq::SliceRandom;
|
use rand::seq::SliceRandom;
|
||||||
use serde_json;
|
|
||||||
use tokio::sync::mpsc;
|
use tokio::sync::mpsc;
|
||||||
use tokio_stream::wrappers::UnboundedReceiverStream;
|
use tokio_stream::wrappers::UnboundedReceiverStream;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue