From 665c76de005c2088bd5c1c7045115b527da97e0b Mon Sep 17 00:00:00 2001 From: chme Date: Sat, 7 Mar 2015 19:31:24 +0100 Subject: [PATCH] [spotify] Add "sp_session_starred_create" api method and load the "starred" playlist on login --- src/spotify.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/spotify.c b/src/spotify.c index 1b9e92f8..7e79f3e2 100644 --- a/src/spotify.c +++ b/src/spotify.c @@ -184,6 +184,7 @@ typedef sp_error (*fptr_sp_session_login_t)(sp_session *session, const char typedef sp_error (*fptr_sp_session_relogin_t)(sp_session *session); typedef sp_error (*fptr_sp_session_logout_t)(sp_session *session); typedef sp_error (*fptr_sp_session_process_events_t)(sp_session *session, int *next_timeout); +typedef sp_playlist* (*fptr_sp_session_starred_create_t)(sp_session *session); typedef sp_playlistcontainer* (*fptr_sp_session_playlistcontainer_t)(sp_session *session); typedef sp_error (*fptr_sp_session_player_load_t)(sp_session *session, sp_track *track); typedef sp_error (*fptr_sp_session_player_unload_t)(sp_session *session); @@ -242,6 +243,7 @@ fptr_sp_session_release_t fptr_sp_session_release; fptr_sp_session_login_t fptr_sp_session_login; fptr_sp_session_relogin_t fptr_sp_session_relogin; fptr_sp_session_logout_t fptr_sp_session_logout; +fptr_sp_session_starred_create_t fptr_sp_session_starred_create; fptr_sp_session_playlistcontainer_t fptr_sp_session_playlistcontainer; fptr_sp_session_process_events_t fptr_sp_session_process_events; fptr_sp_session_player_load_t fptr_sp_session_player_load; @@ -320,6 +322,7 @@ fptr_assign_all() && (fptr_sp_session_preferred_bitrate = dlsym(h, "sp_session_preferred_bitrate")) && (fptr_sp_playlistcontainer_add_callbacks = dlsym(h, "sp_playlistcontainer_add_callbacks")) && (fptr_sp_playlistcontainer_num_playlists = dlsym(h, "sp_playlistcontainer_num_playlists")) + && (fptr_sp_session_starred_create = dlsym(h, "sp_session_starred_create")) && (fptr_sp_playlistcontainer_playlist = dlsym(h, "sp_playlistcontainer_playlist")) && (fptr_sp_playlist_add_callbacks = dlsym(h, "sp_playlist_add_callbacks")) && (fptr_sp_playlist_name = dlsym(h, "sp_playlist_name")) @@ -1179,6 +1182,9 @@ logged_in(sp_session *sess, sp_error error) db_spotify_purge(); + pl = fptr_sp_session_starred_create(sess); + fptr_sp_playlist_add_callbacks(pl, &pl_callbacks, NULL); + pc = fptr_sp_session_playlistcontainer(sess); fptr_sp_playlistcontainer_add_callbacks(pc, &pc_callbacks, NULL);