enable librespot cache for audio data
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
use librespot::core::authentication::Credentials;
|
use librespot::core::authentication::Credentials;
|
||||||
|
use librespot::core::cache::Cache;
|
||||||
use librespot::core::config::SessionConfig;
|
use librespot::core::config::SessionConfig;
|
||||||
use librespot::core::keymaster::Token;
|
use librespot::core::keymaster::Token;
|
||||||
use librespot::core::mercury::MercuryError;
|
use librespot::core::mercury::MercuryError;
|
||||||
@@ -214,11 +215,17 @@ impl Spotify {
|
|||||||
|
|
||||||
fn create_session(core: &mut Core, credentials: Credentials) -> Session {
|
fn create_session(core: &mut Core, credentials: Credentials) -> Session {
|
||||||
let session_config = SessionConfig::default();
|
let session_config = SessionConfig::default();
|
||||||
|
let cache = Cache::new(config::cache_path("librespot"), true);
|
||||||
let handle = core.handle();
|
let handle = core.handle();
|
||||||
debug!("opening spotify session");
|
debug!("opening spotify session");
|
||||||
core.run(Session::connect(session_config, credentials, None, handle))
|
core.run(Session::connect(
|
||||||
.ok()
|
session_config,
|
||||||
.unwrap()
|
credentials,
|
||||||
|
Some(cache),
|
||||||
|
handle,
|
||||||
|
))
|
||||||
|
.ok()
|
||||||
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_token(
|
fn get_token(
|
||||||
|
|||||||
Reference in New Issue
Block a user