spotify 8.0.2 → 8.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -12,10 +12,49 @@ module Spotify
12
12
  extend FFI::Library
13
13
  ffi_lib ['libspotify', '/Library/Frameworks/libspotify.framework/libspotify']
14
14
 
15
+ # Data converter for boolean struct fields.
16
+ #
17
+ # @see https://github.com/ffi/ffi/issues/114
18
+ module Bool
19
+ extend FFI::DataConverter
20
+ native_type FFI::Type::UCHAR
21
+
22
+ class << self
23
+ def to_native(value, ctx)
24
+ value == true ? 1 : 0
25
+ end
26
+
27
+ def from_native(value, ctx)
28
+ (value & 1) != 0
29
+ end
30
+ end
31
+ end
32
+
15
33
  # libspotify API version
16
34
  # @return [Fixnum]
17
35
  API_VERSION = VERSION.split('.').first.to_i
18
36
 
37
+ # Aliases to Spotify types
38
+ typedef :pointer, :frames
39
+ typedef :pointer, :session
40
+ typedef :pointer, :track
41
+ typedef :pointer, :user
42
+ typedef :pointer, :playlistcontainer
43
+ typedef :pointer, :playlist
44
+ typedef :pointer, :link
45
+ typedef :pointer, :album
46
+ typedef :pointer, :artist
47
+ typedef :pointer, :search
48
+ typedef :pointer, :image
49
+ typedef :pointer, :albumbrowse
50
+ typedef :pointer, :artistbrowse
51
+ typedef :pointer, :toplistbrowse
52
+ typedef :pointer, :inbox
53
+
54
+ typedef :pointer, :userdata
55
+ typedef :pointer, :image_id
56
+ typedef :pointer, :array
57
+
19
58
  #
20
59
  # Error
21
60
  #
@@ -33,6 +72,12 @@ module Spotify
33
72
  :permission_denied, :inbox_is_full, :no_cache,
34
73
  :no_such_user]
35
74
 
75
+ # @macro [attach] attach_function
76
+ #
77
+ # Calls +$2+. See source for actual parameters.
78
+ #
79
+ # @method $1($3)
80
+ # @return [$4]
36
81
  attach_function :error_message, :sp_error_message, [ :error ], :string
37
82
 
38
83
  #
@@ -69,87 +114,41 @@ module Spotify
69
114
  #
70
115
  # @see http://developer.spotify.com/en/libspotify/docs/group__session.html
71
116
 
72
- #
73
- enum :connectionstate, [:logged_out, :logged_in, :disconnected, :undefined]
74
-
75
- #
76
- enum :connection_type, [:unknown, :none, :mobile, :mobile_roaming, :wifi, :wired]
77
-
78
- #
79
- enum :connection_rules, [:network , 0x1,
80
- :network_if_roaming , 0x2,
81
- :allow_sync_over_mobile, 0x4,
82
- :allow_sync_over_wifi , 0x8]
83
-
84
- attach_function :session_create, :sp_session_create, [ :pointer, :pointer ], :error, :blocking => true
85
- attach_function :session_release, :sp_session_release, [ :pointer ], :void
86
-
87
- attach_function :session_process_events, :sp_session_process_events, [ :pointer, :pointer ], :void, :blocking => true
88
- attach_function :session_login, :sp_session_login, [ :pointer, :string, :string ], :void, :blocking => true
89
-
90
- attach_function :session_user, :sp_session_user, [ :pointer ], :pointer
91
- attach_function :session_logout, :sp_session_logout, [ :pointer ], :void
92
- attach_function :session_connectionstate, :sp_session_connectionstate, [ :pointer ], :connectionstate
93
- attach_function :session_userdata, :sp_session_userdata, [ :pointer ], :pointer
94
- attach_function :session_set_cache_size, :sp_session_set_cache_size, [ :pointer, :size_t ], :void
95
- attach_function :session_player_load, :sp_session_player_load, [ :pointer, :pointer ], :error
96
- attach_function :session_player_seek, :sp_session_player_seek, [ :pointer, :int ], :void
97
- attach_function :session_player_play, :sp_session_player_play, [ :pointer, :bool ], :void
98
- attach_function :session_player_unload, :sp_session_player_unload, [ :pointer ], :void
99
- attach_function :session_player_prefetch, :sp_session_player_prefetch, [ :pointer, :pointer ], :error
100
- attach_function :session_playlistcontainer, :sp_session_playlistcontainer, [ :pointer ], :pointer
101
- attach_function :session_inbox_create, :sp_session_inbox_create, [ :pointer ], :pointer
102
- attach_function :session_starred_create, :sp_session_starred_create, [ :pointer ], :pointer
103
- attach_function :session_starred_for_user_create, :sp_session_starred_for_user_create, [ :pointer, :string ], :pointer
104
- attach_function :session_publishedcontainer_for_user_create, :sp_session_publishedcontainer_for_user_create, [ :pointer, :string ], :pointer
105
- attach_function :session_preferred_bitrate, :sp_session_preferred_bitrate, [ :pointer, :bitrate ], :void
106
- attach_function :session_num_friends, :sp_session_num_friends, [ :pointer ], :int
107
- attach_function :session_friend, :sp_session_friend, [ :pointer, :int ], :pointer
108
-
109
- attach_function :session_set_connection_type, :sp_session_set_connection_type, [ :pointer, :pointer ], :void
110
- attach_function :session_set_connection_rules, :sp_session_set_connection_rules, [ :pointer, :pointer ], :void
111
- attach_function :offline_tracks_to_sync, :sp_offline_tracks_to_sync, [ :pointer ], :int
112
- attach_function :offline_num_playlists, :sp_offline_num_playlists, [ :pointer ], :int
113
- attach_function :offline_sync_get_status, :sp_offline_sync_get_status, [ :pointer, :pointer ], :void
114
- attach_function :session_user_country, :sp_session_user_country, [ :pointer ], :int
115
- attach_function :session_preferred_offline_bitrate, :sp_session_preferred_offline_bitrate, [ :pointer, :bitrate, :bool ], :void
116
-
117
-
118
117
  # FFI::Struct for Session callbacks.
119
118
  #
120
- # @attr [callback(:pointer, :error):void] logged_in
121
- # @attr [callback(:pointer):void] logged_out
122
- # @attr [callback(:pointer):void] metadata_updated
123
- # @attr [callback(:pointer, :error):void] connection_error
124
- # @attr [callback(:pointer, :string):void] message_to_user
125
- # @attr [callback(:pointer):void] notify_main_thread
126
- # @attr [callback(:pointer, :pointer, :pointer, :int):int] music_delivery
127
- # @attr [callback(:pointer):void] play_token_lost
128
- # @attr [callback(:pointer, :string):void] log_message
129
- # @attr [callback(:pointer):void] end_of_track
130
- # @attr [callback(:pointer, :error):void] streaming_error
131
- # @attr [callback(:pointer):void] userinfo_updated
132
- # @attr [callback(:pointer):void] start_playback
133
- # @attr [callback(:pointer):void] stop_playback
134
- # @attr [callback(:pointer, :pointer):void] get_audio_buffer_stats
135
- # @attr [callback(:pointer)::void] offline_status_updated
119
+ # @attr [callback(:session, :error):void] logged_in
120
+ # @attr [callback(:session):void] logged_out
121
+ # @attr [callback(:session):void] metadata_updated
122
+ # @attr [callback(:session, :error):void] connection_error
123
+ # @attr [callback(:session, :string):void] message_to_user
124
+ # @attr [callback(:session):void] notify_main_thread
125
+ # @attr [callback(:session, AudioFormat, :frames, :int):int] music_delivery
126
+ # @attr [callback(:session):void] play_token_lost
127
+ # @attr [callback(:session, :string):void] log_message
128
+ # @attr [callback(:session):void] end_of_track
129
+ # @attr [callback(:session, :error):void] streaming_error
130
+ # @attr [callback(:session):void] userinfo_updated
131
+ # @attr [callback(:session):void] start_playback
132
+ # @attr [callback(:session):void] stop_playback
133
+ # @attr [callback(:session, AudioBufferStats):void] get_audio_buffer_stats
134
+ # @attr [callback(:session)::void] offline_status_updated
136
135
  class SessionCallbacks < FFI::Struct
