title: libspotify: how to find out if a track uri is correct and playable?
body: <p>The question sounds very simple but I couldn't find a way to check if a track uri is correct.</p>
  
  <p>For example, the normal procedure to play a track by a given valid track uri <strong>spotify:track:5Z7ygHQo02SUrFmcgpwsKW</strong> is:</p>
  
  <p>1) get sp_link* by sp_link_create_from_string(const char *$track_uri)</p>
  
  <p>2) get sp_track* by sp_link_as_track(sp_link*)</p>
  
  <p>3) sp_track_add_ref(sp_track*)</p>
  
  <p>4) if sp_track_error() returns SP_ERROR_OK, or SP_ERROR_IS_LOADING but metadata_updated and SP_ERROR_OK then sp_session_player_load and sp_session_player_play to load and play the track.</p>
  
  <p>5) sp_track_release() and sp_session_player_unload() when it's the end of track.</p>
  
  <p>Now if user made a typo on the spotify track uri and tried to play <strong>spotify:track:5Z7ygHQo02SUrFmcgpwsKQ</strong> (the last character <strong>Q</strong> is a typo, should be <strong>W</strong>). All the possible error checks during the procedure don't return any error: </p>
  
  <p>step 1) sp_link is not NULL</p>
  
  <p>step 2) sp_track* is not NULL</p>
  
  <p>step 3) returns SP_ERROR_OK</p>
  
  <p>step 4) sp_track_error() returns SP_ERROR_IS_LOADING, metadata_updated never gets called, and of course the program hangs.</p>
  
  <p>The checks before the track is loaded can't find out the invalidity of a track uri. The API <strong>sp_track_availability</strong> sounds like a way, but it will always return NOT AVAILABLE if the track is not loaded, but if the track uri is not correct, track will never be loaded.</p>
  
  <p>Did I miss something or misunderstand the APIs?</p>