enable librespot cache for audio data

This commit is contained in:
Henrik Friedrichsen
2019-03-31 16:28:43 +02:00
parent fdb1d01d9a
commit 3d446ab942

View File

@@ -1,4 +1,5 @@
use librespot::core::authentication::Credentials;
use librespot::core::cache::Cache;
use librespot::core::config::SessionConfig;
use librespot::core::keymaster::Token;
use librespot::core::mercury::MercuryError;
@@ -214,11 +215,17 @@ impl Spotify {
fn create_session(core: &mut Core, credentials: Credentials) -> Session {
let session_config = SessionConfig::default();
let cache = Cache::new(config::cache_path("librespot"), true);
let handle = core.handle();
debug!("opening spotify session");
core.run(Session::connect(session_config, credentials, None, handle))
.ok()
.unwrap()
core.run(Session::connect(
session_config,
credentials,
Some(cache),
handle,
))
.ok()
.unwrap()
}
fn get_token(