mirror of
https://github.com/librespot-org/librespot.git
synced 2024-12-18 17:11:53 +00:00
Merge pull request #929 from jforberg/playlist_tracks
Add error message for bad ID
This commit is contained in:
commit
55ced49c2d
1 changed files with 8 additions and 5 deletions
|
@ -1,4 +1,5 @@
|
||||||
use std::env;
|
use std::env;
|
||||||
|
use std::process;
|
||||||
|
|
||||||
use librespot::core::authentication::Credentials;
|
use librespot::core::authentication::Credentials;
|
||||||
use librespot::core::config::SessionConfig;
|
use librespot::core::config::SessionConfig;
|
||||||
|
@ -18,11 +19,13 @@ async fn main() {
|
||||||
}
|
}
|
||||||
let credentials = Credentials::with_password(&args[1], &args[2]);
|
let credentials = Credentials::with_password(&args[1], &args[2]);
|
||||||
|
|
||||||
let uri_split = args[3].split(':');
|
let plist_uri = SpotifyId::from_uri(&args[3]).unwrap_or_else(|_| {
|
||||||
let uri_parts: Vec<&str> = uri_split.collect();
|
eprintln!(
|
||||||
println!("{}, {}, {}", uri_parts[0], uri_parts[1], uri_parts[2]);
|
"PLAYLIST should be a playlist URI such as: \
|
||||||
|
\"spotify:playlist:37i9dQZF1DXec50AjHrNTq\""
|
||||||
let plist_uri = SpotifyId::from_base62(uri_parts[2]).unwrap();
|
);
|
||||||
|
process::exit(1);
|
||||||
|
});
|
||||||
|
|
||||||
let session = Session::connect(session_config, credentials, None)
|
let session = Session::connect(session_config, credentials, None)
|
||||||
.await
|
.await
|
||||||
|
|
Loading…
Reference in a new issue