137
- layout :logged_in, callback([ :pointer, :error ], :void),
138
- :logged_out, callback([ :pointer ], :void),
139
- :metadata_updated, callback([ :pointer ], :void),
140
- :connection_error, callback([ :pointer, :error ], :void),
141
- :message_to_user, callback([ :pointer, :string ], :void),
142
- :notify_main_thread, callback([ :pointer ], :void),
143
- :music_delivery, callback([ :pointer, :pointer, :pointer, :int ], :int),
144
- :play_token_lost, callback([ :pointer ], :void),
145
- :log_message, callback([ :pointer, :string ], :void),
146
- :end_of_track, callback([ :pointer ], :void),
147
- :streaming_error, callback([ :pointer, :error ], :void),
148
- :userinfo_updated, callback([ :pointer ], :void),
149
- :start_playback, callback([ :pointer ], :void),
150
- :stop_playback, callback([ :pointer ], :void),
151
- :get_audio_buffer_stats, callback([ :pointer, :pointer ], :void),
152
- :offline_status_updated, callback([ :pointer ], :void)
136
+ layout :logged_in, callback([ :session, :error ], :void),
137
+ :logged_out, callback([ :session ], :void),
138
+ :metadata_updated, callback([ :session ], :void),
139
+ :connection_error, callback([ :session, :error ], :void),
140
+ :message_to_user, callback([ :session, :string ], :void),
141
+ :notify_main_thread, callback([ :session ], :void),
142
+ :music_delivery, callback([ :session, AudioFormat, :frames, :int ], :int),
143
+ :play_token_lost, callback([ :session ], :void),
144
+ :log_message, callback([ :session, :string ], :void),
145
+ :end_of_track, callback([ :session ], :void),
146
+ :streaming_error, callback([ :session, :error ], :void),
147
+ :userinfo_updated, callback([ :session ], :void),
148
+ :start_playback, callback([ :session ], :void),
149
+ :stop_playback, callback([ :session ], :void),
150
+ :get_audio_buffer_stats, callback([ :session, AudioBufferStats ], :void),
151
+ :offline_status_updated, callback([ :session ], :void)
153
152
  end
154
153
 
155
154
  # FFI::Struct for Session configuration.
@@ -170,15 +169,15 @@ module Spotify
170
169
  :application_key, :pointer,
171
170
  :application_key_size, :size_t,
172
171
  :user_agent, :pointer,
173
- :callbacks, :pointer,
174
- :userdata, :pointer,
175
- :compress_playlists, :int,
176
- :dont_save_metadata_for_playlists, :int,
177
- :initially_unload_playlists, :int
172
+ :callbacks, SessionCallbacks.by_ref,
173
+ :userdata, :userdata,
174
+ :compress_playlists, Bool,
175
+ :dont_save_metadata_for_playlists, Bool,
176
+ :initially_unload_playlists, Bool
178
177
  end
179
-
178
+
180
179
  # FFI::Struct for Offline Sync Status
181
- #
180
+ #
182
181
  # @attr [Fixnum] queued_tracks
183
182
  # @attr [Fixnum] queued_bytes
184
183
  # @attr [Fixnum] done_tracks
@@ -197,9 +196,54 @@ module Spotify
197
196
  :copied_bytes, :uint64,
198
197
  :willnotcopy_tracks, :int,
199
198
  :error_tracks, :int,
200
- :syncing, :int
199
+ :syncing, Bool
201
200
  end
202
201
 
202
+ #
203
+ enum :connectionstate, [:logged_out, :logged_in, :disconnected, :undefined]
204
+
205
+ #
206
+ enum :connection_type, [:unknown, :none, :mobile, :mobile_roaming, :wifi, :wired]
207
+
208
+ #
209
+ enum :connection_rules, [:network , 0x1,
210
+ :network_if_roaming , 0x2,
211
+ :allow_sync_over_mobile, 0x4,
212
+ :allow_sync_over_wifi , 0x8]
213
+
214
+ attach_function :session_create, :sp_session_create, [ SessionConfig, :buffer_out ], :error, :blocking => true
215
+ attach_function :session_release, :sp_session_release, [ :session ], :void
216
+
217
+ attach_function :session_process_events, :sp_session_process_events, [ :session, :buffer_out ], :void, :blocking => true
218
+ attach_function :session_login, :sp_session_login, [ :session, :string, :string ], :void, :blocking => true
219
+
220
+ attach_function :session_user, :sp_session_user, [ :session ], :user
221
+ attach_function :session_logout, :sp_session_logout, [ :session ], :void
222
+ attach_function :session_connectionstate, :sp_session_connectionstate, [ :session ], :connectionstate
223
+ attach_function :session_userdata, :sp_session_userdata, [ :session ], :userdata
224
+ attach_function :session_set_cache_size, :sp_session_set_cache_size, [ :session, :size_t ], :void
225
+ attach_function :session_player_load, :sp_session_player_load, [ :session, :track ], :error
226
+ attach_function :session_player_seek, :sp_session_player_seek, [ :session, :int ], :void
227
+ attach_function :session_player_play, :sp_session_player_play, [ :session, :bool ], :void
228
+ attach_function :session_player_unload, :sp_session_player_unload, [ :session ], :void
229
+ attach_function :session_player_prefetch, :sp_session_player_prefetch, [ :session, :track ], :error
230
+ attach_function :session_playlistcontainer, :sp_session_playlistcontainer, [ :session ], :playlistcontainer
231
+ attach_function :session_inbox_create, :sp_session_inbox_create, [ :session ], :playlist
232
+ attach_function :session_starred_create, :sp_session_starred_create, [ :session ], :playlist
233
+ attach_function :session_starred_for_user_create, :sp_session_starred_for_user_create, [ :session, :string ], :playlist
234
+ attach_function :session_publishedcontainer_for_user_create, :sp_session_publishedcontainer_for_user_create, [ :playlist, :string ], :playlistcontainer
235
+ attach_function :session_preferred_bitrate, :sp_session_preferred_bitrate, [ :session, :bitrate ], :void
236
+ attach_function :session_num_friends, :sp_session_num_friends, [ :session ], :int
237
+ attach_function :session_friend, :sp_session_friend, [ :session, :int ], :user
238
+
239
+ attach_function :session_set_connection_type, :sp_session_set_connection_type, [ :session, :connection_type ], :void
240
+ attach_function :session_set_connection_rules, :sp_session_set_connection_rules, [ :session, :connection_rules ], :void
241
+ attach_function :offline_tracks_to_sync, :sp_offline_tracks_to_sync, [ :session ], :int
242
+ attach_function :offline_num_playlists, :sp_offline_num_playlists, [ :session ], :int
243
+ attach_function :offline_sync_get_status, :sp_offline_sync_get_status, [ :session, OfflineSyncStatus ], :void
244
+ attach_function :session_user_country, :sp_session_user_country, [ :session ], :int
245
+ attach_function :session_preferred_offline_bitrate, :sp_session_preferred_offline_bitrate, [ :session, :bitrate, :bool ], :void
246
+
203
247
  #
204
248
  # Link
205
249
  #
@@ -209,26 +253,26 @@ module Spotify
209
253
  enum :linktype, [:invalid, :track, :album, :artist, :search,
210
254
  :playlist, :profile, :starred, :localtrack, :image]
211
255
 
212
- attach_function :link_create_from_string, :sp_link_create_from_string, [ :string ], :pointer
213
- attach_function :link_create_from_track, :sp_link_create_from_track, [ :pointer, :int ], :pointer
214
- attach_function :link_create_from_album, :sp_link_create_from_album, [ :pointer ], :pointer
215
- attach_function :link_create_from_artist, :sp_link_create_from_artist, [ :pointer ], :pointer
216
- attach_function :link_create_from_search, :sp_link_create_from_search, [ :pointer ], :pointer
217
- attach_function :link_create_from_playlist, :sp_link_create_from_playlist, [ :pointer ], :pointer
218
- attach_function :link_create_from_artist_portrait, :sp_link_create_from_artist_portrait, [ :pointer, :int ], :pointer
219
- attach_function :link_create_from_album_cover, :sp_link_create_from_album_cover, [ :pointer ], :pointer
220
- attach_function :link_create_from_image, :sp_link_create_from_image, [ :pointer ], :pointer
221
- attach_function :link_create_from_user, :sp_link_create_from_user, [ :pointer ], :pointer
222
- attach_function :link_as_string, :sp_link_as_string, [ :pointer, :buffer_out, :int ], :int
223
- attach_function :link_type, :sp_link_type, [ :pointer ], :linktype
224
- attach_function :link_as_track, :sp_link_as_track, [ :pointer ], :pointer
225
- attach_function :link_as_track_and_offset, :sp_link_as_track_and_offset, [ :pointer, :pointer ], :pointer
226
- attach_function :link_as_album, :sp_link_as_album, [ :pointer ], :pointer
227
- attach_function :link_as_artist, :sp_link_as_artist, [ :pointer ], :pointer
228
- attach_function :link_as_user, :sp_link_as_user, [ :pointer ], :pointer
229
-
230
- attach_function :link_add_ref, :sp_link_add_ref, [ :pointer ], :void
231
- attach_function :link_release, :sp_link_release, [ :pointer ], :void
256
+ attach_function :link_create_from_string, :sp_link_create_from_string, [ :string ], :link
257
+ attach_function :link_create_from_track, :sp_link_create_from_track, [ :track, :int ], :link
258
+ attach_function :link_create_from_album, :sp_link_create_from_album, [ :album ], :link
259
+ attach_function :link_create_from_artist, :sp_link_create_from_artist, [ :artist ], :link
260
+ attach_function :link_create_from_search, :sp_link_create_from_search, [ :search ], :link
261
+ attach_function :link_create_from_playlist, :sp_link_create_from_playlist, [ :playlist ], :link
262
+ attach_function :link_create_from_artist_portrait, :sp_link_create_from_artist_portrait, [ :artist, :int ], :link
263
+ attach_function :link_create_from_album_cover, :sp_link_create_from_album_cover, [ :album ], :link
264
+ attach_function :link_create_from_image, :sp_link_create_from_image, [ :image ], :link
265
+ attach_function :link_create_from_user, :sp_link_create_from_user, [ :user ], :link
266
+ attach_function :link_as_string, :sp_link_as_string, [ :link, :buffer_out, :int ], :int
267
+ attach_function :link_type, :sp_link_type, [ :link ], :linktype
268
+ attach_function :link_as_track, :sp_link_as_track, [ :link ], :track
269
+ attach_function :link_as_track_and_offset, :sp_link_as_track_and_offset, [ :link, :buffer_out ], :track
270
+ attach_function :link_as_album, :sp_link_as_album, [ :link ], :album
271
+ attach_function :link_as_artist, :sp_link_as_artist, [ :link ], :artist
272
+ attach_function :link_as_user, :sp_link_as_user, [ :link ], :user
273
+
274
+ attach_function :link_add_ref, :sp_link_add_ref, [ :link ], :void
275
+ attach_function :link_release, :sp_link_release, [ :link ], :void
232
276
 
233
277
  #
234
278
  # Tracks
@@ -236,25 +280,25 @@ module Spotify
236
280
  # @see http://developer.spotify.com/en/libspotify/docs/group__track.html
237
281
 
238
282
  #
239
- attach_function :track_is_loaded, :sp_track_is_loaded, [ :pointer ], :bool
240
- attach_function :track_error, :sp_track_error, [ :pointer ], :error
241
- attach_function :track_is_available, :sp_track_is_available, [ :pointer, :pointer ], :bool
242
- attach_function :track_is_local, :sp_track_is_local, [ :pointer, :pointer ], :bool
243
- attach_function :track_is_autolinked, :sp_track_is_autolinked, [ :pointer, :pointer ], :bool
244
- attach_function :track_is_starred, :sp_track_is_starred, [ :pointer, :pointer ], :bool
245
- attach_function :track_set_starred, :sp_track_set_starred, [ :pointer, :pointer, :int, :bool ], :void
246
- attach_function :track_num_artists, :sp_track_num_artists, [ :pointer ], :int
247
- attach_function :track_artist, :sp_track_artist, [ :pointer, :int ], :pointer
248
- attach_function :track_album, :sp_track_album, [ :pointer ], :pointer
249
- attach_function :track_name, :sp_track_name, [ :pointer ], :string
250
- attach_function :track_duration, :sp_track_duration, [ :pointer ], :int
251
- attach_function :track_popularity, :sp_track_popularity, [ :pointer ], :int
252
- attach_function :track_disc, :sp_track_disc, [ :pointer ], :int
253
- attach_function :track_index, :sp_track_index, [ :pointer ], :int
254
- attach_function :localtrack_create, :sp_localtrack_create, [ :string, :string, :string, :int ], :pointer
255
-
256
- attach_function :track_add_ref, :sp_track_add_ref, [ :pointer ], :void
257
- attach_function :track_release, :sp_track_release, [ :pointer ], :void
283
+ attach_function :track_is_loaded, :sp_track_is_loaded, [ :track ], :bool
284
+ attach_function :track_error, :sp_track_error, [ :track ], :error
285
+ attach_function :track_is_available, :sp_track_is_available, [ :session, :track ], :bool
286
+ attach_function :track_is_local, :sp_track_is_local, [ :session, :track ], :bool
287
+ attach_function :track_is_autolinked, :sp_track_is_autolinked, [ :session, :track ], :bool
288
+ attach_function :track_is_starred, :sp_track_is_starred, [ :session, :track ], :bool
289
+ attach_function :track_set_starred, :sp_track_set_starred, [ :session, :array, :int, :bool ], :void
290
+ attach_function :track_num_artists, :sp_track_num_artists, [ :track ], :int
291
+ attach_function :track_artist, :sp_track_artist, [ :track, :int ], :artist
292
+ attach_function :track_album, :sp_track_album, [ :track ], :album
293
+ attach_function :track_name, :sp_track_name, [ :track ], :string
294
+ attach_function :track_duration, :sp_track_duration, [ :track ], :int
295
+ attach_function :track_popularity, :sp_track_popularity, [ :track ], :int
296
+ attach_function :track_disc, :sp_track_disc, [ :track ], :int
297
+ attach_function :track_index, :sp_track_index, [ :track ], :int
298
+ attach_function :localtrack_create, :sp_localtrack_create, [ :string, :string, :string, :int ], :track
299
+
300
+ attach_function :track_add_ref, :sp_track_add_ref, [ :track ], :void
301
+ attach_function :track_release, :sp_track_release, [ :track ], :void
258
302
 
259
303
  #
260
304
  # Albums
@@ -264,16 +308,16 @@ module Spotify
264
308
  #
265
309
  enum :albumtype, [:album, :single, :compilation, :unknown]
266
310
 
267
- attach_function :album_is_loaded, :sp_album_is_loaded, [ :pointer ], :bool
268
- attach_function :album_is_available, :sp_album_is_available, [ :pointer ], :bool
269
- attach_function :album_artist, :sp_album_artist, [ :pointer ], :pointer
270
- attach_function :album_cover, :sp_album_cover, [ :pointer ], :pointer
271
- attach_function :album_name, :sp_album_name, [ :pointer ], :string
272
- attach_function :album_year, :sp_album_year, [ :pointer ], :int
273
- attach_function :album_type, :sp_album_type, [ :pointer ], :albumtype
274
-
275
- attach_function :album_add_ref, :sp_album_add_ref, [ :pointer ], :void
276
- attach_function :album_release, :sp_album_release, [ :pointer ], :void
311
+ attach_function :album_is_loaded, :sp_album_is_loaded, [ :album ], :bool
312
+ attach_function :album_is_available, :sp_album_is_available, [ :album ], :bool
313
+ attach_function :album_artist, :sp_album_artist, [ :album ], :artist
314
+ attach_function :album_cover, :sp_album_cover, [ :album ], :image_id
315
+ attach_function :album_name, :sp_album_name, [ :album ], :string
316
+ attach_function :album_year, :sp_album_year, [ :album ], :int
317
+ attach_function :album_type, :sp_album_type, [ :album ], :albumtype
318
+
319
+ attach_function :album_add_ref, :sp_album_add_ref, [ :album ], :void
320
+ attach_function :album_release, :sp_album_release, [ :album ], :void
277
321
 
278
322
  #
279
323
  # Album Browser
@@ -281,19 +325,20 @@ module Spotify
281
325
  # @see http://developer.spotify.com/en/libspotify/docs/group__albumbrowse.html
282
326
 
283
327
  #
284
- attach_function :albumbrowse_create, :sp_albumbrowse_create, [ :pointer, :pointer, callback([:pointer, :pointer], :void), :pointer ], :pointer
285
- attach_function :albumbrowse_is_loaded, :sp_albumbrowse_is_loaded, [ :pointer ], :bool
286
- attach_function :albumbrowse_error, :sp_albumbrowse_error, [ :pointer ], :error
287
- attach_function :albumbrowse_album, :sp_albumbrowse_album, [ :pointer ], :pointer
288
- attach_function :albumbrowse_artist, :sp_albumbrowse_artist, [ :pointer ], :pointer
289
- attach_function :albumbrowse_num_copyrights, :sp_albumbrowse_num_copyrights, [ :pointer ], :int
290
- attach_function :albumbrowse_copyright, :sp_albumbrowse_copyright, [ :pointer, :int ], :string
291
- attach_function :albumbrowse_num_tracks, :sp_albumbrowse_num_tracks, [ :pointer ], :int
292
- attach_function :albumbrowse_track, :sp_albumbrowse_track, [ :pointer, :int ], :pointer
293
- attach_function :albumbrowse_review, :sp_albumbrowse_review, [ :pointer ], :string
294
-
295
- attach_function :albumbrowse_add_ref, :sp_albumbrowse_add_ref, [ :pointer ], :void
296
- attach_function :albumbrowse_release, :sp_albumbrowse_release, [ :pointer ], :void
328
+ callback :albumbrowse_complete_cb, [:albumbrowse, :userdata], :void
329
+ attach_function :albumbrowse_create, :sp_albumbrowse_create, [ :session, :album, :albumbrowse_complete_cb, :userdata ], :albumbrowse
330
+ attach_function :albumbrowse_is_loaded, :sp_albumbrowse_is_loaded, [ :albumbrowse ], :bool
331
+ attach_function :albumbrowse_error, :sp_albumbrowse_error, [ :albumbrowse ], :error
332
+ attach_function :albumbrowse_album, :sp_albumbrowse_album, [ :albumbrowse ], :album
333
+ attach_function :albumbrowse_artist, :sp_albumbrowse_artist, [ :albumbrowse ], :artist
334
+ attach_function :albumbrowse_num_copyrights, :sp_albumbrowse_num_copyrights, [ :albumbrowse ], :int
335
+ attach_function :albumbrowse_copyright, :sp_albumbrowse_copyright, [ :albumbrowse, :int ], :string
336
+ attach_function :albumbrowse_num_tracks, :sp_albumbrowse_num_tracks, [ :albumbrowse ], :int
337
+ attach_function :albumbrowse_track, :sp_albumbrowse_track, [ :albumbrowse, :int ], :track
338
+ attach_function :albumbrowse_review, :sp_albumbrowse_review, [ :albumbrowse ], :string
339
+
340
+ attach_function :albumbrowse_add_ref, :sp_albumbrowse_add_ref, [ :albumbrowse ], :void
341
+ attach_function :albumbrowse_release, :sp_albumbrowse_release, [ :albumbrowse ], :void
297
342
 
298
343
  #
299
344
  # Artists
@@ -301,11 +346,11 @@ module Spotify
301
346
  # @see http://developer.spotify.com/en/libspotify/docs/group__artist.html
302
347
 
303
348
  #
304
- attach_function :artist_name, :sp_artist_name, [ :pointer ], :string
305
- attach_function :artist_is_loaded, :sp_artist_is_loaded, [ :pointer ], :bool
306
-
307
- attach_function :artist_add_ref, :sp_artist_add_ref, [ :pointer ], :void
308
- attach_function :artist_release, :sp_artist_release, [ :pointer ], :void
349
+ attach_function :artist_name, :sp_artist_name, [ :artist ], :string
350
+ attach_function :artist_is_loaded, :sp_artist_is_loaded, [ :artist ], :bool
351
+
352
+ attach_function :artist_add_ref, :sp_artist_add_ref, [ :artist ], :void
353
+ attach_function :artist_release, :sp_artist_release, [ :artist ], :void
309
354
 
310
355
  #
311
356
  # Artist Browsing
@@ -313,22 +358,23 @@ module Spotify
313
358
  # @see http://developer.spotify.com/en/libspotify/docs/group__artistbrowse.html
314
359
 
315
360
  #
316
- attach_function :artistbrowse_create, :sp_artistbrowse_create, [ :pointer, :pointer, callback([:pointer, :pointer], :void), :pointer ], :pointer
317
- attach_function :artistbrowse_is_loaded, :sp_artistbrowse_is_loaded, [ :pointer ], :bool
318
- attach_function :artistbrowse_error, :sp_artistbrowse_error, [ :pointer ], :error
319
- attach_function :artistbrowse_artist, :sp_artistbrowse_artist, [ :pointer ], :pointer
320
- attach_function :artistbrowse_num_portraits, :sp_artistbrowse_num_portraits, [ :pointer ], :int
321
- attach_function :artistbrowse_portrait, :sp_artistbrowse_portrait, [ :pointer, :int ], :pointer
322
- attach_function :artistbrowse_num_tracks, :sp_artistbrowse_num_tracks, [ :pointer ], :int
323
- attach_function :artistbrowse_track, :sp_artistbrowse_track, [ :pointer, :int ], :pointer
324
- attach_function :artistbrowse_num_albums, :sp_artistbrowse_num_albums, [ :pointer ], :int
325
- attach_function :artistbrowse_album, :sp_artistbrowse_album, [ :pointer, :int ], :pointer
326
- attach_function :artistbrowse_num_similar_artists, :sp_artistbrowse_num_similar_artists, [ :pointer ], :int
327
- attach_function :artistbrowse_similar_artist, :sp_artistbrowse_similar_artist, [ :pointer, :int ], :pointer
328
- attach_function :artistbrowse_biography, :sp_artistbrowse_biography, [ :pointer ], :string
329
-
330
- attach_function :artistbrowse_add_ref, :sp_artistbrowse_add_ref, [ :pointer ], :void
331
- attach_function :artistbrowse_release, :sp_artistbrowse_release, [ :pointer ], :void
361
+ callback :artistbrowse_complete_cb, [:artistbrowse, :userdata], :void
362
+ attach_function :artistbrowse_create, :sp_artistbrowse_create, [ :session, :artist, :artistbrowse_complete_cb, :userdata ], :artistbrowse
363
+ attach_function :artistbrowse_is_loaded, :sp_artistbrowse_is_loaded, [ :artistbrowse ], :bool
364
+ attach_function :artistbrowse_error, :sp_artistbrowse_error, [ :artistbrowse ], :error
365
+ attach_function :artistbrowse_artist, :sp_artistbrowse_artist, [ :artistbrowse ], :artist
366
+ attach_function :artistbrowse_num_portraits, :sp_artistbrowse_num_portraits, [ :artistbrowse ], :int
367
+ attach_function :artistbrowse_portrait, :sp_artistbrowse_portrait, [ :artistbrowse, :int ], :image_id
368
+ attach_function :artistbrowse_num_tracks, :sp_artistbrowse_num_tracks, [ :artistbrowse ], :int
369
+ attach_function :artistbrowse_track, :sp_artistbrowse_track, [ :artistbrowse, :int ], :track
370
+ attach_function :artistbrowse_num_albums, :sp_artistbrowse_num_albums, [ :artistbrowse ], :int
371
+ attach_function :artistbrowse_album, :sp_artistbrowse_album, [ :artistbrowse, :int ], :album
372
+ attach_function :artistbrowse_num_similar_artists, :sp_artistbrowse_num_similar_artists, [ :artistbrowse ], :int
373
+ attach_function :artistbrowse_similar_artist, :sp_artistbrowse_similar_artist, [ :artistbrowse, :int ], :artist
374
+ attach_function :artistbrowse_biography, :sp_artistbrowse_biography, [ :artistbrowse ], :string
375
+
376
+ attach_function :artistbrowse_add_ref, :sp_artistbrowse_add_ref, [ :artistbrowse ], :void
377
+ attach_function :artistbrowse_release, :sp_artistbrowse_release, [ :artistbrowse ], :void
332
378
 
