mirror of
https://github.com/librespot-org/librespot.git
synced 2025-10-05 02:39:53 +02:00
Stop caching audio keys, reenable audio file cache
This commit is contained in:
parent
8aeb266a2d
commit
17482c236a
9 changed files with 146 additions and 82 deletions
11
src/main.rs
11
src/main.rs
|
@ -18,7 +18,7 @@ use tokio_core::reactor::Core;
|
|||
use librespot::spirc::Spirc;
|
||||
use librespot::authentication::{get_credentials, Credentials};
|
||||
use librespot::audio_backend::{self, Sink, BACKENDS};
|
||||
use librespot::cache::{Cache, DefaultCache, NoCache};
|
||||
use librespot::cache::Cache;
|
||||
use librespot::player::Player;
|
||||
use librespot::session::{Bitrate, Config, Session};
|
||||
use librespot::version;
|
||||
|
@ -64,7 +64,7 @@ fn list_backends() {
|
|||
|
||||
struct Setup {
|
||||
backend: &'static (Fn(Option<String>) -> Box<Sink> + Send + Sync),
|
||||
cache: Box<Cache + Send + Sync>,
|
||||
cache: Option<Cache>,
|
||||
config: Config,
|
||||
credentials: Credentials,
|
||||
device: Option<String>,
|
||||
|
@ -116,11 +116,10 @@ fn setup(args: &[String]) -> Setup {
|
|||
let device_id = librespot::session::device_id(&name);
|
||||
|
||||
let cache = matches.opt_str("c").map(|cache_location| {
|
||||
Box::new(DefaultCache::new(PathBuf::from(cache_location)).unwrap())
|
||||
as Box<Cache + Send + Sync>
|
||||
}).unwrap_or_else(|| Box::new(NoCache));
|
||||
Cache::new(PathBuf::from(cache_location))
|
||||
});
|
||||
|
||||
let cached_credentials = cache.get_credentials();
|
||||
let cached_credentials = cache.as_ref().and_then(Cache::credentials);
|
||||
|
||||
let credentials = get_credentials(&name, &device_id,
|
||||
matches.opt_str("username"),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue