message: get_token processing can be done in two parts
diff: @@ -63,27 +63,33 @@ pub fn convert_str_to_map(query_str: &mut str) -> HashMap<&str, &str> {
  map
  }
  -/// get tokenInfo by Authorization
  -pub fn get_token(spotify_oauth: &mut SpotifyOAuth) -> Option<TokenInfo> {
  - error!("debug message");
  - match spotify_oauth.get_cached_token() {
  - Some(token_info) => Some(token_info),
  - None => {
  +pub fn request_token(spotify_oauth: &mut SpotifyOAuth) {
  let state = generate_random_string(16);
  let auth_url = spotify_oauth.get_authorize_url(Some(&state), None);
  match webbrowser::open(&auth_url) {
  Ok(_) => println!("Opened {} in your browser", auth_url),
  Err(why) => eprintln!("Error {:?};Please navigate here [{:?}] ", why, auth_url),
  }
  - println!("Enter the URL you were redirected to: ");
  - let mut input = String::new();
  - match io::stdin().read_line(&mut input) {
  - Ok(_) => {
  - match spotify_oauth.parse_response_code(&mut input) {
  +}
  +
  +pub fn process_token(spotify_oauth: &mut SpotifyOAuth, input: &mut String) -> Option<TokenInfo> {
  + match spotify_oauth.parse_response_code(input) {
  Some(code) => spotify_oauth.get_access_token(&code),
  None => None,
  }
  }
  +
  +/// get tokenInfo by Authorization
  +pub fn get_token(spotify_oauth: &mut SpotifyOAuth) -> Option<TokenInfo> {
  + error!("debug message");
  + match spotify_oauth.get_cached_token() {
  + Some(token_info) => Some(token_info),
  + None => {
  + request_token(spotify_oauth);
  + println!("Enter the URL you were redirected to: ");
  + let mut input = String::new();
  + match io::stdin().read_line(&mut input) {
  + Ok(_) => process_token(spotify_oauth, &mut input),
  Err(_) => None,
  }
  }
  