333
379
  #
334
380
  # Images
@@ -338,19 +384,19 @@ module Spotify
338
384
  #
339
385
  enum :imageformat, [:unknown, -1, :jpeg]
340
386
 
341
- callback :image_loaded, [ :pointer, :pointer ], :void
342
- attach_function :image_create, :sp_image_create, [ :pointer, :pointer ], :pointer
343
- attach_function :image_add_load_callback, :sp_image_add_load_callback, [ :pointer, :image_loaded, :pointer ], :void
344
- attach_function :image_remove_load_callback, :sp_image_remove_load_callback, [ :pointer, :image_loaded, :pointer ], :void
345
- attach_function :image_is_loaded, :sp_image_is_loaded, [ :pointer ], :bool
346
- attach_function :image_error, :sp_image_error, [ :pointer ], :error
347
- attach_function :image_format, :sp_image_format, [ :pointer ], :imageformat
348
- attach_function :image_data, :sp_image_data, [ :pointer, :pointer ], :pointer
349
- attach_function :image_image_id, :sp_image_image_id, [ :pointer ], :pointer
350
- attach_function :image_create_from_link, :sp_image_create_from_link, [ :pointer, :pointer ], :pointer
351
-
352
- attach_function :image_add_ref, :sp_image_add_ref, [ :pointer ], :void
353
- attach_function :image_release, :sp_image_release, [ :pointer ], :void
387
+ callback :image_loaded_cb, [ :image, :userdata ], :void
388
+ attach_function :image_create, :sp_image_create, [ :session, :image_id ], :image
389
+ attach_function :image_add_load_callback, :sp_image_add_load_callback, [ :image, :image_loaded_cb, :userdata ], :void
390
+ attach_function :image_remove_load_callback, :sp_image_remove_load_callback, [ :image, :image_loaded_cb, :userdata ], :void
391
+ attach_function :image_is_loaded, :sp_image_is_loaded, [ :image ], :bool
392
+ attach_function :image_error, :sp_image_error, [ :image ], :error
393
+ attach_function :image_format, :sp_image_format, [ :image ], :imageformat
394
+ attach_function :image_data, :sp_image_data, [ :image, :buffer_out ], :pointer
395
+ attach_function :image_image_id, :sp_image_image_id, [ :image ], :image_id
396
+ attach_function :image_create_from_link, :sp_image_create_from_link, [ :session, :link ], :image
397
+
398
+ attach_function :image_add_ref, :sp_image_add_ref, [ :image ], :void
399
+ attach_function :image_release, :sp_image_release, [ :image ], :void
354
400
 
355
401
  #
356
402
  # Searching
@@ -379,101 +425,60 @@ module Spotify
379
425
  :techno , 0x20000
380
426
  ]
381
427
 
382
- attach_function :search_create, :sp_search_create, [ :pointer, :string, :int, :int, :int, :int, :int, :int, callback([:pointer, :pointer], :void), :pointer ], :pointer
383
- attach_function :radio_search_create, :sp_radio_search_create, [ :pointer, :uint, :uint, :radio_genre, :pointer, :pointer ], :pointer
384
- attach_function :search_is_loaded, :sp_search_is_loaded, [ :pointer ], :bool
385
- attach_function :search_error, :sp_search_error, [ :pointer ], :error
386
- attach_function :search_num_tracks, :sp_search_num_tracks, [ :pointer ], :int
387
- attach_function :search_track, :sp_search_track, [ :pointer, :int ], :pointer
388
- attach_function :search_num_albums, :sp_search_num_albums, [ :pointer ], :int
389
- attach_function :search_album, :sp_search_album, [ :pointer, :int ], :pointer
390
- attach_function :search_num_artists, :sp_search_num_artists, [ :pointer ], :int
391
- attach_function :search_artist, :sp_search_artist, [ :pointer, :int ], :pointer
392
- attach_function :search_query, :sp_search_query, [ :pointer ], :string
393
- attach_function :search_did_you_mean, :sp_search_did_you_mean, [ :pointer ], :string
394
- attach_function :search_total_tracks, :sp_search_total_tracks, [ :pointer ], :int
395
- attach_function :search_total_albums, :sp_search_total_albums, [ :pointer ], :int
396
- attach_function :search_total_artists, :sp_search_total_artists, [ :pointer ], :int
397
-
398
- attach_function :search_add_ref, :sp_search_add_ref, [ :pointer ], :void
399
- attach_function :search_release, :sp_search_release, [ :pointer ], :void
428
+ callback :search_complete_cb, [:search, :userdata], :void
429
+ attach_function :search_create, :sp_search_create, [ :session, :string, :int, :int, :int, :int, :int, :int, :search_complete_cb, :userdata ], :search
430
+ attach_function :radio_search_create, :sp_radio_search_create, [ :session, :uint, :uint, :radio_genre, :search_complete_cb, :userdata ], :search
431
+ attach_function :search_is_loaded, :sp_search_is_loaded, [ :search ], :bool
432
+ attach_function :search_error, :sp_search_error, [ :search ], :error
433
+ attach_function :search_num_tracks, :sp_search_num_tracks, [ :search ], :int
434
+ attach_function :search_track, :sp_search_track, [ :search, :int ], :track
435
+ attach_function :search_num_albums, :sp_search_num_albums, [ :search ], :int
436
+ attach_function :search_album, :sp_search_album, [ :search, :int ], :album
437
+ attach_function :search_num_artists, :sp_search_num_artists, [ :search ], :int
438
+ attach_function :search_artist, :sp_search_artist, [ :search, :int ], :artist
439
+ attach_function :search_query, :sp_search_query, [ :search ], :string
440
+ attach_function :search_did_you_mean, :sp_search_did_you_mean, [ :search ], :string
441
+ attach_function :search_total_tracks, :sp_search_total_tracks, [ :search ], :int
442
+ attach_function :search_total_albums, :sp_search_total_albums, [ :search ], :int
443
+ attach_function :search_total_artists, :sp_search_total_artists, [ :search ], :int
444
+
445
+ attach_function :search_add_ref, :sp_search_add_ref, [ :search ], :void
446
+ attach_function :search_release, :sp_search_release, [ :search ], :void
400
447
 
401
448
  #
402
449
  # Playlists
403
450
  #
404
451
  # @see http://developer.spotify.com/en/libspotify/docs/group__playlist.html
405
452
 
