-2

How to get the top tracks and new release album information from web api or libspotify? I tried SPToplist in libspotify but it wasn't working for me.

the
  • 21,007
  • 11
  • 68
  • 101

1 Answers1

0

Top tracks

Look at the spshell example provided with libspotify. The toplist.c file has the toplist-specific parts, while spshell.c, spshell_win32.c and spshell_posix.c have the basic event-loop code that you'll need to use libspotify at all. At a minimum you're going to need to:

  1. Create a session. (For which you'll need an app key.)
  2. Log in.
  3. Run an event loop on your main thread to call sp_session_process_events as needed.
  4. Handle the notify_main_thread callback and use it to wake up your event loop so that it calls sp_session_process_events.
  5. Call sp_toplist_browse_create to request a toplist, passing it a callback to invoke when the toplist is ready.
  6. In your callback, you can access the results.

New releases

I think for this you want to do a search for "tag:new". Have a look at search.c in the spshell example. Searching works similarly to browsing toplists.

Weeble
  • 17,058
  • 3
  • 60
  • 75