Skip to content

Commit

Permalink
Getting it to compile
Browse files Browse the repository at this point in the history
  • Loading branch information
marioortizmanero committed Sep 21, 2020
1 parent 74b026b commit c596ede
Show file tree
Hide file tree
Showing 8 changed files with 199 additions and 268 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ If we missed any change or there's something you'd like to discuss about this ve
+ Remove unused dependencies: `base64`, `env_logger`, `derive_builder`, `random`, `url`. <!-- NOTE: derive_builder might not be removed after all -->
+ Remove `itertools` dependency by using the standard library.
+ Remove `rand` in place of `getrandom` to [reduce total dependencies and compile times](https://github.com/ramsayleung/rspotify/issues/108#issuecomment-673587185).
+ `webbrowser` and access to functions that use it (`util::get_token`, `util::get_token_without_cache` and `util::request_token`) can be disabled for the non-CLI applications with the `browser` feature. It's still enabled by default due to [its frequent usage](https://github.com/ramsayleung/rspotify/pull/110#issuecomment-674410604).
+ `webbrowser` and access to functions that use it (`util::get_token`, `util::get_token_without_cache` and `util::request_token`) is now optional under the `cli` feature.
+ Cleanup, reduced repetitive code and boilerplate internally in several places ([#117](https://github.com/ramsayleung/rspotify/pull/117), [#113](https://github.com/ramsayleung/rspotify/pull/113), [#107](https://github.com/ramsayleung/rspotify/pull/107), [#106](https://github.com/ramsayleung/rspotify/pull/106)).
+ Lots of improvements to the internal code in the `blocking` module. It now re-uses the async implementation and avoids lots of duplicate code ([#112](https://github.com/ramsayleung/rspotify/issues/112).
- Updated dependencies to the latest versions, integrated Dependabot to keep track of them ([#105](https://github.com/ramsayleung/rspotify/pull/105), [#111](https://github.com/ramsayleung/rspotify/pull/111)).
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ tokio = { version = "0.2.22", features = ["full"] }
futures = "0.3.5"

[features]
default = ["client-reqwest", "browser"]
default = ["client-reqwest"]
cli = ["webbrowser"]
env-file = ["dotenv"]
browser = ["webbrowser"]
client-ureq = ["ureq", "maybe-async/is_sync"]
# Passing the TLS features to reqwest.
client-reqwest = ["reqwest"]
Expand Down
16 changes: 9 additions & 7 deletions examples/album.rs
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
use rspotify::client::Spotify;
use rspotify::oauth2::SpotifyClientCredentials;
use rspotify::client::SpotifyBuilder;
use rspotify::oauth2::ClientCredentialsBuilder;

#[tokio::main]
async fn main() {
// Set client_id and client_secret in .env file or
// export RSPOTIFY_CLIENT_ID="your client_id"
// export RSPOTIFY_CLIENT_SECRET="secret"
let client_credential = SpotifyClientCredentials::default().build();
let creds = ClientCredentialsBuilder::from_env().build().unwrap();

// Or set client_id and client_secret explictly
// let client_credential = SpotifyClientCredentials::default()
// .client_id("this-is-my-client-id")
// .client_secret("this-is-my-client-secret")
// .build();
let spotify = Spotify::default()
.client_credentials_manager(client_credential)
.build();
let spotify = SpotifyBuilder::default()
.credentials(creds)
.build()
.unwrap();
let birdy_uri = "spotify:album:0sNOF9WDwhWunNAHPD3Baj";
let albums = spotify.album(birdy_uri).await;
println!("{:?}", albums);

println!("Response: {:#?}", albums);
}
Loading

0 comments on commit c596ede

Please sign in to comment.