406
- #
407
- enum :playlist_type, [:playlist, :start_folder, :end_folder, :placeholder]
408
-
409
- #
410
- enum :playlist_offline_status, [:no, :yes, :downloading, :waiting]
411
-
412
- attach_function :playlist_is_loaded, :sp_playlist_is_loaded, [ :pointer ], :bool
413
- attach_function :playlist_add_callbacks, :sp_playlist_add_callbacks, [ :pointer, :pointer, :pointer ], :void
414
- attach_function :playlist_remove_callbacks, :sp_playlist_remove_callbacks, [ :pointer, :pointer, :pointer ], :void
415
- attach_function :playlist_num_tracks, :sp_playlist_num_tracks, [ :pointer ], :int
416
- attach_function :playlist_track, :sp_playlist_track, [ :pointer, :int ], :pointer
417
- attach_function :playlist_track_create_time, :sp_playlist_track_create_time, [ :pointer, :int ], :int
418
- attach_function :playlist_track_creator, :sp_playlist_track_creator, [ :pointer, :int ], :pointer
419
- attach_function :playlist_track_seen, :sp_playlist_track_seen, [ :pointer, :int ], :bool
420
- attach_function :playlist_track_set_seen, :sp_playlist_track_set_seen, [ :pointer, :int, :bool ], :error
421
- attach_function :playlist_track_message, :sp_playlist_track_message, [ :pointer, :int ], :string
422
- attach_function :playlist_name, :sp_playlist_name, [ :pointer ], :string
423
- attach_function :playlist_rename, :sp_playlist_rename, [ :pointer, :string ], :error
424
- attach_function :playlist_owner, :sp_playlist_owner, [ :pointer ], :pointer
425
- attach_function :playlist_is_collaborative, :sp_playlist_is_collaborative, [ :pointer ], :bool
426
- attach_function :playlist_set_collaborative, :sp_playlist_set_collaborative, [ :pointer, :bool ], :void
427
- attach_function :playlist_set_autolink_tracks, :sp_playlist_set_autolink_tracks, [ :pointer, :bool ], :void
428
- attach_function :playlist_get_description, :sp_playlist_get_description, [ :pointer ], :string
429
- attach_function :playlist_get_image, :sp_playlist_get_image, [ :pointer, :uchar ], :bool
430
- attach_function :playlist_has_pending_changes, :sp_playlist_has_pending_changes, [ :pointer ], :bool
431
- attach_function :playlist_add_tracks, :sp_playlist_add_tracks, [ :pointer, :pointer, :int, :int, :pointer ], :error
432
- attach_function :playlist_remove_tracks, :sp_playlist_remove_tracks, [ :pointer, :pointer, :int ], :error
433
- attach_function :playlist_reorder_tracks, :sp_playlist_reorder_tracks, [ :pointer, :pointer, :int, :int ], :error
434
- attach_function :playlist_num_subscribers, :sp_playlist_num_subscribers, [ :pointer ], :uint
435
- attach_function :playlist_subscribers, :sp_playlist_subscribers, [ :pointer ], :pointer
436
- attach_function :playlist_subscribers_free, :sp_playlist_subscribers_free, [ :pointer ], :void
437
- attach_function :playlist_update_subscribers, :sp_playlist_update_subscribers, [ :pointer, :pointer ], :void
438
- attach_function :playlist_is_in_ram, :sp_playlist_is_in_ram, [ :pointer, :pointer ], :bool
439
- attach_function :playlist_set_in_ram, :sp_playlist_set_in_ram, [ :pointer, :pointer, :bool ], :void
440
- attach_function :playlist_create, :sp_playlist_create, [ :pointer, :pointer ], :pointer
441
- attach_function :playlist_get_offline_status, :sp_playlist_get_offline_status, [ :pointer, :pointer ], :playlist_offline_status
442
- attach_function :playlist_get_offline_download_completed, :sp_playlist_get_offline_download_completed, [ :pointer, :pointer ], :playlist_offline_status
443
- attach_function :playlist_set_offline_mode, :sp_playlist_set_offline_mode, [ :pointer, :pointer, :bool ], :void
444
-
445
- attach_function :playlist_add_ref, :sp_playlist_add_ref, [ :pointer ], :void
446
- attach_function :playlist_release, :sp_playlist_release, [ :pointer ], :void
447
-
448
453
  # FFI::Struct for Playlist callbacks.
449
454
  #
450
- # @attr [callback(:pointer, :pointer, :int, :int, :pointer):void] tracks_added
451
- # @attr [callback(:pointer, :pointer, :int, :pointer):void] tracks_removed
452
- # @attr [callback(:pointer, :pointer, :int, :int, :pointer):void] tracks_moved
453
- # @attr [callback(:pointer, :pointer):void] playlist_renamed
454
- # @attr [callback(:pointer, :pointer):void] playlist_state_changed
455
- # @attr [callback(:pointer, :bool, :pointer):void] playlist_update_in_progress
456
- # @attr [callback(:pointer, :pointer):void] playlist_metadata_updated
457
- # @attr [callback(:pointer, :int, :pointer, :int, :pointer):void] track_created_changed
458
- # @attr [callback(:pointer, :int, :bool, :pointer):void] track_seen_changed
459
- # @attr [callback(:pointer, :string, :pointer):void] description_changed
460
- # @attr [callback(:pointer, :pointer, :pointer):void] image_changed
461
- # @attr [callback(:pointer, :int, :string, :pointer):void] track_message_changed
462
- # @attr [callback(:pointer, :pointer):void] subscribers_changed
455
+ # @attr [callback(:playlist, :array, :int, :int, :userdata):void] tracks_added
456
+ # @attr [callback(:playlist, :array, :int, :userdata):void] tracks_removed
457
+ # @attr [callback(:playlist, :array, :int, :int, :userdata):void] tracks_moved
458
+ # @attr [callback(:playlist, :userdata):void] playlist_renamed
459
+ # @attr [callback(:playlist, :userdata):void] playlist_state_changed
460
+ # @attr [callback(:playlist, :bool, :userdata):void] playlist_update_in_progress
461
+ # @attr [callback(:playlist, :userdata):void] playlist_metadata_updated
462
+ # @attr [callback(:playlist, :int, :user, :int, :userdata):void] track_created_changed
463
+ # @attr [callback(:playlist, :int, :bool, :userdata):void] track_seen_changed
464
+ # @attr [callback(:playlist, :string, :userdata):void] description_changed
465
+ # @attr [callback(:playlist, :image_id, :userdata):void] image_changed
466
+ # @attr [callback(:playlist, :int, :string, :userdata):void] track_message_changed
467
+ # @attr [callback(:playlist, :userdata):void] subscribers_changed
463
468
  class PlaylistCallbacks < FFI::Struct
464
- layout :tracks_added, callback([ :pointer, :pointer, :int, :int, :pointer ], :void),
465
- :tracks_removed, callback([ :pointer, :pointer, :int, :pointer ], :void),
466
- :tracks_moved, callback([ :pointer, :pointer, :int, :int, :pointer ], :void),
467
- :playlist_renamed, callback([ :pointer, :pointer ], :void),
468
- :playlist_state_changed, callback([ :pointer, :pointer ], :void),
469
- :playlist_update_in_progress, callback([ :pointer, :bool, :pointer ], :void),
470
- :playlist_metadata_updated, callback([ :pointer, :pointer ], :void),
471
- :track_created_changed, callback([ :pointer, :int, :pointer, :int, :pointer ], :void),
472
- :track_seen_changed, callback([ :pointer, :int, :bool, :pointer ], :void),
473
- :description_changed, callback([ :pointer, :string, :pointer ], :void),
474
- :image_changed, callback([ :pointer, :pointer, :pointer ], :void),
475
- :track_message_changed, callback([ :pointer, :int, :string, :pointer ], :void),
476
- :subscribers_changed, callback([ :pointer, :pointer ], :void)
469
+ layout :tracks_added, callback([ :playlist, :array, :int, :int, :userdata ], :void),
470
+ :tracks_removed, callback([ :playlist, :array, :int, :userdata ], :void),
471
+ :tracks_moved, callback([ :playlist, :array, :int, :int, :userdata ], :void),
472
+ :playlist_renamed, callback([ :playlist, :userdata ], :void),
473
+ :playlist_state_changed, callback([ :playlist, :userdata ], :void),
474
+ :playlist_update_in_progress, callback([ :playlist, :bool, :userdata ], :void),
475
+ :playlist_metadata_updated, callback([ :playlist, :userdata ], :void),
476
+ :track_created_changed, callback([ :playlist, :int, :user, :int, :userdata ], :void),
477
+ :track_seen_changed, callback([ :playlist, :int, :bool, :userdata ], :void),
478
+ :description_changed, callback([ :playlist, :string, :userdata ], :void),
479
+ :image_changed, callback([ :playlist, :image_id, :userdata ], :void),
480
+ :track_message_changed, callback([ :playlist, :int, :string, :userdata ], :void),
481
+ :subscribers_changed, callback([ :playlist, :userdata ], :void)
477
482
  end
478
483
 
479
484
  # FFI::Struct for Subscribers of a Playlist.
@@ -482,45 +487,87 @@ module Spotify
482
487
  # @attr [Pointer<String>] subscribers
483
488
  class Subscribers < FFI::Struct
484
489
  layout :count, :uint,
485
- :subscribers, :pointer # array of count strings
490
+ :subscribers, :array # array of count strings
486
491
  end
487
492
 
488
493
  #
489
- # Playlist Container
494
+ enum :playlist_type, [:playlist, :start_folder, :end_folder, :placeholder]
495
+
490
496
  #
