Migrate ncspot to librespot 0.5 breaking changes

- Set `client_id` via `SessionConfig`
- Use `TokenProvider` to obtain client token instead of custom Mercury call
- Other minor changes
This commit is contained in:
Henrik Friedrichsen
2023-07-26 02:02:48 +02:00
parent 4bebdef81b
commit ace23462f7
4 changed files with 36 additions and 48 deletions

View File

@@ -105,13 +105,13 @@ impl WebApi {
if let Ok(Some(token)) = token_rx.recv() {
*api_token.lock().unwrap() = Some(Token {
access_token: token.access_token,
expires_in: chrono::Duration::try_seconds(token.expires_in.into()).unwrap(),
scopes: HashSet::from_iter(token.scope),
expires_in: chrono::Duration::from_std(token.expires_in).unwrap(),
scopes: HashSet::from_iter(token.scopes),
expires_at: None,
refresh_token: None,
});
*api_token_expiration.write().unwrap() =
Utc::now() + ChronoDuration::try_seconds(token.expires_in.into()).unwrap();
Utc::now() + ChronoDuration::from_std(token.expires_in).unwrap();
} else {
error!("Failed to update token");
}