497
+ enum :playlist_offline_status, [:no, :yes, :downloading, :waiting]
498
+
499
+ attach_function :playlist_is_loaded, :sp_playlist_is_loaded, [ :playlist ], :bool
500
+ attach_function :playlist_add_callbacks, :sp_playlist_add_callbacks, [ :playlist, PlaylistCallbacks, :userdata ], :void
501
+ attach_function :playlist_remove_callbacks, :sp_playlist_remove_callbacks, [ :playlist, PlaylistCallbacks, :userdata ], :void
502
+ attach_function :playlist_num_tracks, :sp_playlist_num_tracks, [ :playlist ], :int
503
+ attach_function :playlist_track, :sp_playlist_track, [ :playlist, :int ], :track
504
+ attach_function :playlist_track_create_time, :sp_playlist_track_create_time, [ :playlist, :int ], :int
505
+ attach_function :playlist_track_creator, :sp_playlist_track_creator, [ :playlist, :int ], :user
506
+ attach_function :playlist_track_seen, :sp_playlist_track_seen, [ :playlist, :int ], :bool
507
+ attach_function :playlist_track_set_seen, :sp_playlist_track_set_seen, [ :playlist, :int, :bool ], :error
508
+ attach_function :playlist_track_message, :sp_playlist_track_message, [ :playlist, :int ], :string
509
+ attach_function :playlist_name, :sp_playlist_name, [ :playlist ], :string
510
+ attach_function :playlist_rename, :sp_playlist_rename, [ :playlist, :string ], :error
511
+ attach_function :playlist_owner, :sp_playlist_owner, [ :playlist ], :user
512
+ attach_function :playlist_is_collaborative, :sp_playlist_is_collaborative, [ :playlist ], :bool
513
+ attach_function :playlist_set_collaborative, :sp_playlist_set_collaborative, [ :playlist, :bool ], :void
514
+ attach_function :playlist_set_autolink_tracks, :sp_playlist_set_autolink_tracks, [ :playlist, :bool ], :void
515
+ attach_function :playlist_get_description, :sp_playlist_get_description, [ :playlist ], :string
516
+ attach_function :playlist_get_image, :sp_playlist_get_image, [ :playlist, :image_id ], :bool
517
+ attach_function :playlist_has_pending_changes, :sp_playlist_has_pending_changes, [ :playlist ], :bool
518
+ attach_function :playlist_add_tracks, :sp_playlist_add_tracks, [ :playlist, :array, :int, :int, :session ], :error
519
+ attach_function :playlist_remove_tracks, :sp_playlist_remove_tracks, [ :playlist, :array, :int ], :error
520
+ attach_function :playlist_reorder_tracks, :sp_playlist_reorder_tracks, [ :playlist, :array, :int, :int ], :error
521
+ attach_function :playlist_num_subscribers, :sp_playlist_num_subscribers, [ :playlist ], :uint
522
+ attach_function :playlist_subscribers, :sp_playlist_subscribers, [ :playlist ], Subscribers
523
+ attach_function :playlist_subscribers_free, :sp_playlist_subscribers_free, [ Subscribers ], :void
524
+ attach_function :playlist_update_subscribers, :sp_playlist_update_subscribers, [ :session, :playlist ], :void
525
+ attach_function :playlist_is_in_ram, :sp_playlist_is_in_ram, [ :session, :playlist ], :bool
526
+ attach_function :playlist_set_in_ram, :sp_playlist_set_in_ram, [ :session, :playlist, :bool ], :void
527
+ attach_function :playlist_create, :sp_playlist_create, [ :session, :link ], :playlist
528
+ attach_function :playlist_get_offline_status, :sp_playlist_get_offline_status, [ :session, :playlist ], :playlist_offline_status
529
+ attach_function :playlist_get_offline_download_completed, :sp_playlist_get_offline_download_completed, [ :session, :playlist ], :int
530
+ attach_function :playlist_set_offline_mode, :sp_playlist_set_offline_mode, [ :session, :playlist, :bool ], :void
531
+
532
+ attach_function :playlist_add_ref, :sp_playlist_add_ref, [ :playlist ], :void
533
+ attach_function :playlist_release, :sp_playlist_release, [ :playlist ], :void
491
534
 
492
535
  #
493
- attach_function :playlistcontainer_add_callbacks, :sp_playlistcontainer_add_callbacks, [ :pointer, :pointer, :pointer ], :void
494
- attach_function :playlistcontainer_remove_callbacks, :sp_playlistcontainer_remove_callbacks, [ :pointer, :pointer, :pointer ], :void
495
- attach_function :playlistcontainer_num_playlists, :sp_playlistcontainer_num_playlists, [ :pointer ], :int
496
- attach_function :playlistcontainer_playlist, :sp_playlistcontainer_playlist, [ :pointer, :int ], :pointer
497
- attach_function :playlistcontainer_playlist_type, :sp_playlistcontainer_playlist_type, [ :pointer, :int ], :int
498
- attach_function :playlistcontainer_playlist_folder_name, :sp_playlistcontainer_playlist_folder_name, [ :pointer, :int, :string, :int ], :error
499
- attach_function :playlistcontainer_playlist_folder_id, :sp_playlistcontainer_playlist_folder_id, [ :pointer, :int ], :uint64
500
- attach_function :playlistcontainer_add_new_playlist, :sp_playlistcontainer_add_new_playlist, [ :pointer, :string ], :pointer
501
- attach_function :playlistcontainer_add_playlist, :sp_playlistcontainer_add_playlist, [ :pointer, :pointer ], :pointer
502
- attach_function :playlistcontainer_remove_playlist, :sp_playlistcontainer_remove_playlist, [ :pointer, :int ], :error
503
- attach_function :playlistcontainer_move_playlist, :sp_playlistcontainer_move_playlist, [ :pointer, :int, :int, :bool ], :error
504
- attach_function :playlistcontainer_add_folder, :sp_playlistcontainer_add_folder, [ :pointer, :int, :string ], :error
505
- attach_function :playlistcontainer_owner, :sp_playlistcontainer_owner, [ :pointer ], :pointer
506
- attach_function :playlistcontainer_is_loaded, :sp_playlistcontainer_is_loaded, [ :pointer ], :bool
507
-
508
- attach_function :playlistcontainer_add_ref, :sp_playlistcontainer_add_ref, [ :pointer ], :void
509
- attach_function :playlistcontainer_release, :sp_playlistcontainer_release, [ :pointer ], :void
536
+ # Playlist Container
537
+ #
510
538
 
511
539
  # FFI::Struct for the PlaylistContainer.
512
540
  #
513
- # @attr [callback(:pointer, :pointer, :int, :pointer):void] playlist_added
514
- # @attr [callback(:pointer, :pointer, :int, :pointer):void] playlist_removed
515
- # @attr [callback(:pointer, :pointer, :int, :int, :pointer):void] playlist_moved
516
- # @attr [callback(:pointer, :pointer):void] container_loaded
541
+ # @attr [callback(:playlistcontainer, :playlist, :int, :userdata):void] playlist_added
542
+ # @attr [callback(:playlistcontainer, :playlist, :int, :userdata):void] playlist_removed
543
+ # @attr [callback(:playlistcontainer, :playlist, :int, :int, :userdata):void] playlist_moved
544
+ # @attr [callback(:playlistcontainer, :userdata):void] container_loaded
517
545
  class PlaylistContainerCallbacks < FFI::Struct
518
- layout :playlist_added, callback([ :pointer, :pointer, :int, :pointer ], :void),
519
- :playlist_removed, callback([ :pointer, :pointer, :int, :pointer ], :void),
520
- :playlist_moved, callback([ :pointer, :pointer, :int, :int, :pointer ], :void),
521
- :container_loaded, callback([ :pointer, :pointer ], :void)
546
+ layout :playlist_added, callback([ :playlistcontainer, :playlist, :int, :userdata ], :void),
547
+ :playlist_removed, callback([ :playlistcontainer, :playlist, :int, :userdata ], :void),
548
+ :playlist_moved, callback([ :playlistcontainer, :playlist, :int, :int, :userdata ], :void),
549
+ :container_loaded, callback([ :playlistcontainer, :userdata ], :void)
522
550
  end
523
551
 
552
+ #
553
+ attach_function :playlistcontainer_add_callbacks, :sp_playlistcontainer_add_callbacks, [ :playlistcontainer, PlaylistContainerCallbacks, :userdata ], :void
554
+ attach_function :playlistcontainer_remove_callbacks, :sp_playlistcontainer_remove_callbacks, [ :playlistcontainer, PlaylistContainerCallbacks, :userdata ], :void
555
+ attach_function :playlistcontainer_num_playlists, :sp_playlistcontainer_num_playlists, [ :playlistcontainer ], :int
556
+ attach_function :playlistcontainer_playlist, :sp_playlistcontainer_playlist, [ :playlistcontainer, :int ], :playlist
557
+ attach_function :playlistcontainer_playlist_type, :sp_playlistcontainer_playlist_type, [ :playlistcontainer, :int ], :playlist_type
558
+ attach_function :playlistcontainer_playlist_folder_name, :sp_playlistcontainer_playlist_folder_name, [ :playlistcontainer, :int, :buffer_out, :int ], :error
559
+ attach_function :playlistcontainer_playlist_folder_id, :sp_playlistcontainer_playlist_folder_id, [ :playlistcontainer, :int ], :uint64
560
+ attach_function :playlistcontainer_add_new_playlist, :sp_playlistcontainer_add_new_playlist, [ :playlistcontainer, :string ], :playlist
561
+ attach_function :playlistcontainer_add_playlist, :sp_playlistcontainer_add_playlist, [ :playlistcontainer, :link ], :playlist
562
+ attach_function :playlistcontainer_remove_playlist, :sp_playlistcontainer_remove_playlist, [ :playlistcontainer, :int ], :error
563
+ attach_function :playlistcontainer_move_playlist, :sp_playlistcontainer_move_playlist, [ :playlistcontainer, :int, :int, :bool ], :error
564
+ attach_function :playlistcontainer_add_folder, :sp_playlistcontainer_add_folder, [ :playlistcontainer, :int, :string ], :error
565
+ attach_function :playlistcontainer_owner, :sp_playlistcontainer_owner, [ :playlistcontainer ], :user
566
+ attach_function :playlistcontainer_is_loaded, :sp_playlistcontainer_is_loaded, [ :playlistcontainer ], :bool
567
+
568
+ attach_function :playlistcontainer_add_ref, :sp_playlistcontainer_add_ref, [ :playlistcontainer ], :void
569
+ attach_function :playlistcontainer_release, :sp_playlistcontainer_release, [ :playlistcontainer ], :void
570
+
524
571
  #
525
572
  # User handling
526
573
  #
@@ -529,15 +576,15 @@ module Spotify
529
576
  #
530
577
  enum :relation_type, [:unknown, :none, :unidirectional, :bidirectional]
531
578
 
532
- attach_function :user_canonical_name, :sp_user_canonical_name, [ :pointer ], :string
533
- attach_function :user_display_name, :sp_user_display_name, [ :pointer ], :string
534
- attach_function :user_is_loaded, :sp_user_is_loaded, [ :pointer ], :bool
535
- attach_function :user_full_name, :sp_user_full_name, [ :pointer ], :string
536
- attach_function :user_picture, :sp_user_picture, [ :pointer ], :string
537
- attach_function :user_relation_type, :sp_user_relation_type, [ :pointer, :pointer ], :relation_type
538
-
539
- attach_function :user_add_ref, :sp_user_add_ref, [ :pointer ], :void
540
- attach_function :user_release, :sp_user_release, [ :pointer ], :void
579
+ attach_function :user_canonical_name, :sp_user_canonical_name, [ :user ], :string
580
+ attach_function :user_display_name, :sp_user_display_name, [ :user ], :string
581
+ attach_function :user_is_loaded, :sp_user_is_loaded, [ :user ], :bool
582
+ attach_function :user_full_name, :sp_user_full_name, [ :user ], :string
583
+ attach_function :user_picture, :sp_user_picture, [ :user ], :string
584
+ attach_function :user_relation_type, :sp_user_relation_type, [ :session, :user ], :relation_type
585
+
586
+ attach_function :user_add_ref, :sp_user_add_ref, [ :user ], :void
587
+ attach_function :user_release, :sp_user_release, [ :user ], :void
541
588
 
542
589
  #
543
590
  # Toplists
@@ -548,18 +595,19 @@ module Spotify
548
595
  enum :toplisttype, [:artists, :albums, :tracks]
549
596
  enum :toplistregion, [:everywhere, :user]
550
597
 
551
- attach_function :toplistbrowse_create, :sp_toplistbrowse_create, [ :pointer, :toplisttype, :toplistregion, :string, callback([:pointer, :pointer], :void), :pointer ], :pointer
552
- attach_function :toplistbrowse_is_loaded, :sp_toplistbrowse_is_loaded, [ :pointer ], :bool
553
- attach_function :toplistbrowse_error, :sp_toplistbrowse_error, [ :pointer ], :error
554
- attach_function :toplistbrowse_num_artists, :sp_toplistbrowse_num_artists, [ :pointer ], :int
555
- attach_function :toplistbrowse_artist, :sp_toplistbrowse_artist, [ :pointer, :int ], :pointer
556
- attach_function :toplistbrowse_num_albums, :sp_toplistbrowse_num_albums, [ :pointer ], :int
557
- attach_function :toplistbrowse_album, :sp_toplistbrowse_album, [ :pointer, :int ], :pointer
558
- attach_function :toplistbrowse_num_tracks, :sp_toplistbrowse_num_tracks, [ :pointer ], :int
559
- attach_function :toplistbrowse_track, :sp_toplistbrowse_track, [ :pointer, :int ], :pointer
560
-
561
- attach_function :toplistbrowse_add_ref, :sp_toplistbrowse_add_ref, [ :pointer ], :void
562
- attach_function :toplistbrowse_release, :sp_toplistbrowse_release, [ :pointer ], :void
598
+ callback :toplistbrowse_complete_cb, [:toplistbrowse, :userdata], :void
599
+ attach_function :toplistbrowse_create, :sp_toplistbrowse_create, [ :session, :toplisttype, :toplistregion, :string, :toplistbrowse_complete_cb, :userdata ], :toplistbrowse
600
+ attach_function :toplistbrowse_is_loaded, :sp_toplistbrowse_is_loaded, [ :toplistbrowse ], :bool
601
+ attach_function :toplistbrowse_error, :sp_toplistbrowse_error, [ :toplistbrowse ], :error
602
+ attach_function :toplistbrowse_num_artists, :sp_toplistbrowse_num_artists, [ :toplistbrowse ], :int
603
+ attach_function :toplistbrowse_artist, :sp_toplistbrowse_artist, [ :toplistbrowse, :int ], :artist
604
+ attach_function :toplistbrowse_num_albums, :sp_toplistbrowse_num_albums, [ :toplistbrowse ], :int
605
+ attach_function :toplistbrowse_album, :sp_toplistbrowse_album, [ :toplistbrowse, :int ], :album
606
+ attach_function :toplistbrowse_num_tracks, :sp_toplistbrowse_num_tracks, [ :toplistbrowse ], :int
607
+ attach_function :toplistbrowse_track, :sp_toplistbrowse_track, [ :toplistbrowse, :int ], :track
608
+
609
+ attach_function :toplistbrowse_add_ref, :sp_toplistbrowse_add_ref, [ :toplistbrowse ], :void
610
+ attach_function :toplistbrowse_release, :sp_toplistbrowse_release, [ :toplistbrowse ], :void
563
611
 
564
612
  #
565
613
  # Inbox
@@ -567,9 +615,10 @@ module Spotify
567
615
  # @see http://developer.spotify.com/en/libspotify/docs/group__inbox.html
568
616
 
569
617
  #
570
- attach_function :inbox_post_tracks, :sp_inbox_post_tracks, [ :pointer, :string, :pointer, :int, :string, callback([:pointer, :pointer], :void), :pointer ], :pointer
571
- attach_function :inbox_error, :sp_inbox_error, [ :pointer ], :error
572
-
573
- attach_function :inbox_add_ref, :sp_inbox_add_ref, [ :pointer ], :void
574
- attach_function :inbox_release, :sp_inbox_release, [ :pointer ], :void
575
- end
618
+ callback :inboxpost_complete_cb, [:inbox, :userdata], :void
619
+ attach_function :inbox_post_tracks, :sp_inbox_post_tracks, [ :session, :string, :array, :int, :string, :inboxpost_complete_cb, :userdata ], :inbox
620
+ attach_function :inbox_error, :sp_inbox_error, [ :inbox ], :error
621
+
622
+ attach_function :inbox_add_ref, :sp_inbox_add_ref, [ :inbox ], :void
623
+ attach_function :inbox_release, :sp_inbox_release, [ :inbox ], :void
624
+ end