spotify 12.2.0 → 12.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -1
- data/.rspec +5 -0
- data/CHANGELOG.md +45 -27
- data/Gemfile +4 -0
- data/README.markdown +52 -19
- data/Rakefile +16 -7
- data/lib/spotify.rb +109 -8
- data/lib/spotify/api.rb +61 -0
- data/lib/spotify/api/album.rb +14 -0
- data/lib/spotify/api/album_browse.rb +18 -0
- data/lib/spotify/api/artist.rb +10 -0
- data/lib/spotify/api/artist_browse.rb +23 -0
- data/lib/spotify/api/error.rb +6 -0
- data/lib/spotify/api/image.rb +16 -0
- data/lib/spotify/api/inbox.rb +9 -0
- data/lib/spotify/api/link.rb +25 -0
- data/lib/spotify/api/playlist.rb +39 -0
- data/lib/spotify/api/playlist_container.rb +23 -0
- data/lib/spotify/api/search.rb +27 -0
- data/lib/spotify/api/session.rb +46 -0
- data/lib/spotify/api/toplist_browse.rb +17 -0
- data/lib/spotify/api/track.rb +26 -0
- data/lib/spotify/api/user.rb +10 -0
- data/lib/spotify/defines.rb +109 -0
- data/lib/spotify/error.rb +62 -0
- data/lib/spotify/managed_pointer.rb +90 -0
- data/lib/spotify/objects.rb +16 -0
- data/lib/spotify/objects/album.rb +5 -0
- data/lib/spotify/objects/album_browse.rb +5 -0
- data/lib/spotify/objects/artist.rb +5 -0
- data/lib/spotify/objects/artist_browse.rb +5 -0
- data/lib/spotify/objects/image.rb +5 -0
- data/lib/spotify/objects/inbox.rb +5 -0
- data/lib/spotify/objects/link.rb +5 -0
- data/lib/spotify/objects/playlist.rb +5 -0
- data/lib/spotify/objects/playlist_container.rb +5 -0
- data/lib/spotify/objects/search.rb +5 -0
- data/lib/spotify/objects/session.rb +20 -0
- data/lib/spotify/objects/toplist_browse.rb +5 -0
- data/lib/spotify/objects/track.rb +5 -0
- data/lib/spotify/objects/user.rb +5 -0
- data/lib/spotify/structs.rb +46 -0
- data/lib/spotify/structs/audio_buffer_stats.rb +10 -0
- data/lib/spotify/structs/audio_format.rb +12 -0
- data/lib/spotify/structs/offline_sync_status.rb +24 -0
- data/lib/spotify/structs/playlist_callbacks.rb +32 -0
- data/lib/spotify/structs/playlist_container_callbacks.rb +14 -0
- data/lib/spotify/structs/session_callbacks.rb +48 -0
- data/lib/spotify/structs/session_config.rb +64 -0
- data/lib/spotify/structs/subscribers.rb +31 -0
- data/lib/spotify/types.rb +3 -0
- data/lib/spotify/types/image_id.rb +5 -0
- data/lib/spotify/types/nul_string.rb +51 -0
- data/lib/spotify/types/utf8_string.rb +24 -28
- data/lib/spotify/util.rb +36 -0
- data/lib/spotify/version.rb +7 -2
- data/spec/api-linux.xml +1887 -0
- data/spec/api-mac.xml +1886 -0
- data/spec/spec_helper.rb +20 -0
- data/spec/spotify/api_spec.rb +62 -0
- data/spec/spotify/defines_spec.rb +22 -0
- data/spec/spotify/enums_spec.rb +9 -0
- data/spec/spotify/managed_pointer_spec.rb +75 -0
- data/spec/spotify/spotify_spec.rb +69 -0
- data/spec/spotify/structs/session_config_spec.rb +20 -0
- data/spec/spotify/structs/struct_spec.rb +34 -0
- data/spec/spotify/structs/subscribers_spec.rb +31 -0
- data/spec/spotify/structs_spec.rb +19 -0
- data/spec/spotify/types/image_id_spec.rb +44 -0
- data/spec/spotify/types/nul_string_spec.rb +31 -0
- data/spec/spotify/types/utf8_string_spec.rb +24 -0
- data/spec/support/hook_spotify.rb +37 -0
- data/spec/support/spotify_util.rb +17 -0
- data/spotify.gemspec +6 -11
- metadata +99 -26
- data/lib/spotify/error_wrappers.rb +0 -165
- data/lib/spotify/functions.rb +0 -755
- data/lib/spotify/gc_wrappers.rb +0 -105
- data/lib/spotify/types/pointer.rb +0 -59
- data/spec/spotify_spec.rb +0 -467
data/lib/spotify/functions.rb
DELETED
@@ -1,755 +0,0 @@
|
|
1
|
-
# This file contains the *actual* FFI bindings to the libspotify functions.
|
2
|
-
|
3
|
-
# FFI wrapper around libspotify.
|
4
|
-
#
|
5
|
-
# See official documentation for more detailed documentation about
|
6
|
-
# functions and their behavior.
|
7
|
-
#
|
8
|
-
# @see http://developer.spotify.com/en/libspotify/docs/
|
9
|
-
module Spotify
|
10
|
-
extend FFI::Library
|
11
|
-
|
12
|
-
begin
|
13
|
-
ffi_lib ['libspotify', '/Library/Frameworks/libspotify.framework/libspotify']
|
14
|
-
rescue LoadError => e
|
15
|
-
puts "Failed to load the `libspotify` library. Please make sure you have it
|
16
|
-
installed, either globally on your system, in your LD_LIBRARY_PATH, or in
|
17
|
-
your current working directory (#{Dir.pwd}).
|
18
|
-
|
19
|
-
For installation instructions, please see:
|
20
|
-
https://github.com/Burgestrand/Hallon/wiki/How-to-install-libspotify".gsub(/^ */, '')
|
21
|
-
puts
|
22
|
-
raise
|
23
|
-
end
|
24
|
-
|
25
|
-
class << self
|
26
|
-
# Fetches the associated value of an enum from a given symbol.
|
27
|
-
#
|
28
|
-
# @example retrieving a value
|
29
|
-
# Spotify.enum_value!(:ok, "error value") # => 0
|
30
|
-
#
|
31
|
-
# @example failing to retrieve a value
|
32
|
-
# Spotify.enum_value!(:moo, "connection rule") # => ArgumentError, invalid connection rule: :moo
|
33
|
-
#
|
34
|
-
# @param [Symbol] symbol
|
35
|
-
# @param [#to_s] type used as error message when the symbol does not resolve
|
36
|
-
# @raise ArgumentError on failure
|
37
|
-
def enum_value!(symbol, type)
|
38
|
-
enum_value(symbol) or raise ArgumentError, "invalid #{type}: #{symbol}"
|
39
|
-
end
|
40
|
-
|
41
|
-
# Override FFI::Library#attach_function to always add the `:blocking` option.
|
42
|
-
#
|
43
|
-
# The reason for this is that which libspotify functions may call callbacks
|
44
|
-
# is unspecified. And really… I don’t know of any drawbacks with this method.
|
45
|
-
def attach_function(*arguments, &block)
|
46
|
-
options = arguments.pop if arguments.last.is_a?(Hash)
|
47
|
-
options ||= {}
|
48
|
-
options = { :blocking => true }.merge(options)
|
49
|
-
arguments << options
|
50
|
-
super(*arguments, &block)
|
51
|
-
end
|
52
|
-
|
53
|
-
# @return [Boolean] true if on Linux
|
54
|
-
def linux?
|
55
|
-
platform == :linux
|
56
|
-
end
|
57
|
-
|
58
|
-
# @return [Boolean] true if on Mac OS
|
59
|
-
def mac?
|
60
|
-
platform == :mac
|
61
|
-
end
|
62
|
-
|
63
|
-
# @return [Symbol] platform as either :mac or :linux
|
64
|
-
def platform
|
65
|
-
case RUBY_PLATFORM
|
66
|
-
when /darwin/ then :mac
|
67
|
-
when /linux/ then :linux
|
68
|
-
else :unknown
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
# libspotify API version
|
74
|
-
# @return [Fixnum]
|
75
|
-
API_VERSION = VERSION.split('.').first.to_i
|
76
|
-
|
77
|
-
# Aliases to Spotify types
|
78
|
-
typedef :pointer, :frames
|
79
|
-
typedef :pointer, :session
|
80
|
-
typedef :pointer, :track
|
81
|
-
typedef :pointer, :user
|
82
|
-
typedef :pointer, :playlistcontainer
|
83
|
-
typedef :pointer, :playlist
|
84
|
-
typedef :pointer, :link
|
85
|
-
typedef :pointer, :album
|
86
|
-
typedef :pointer, :artist
|
87
|
-
typedef :pointer, :search
|
88
|
-
typedef :pointer, :image
|
89
|
-
typedef :pointer, :albumbrowse
|
90
|
-
typedef :pointer, :artistbrowse
|
91
|
-
typedef :pointer, :toplistbrowse
|
92
|
-
typedef :pointer, :inbox
|
93
|
-
|
94
|
-
typedef :pointer, :userdata
|
95
|
-
typedef :pointer, :array
|
96
|
-
|
97
|
-
typedef :pointer, :string_pointer
|
98
|
-
|
99
|
-
typedef UTF8String, :utf8_string
|
100
|
-
typedef ImageID, :image_id
|
101
|
-
|
102
|
-
#
|
103
|
-
# Error
|
104
|
-
#
|
105
|
-
# @see http://developer.spotify.com/en/libspotify/docs/group__error.html
|
106
|
-
|
107
|
-
#
|
108
|
-
enum :error, [:ok, 0,
|
109
|
-
:bad_api_version, :api_initialization_failed, :track_not_playable,
|
110
|
-
|
111
|
-
:bad_application_key, 5,
|
112
|
-
:bad_username_or_password, :user_banned,
|
113
|
-
:unable_to_contact_server, :client_too_old, :other_permanent,
|
114
|
-
:bad_user_agent, :missing_callback, :invalid_indata,
|
115
|
-
:index_out_of_range, :user_needs_premium, :other_transient,
|
116
|
-
:is_loading, :no_stream_available, :permission_denied,
|
117
|
-
:inbox_is_full, :no_cache, :no_such_user, :no_credentials,
|
118
|
-
:network_disabled, :invalid_device_id, :cant_open_trace_file,
|
119
|
-
:application_banned,
|
120
|
-
|
121
|
-
:offline_too_many_tracks, 31,
|
122
|
-
:offline_disk_cache, :offline_expired, :offline_not_allowed,
|
123
|
-
:offline_license_lost, :offline_license_error,
|
124
|
-
|
125
|
-
:lastfm_auth_error, 39,
|
126
|
-
:invalid_argument, :system_failure]
|
127
|
-
|
128
|
-
# @macro [attach] attach_function
|
129
|
-
#
|
130
|
-
# Calls +$2+. See source for actual parameters.
|
131
|
-
#
|
132
|
-
# @method $1($3)
|
133
|
-
# @return [$4]
|
134
|
-
attach_function :error_message, :sp_error_message, [ :error ], :utf8_string
|
135
|
-
|
136
|
-
#
|
137
|
-
# Miscellaneous
|
138
|
-
#
|
139
|
-
# These don’t fit anywhere else :(
|
140
|
-
attach_function :build_id, :sp_build_id, [], :utf8_string
|
141
|
-
|
142
|
-
#
|
143
|
-
# Audio
|
144
|
-
#
|
145
|
-
# @see http://developer.spotify.com/en/libspotify/docs/group__session.html
|
146
|
-
|
147
|
-
#
|
148
|
-
enum :sampletype, [:int16] # int16_native_endian
|
149
|
-
enum :bitrate, %w(160k 320k 96k).map(&:to_sym)
|
150
|
-
|
151
|
-
# FFI::Struct for Audio Format.
|
152
|
-
#
|
153
|
-
# @attr [:sampletype] sample_type
|
154
|
-
# @attr [Fixnum] sample_rate
|
155
|
-
# @attr [Fixnum] channels
|
156
|
-
class AudioFormat < FFI::Struct
|
157
|
-
layout :sample_type => :sampletype,
|
158
|
-
:sample_rate => :int,
|
159
|
-
:channels => :int
|
160
|
-
end
|
161
|
-
|
162
|
-
# FFI::Struct for Audio Buffer Stats.
|
163
|
-
#
|
164
|
-
# @attr [Fixnum] samples
|
165
|
-
# @attr [Fixnum] stutter
|
166
|
-
class AudioBufferStats < FFI::Struct
|
167
|
-
layout :samples => :int,
|
168
|
-
:stutter => :int
|
169
|
-
end
|
170
|
-
|
171
|
-
#
|
172
|
-
# Session
|
173
|
-
#
|
174
|
-
# @see http://developer.spotify.com/en/libspotify/docs/group__session.html
|
175
|
-
|
176
|
-
# FFI::Struct for Session callbacks.
|
177
|
-
#
|
178
|
-
# @attr [callback(:session, :error):void] logged_in
|
179
|
-
# @attr [callback(:session):void] logged_out
|
180
|
-
# @attr [callback(:session):void] metadata_updated
|
181
|
-
# @attr [callback(:session, :error):void] connection_error
|
182
|
-
# @attr [callback(:session, :utf8_string):void] message_to_user
|
183
|
-
# @attr [callback(:session):void] notify_main_thread
|
184
|
-
# @attr [callback(:session, AudioFormat, :frames, :int):int] music_delivery
|
185
|
-
# @attr [callback(:session):void] play_token_lost
|
186
|
-
# @attr [callback(:session, :utf8_string):void] log_message
|
187
|
-
# @attr [callback(:session):void] end_of_track
|
188
|
-
# @attr [callback(:session, :error):void] streaming_error
|
189
|
-
# @attr [callback(:session):void] userinfo_updated
|
190
|
-
# @attr [callback(:session):void] start_playback
|
191
|
-
# @attr [callback(:session):void] stop_playback
|
192
|
-
# @attr [callback(:session, AudioBufferStats):void] get_audio_buffer_stats
|
193
|
-
# @attr [callback(:session)::void] offline_status_updated
|
194
|
-
class SessionCallbacks < FFI::Struct
|
195
|
-
layout :logged_in => callback([ :session, :error ], :void),
|
196
|
-
:logged_out => callback([ :session ], :void),
|
197
|
-
:metadata_updated => callback([ :session ], :void),
|
198
|
-
:connection_error => callback([ :session, :error ], :void),
|
199
|
-
:message_to_user => callback([ :session, :utf8_string ], :void),
|
200
|
-
:notify_main_thread => callback([ :session ], :void),
|
201
|
-
:music_delivery => callback([ :session, AudioFormat, :frames, :int ], :int),
|
202
|
-
:play_token_lost => callback([ :session ], :void),
|
203
|
-
:log_message => callback([ :session, :utf8_string ], :void),
|
204
|
-
:end_of_track => callback([ :session ], :void),
|
205
|
-
:streaming_error => callback([ :session, :error ], :void),
|
206
|
-
:userinfo_updated => callback([ :session ], :void),
|
207
|
-
:start_playback => callback([ :session ], :void),
|
208
|
-
:stop_playback => callback([ :session ], :void),
|
209
|
-
:get_audio_buffer_stats => callback([ :session, AudioBufferStats ], :void),
|
210
|
-
:offline_status_updated => callback([ :session ], :void),
|
211
|
-
:offline_error => callback([ :session, :error ], :void),
|
212
|
-
:credentials_blob_updated => callback([ :session, :string ], :void),
|
213
|
-
:connectionstate_updated => callback([ :session ], :void),
|
214
|
-
:scrobble_error => callback([ :session, :error ], :void),
|
215
|
-
:private_session_mode_changed => callback([ :session, :bool ], :void)
|
216
|
-
end
|
217
|
-
|
218
|
-
# FFI::Struct for Session configuration.
|
219
|
-
#
|
220
|
-
# @attr [Fixnum] api_version
|
221
|
-
# @attr [Pointer] cache_location
|
222
|
-
# @attr [Pointer] settings_location
|
223
|
-
# @attr [size_t] application_key_size
|
224
|
-
# @attr [Pointer] user_agent
|
225
|
-
# @attr [Pointer] callbacks
|
226
|
-
# @attr [Pointer] userdata
|
227
|
-
# @attr [Fixnum] dont_save_metadata_for_playlists
|
228
|
-
# @attr [Fixnum] initially_unload_playlists
|
229
|
-
class SessionConfig < FFI::Struct
|
230
|
-
it = {}
|
231
|
-
it[:api_version] = :int
|
232
|
-
it[:cache_location] = :string_pointer
|
233
|
-
it[:settings_location] = :string_pointer
|
234
|
-
it[:application_key] = :pointer
|
235
|
-
it[:application_key_size] = :size_t
|
236
|
-
it[:user_agent] = :string_pointer
|
237
|
-
it[:callbacks] = SessionCallbacks.by_ref
|
238
|
-
it[:userdata] = :userdata
|
239
|
-
it[:compress_playlists] = :bool
|
240
|
-
it[:dont_save_metadata_for_playlists] = :bool
|
241
|
-
it[:initially_unload_playlists] = :bool
|
242
|
-
it[:device_id] = :string_pointer
|
243
|
-
it[:proxy] = :string_pointer
|
244
|
-
it[:proxy_username] = :string_pointer
|
245
|
-
it[:proxy_password] = :string_pointer
|
246
|
-
it[:ca_certs_filename] = :string_pointer if Spotify.linux?
|
247
|
-
it[:tracefile] = :string_pointer
|
248
|
-
layout(it)
|
249
|
-
end
|
250
|
-
|
251
|
-
# FFI::Struct for Offline Sync Status
|
252
|
-
#
|
253
|
-
# @attr [Fixnum] queued_tracks
|
254
|
-
# @attr [Fixnum] queued_bytes
|
255
|
-
# @attr [Fixnum] done_tracks
|
256
|
-
# @attr [Fixnum] done_bytes
|
257
|
-
# @attr [Fixnum] copied_tracks
|
258
|
-
# @attr [Fixnum] copied_bytes
|
259
|
-
# @attr [Fixnum] willnotcopy_tracks
|
260
|
-
# @attr [Fixnum] error_tracks
|
261
|
-
# @attr [Fixnum] syncing
|
262
|
-
class OfflineSyncStatus < FFI::Struct
|
263
|
-
layout :queued_tracks => :int,
|
264
|
-
:queued_bytes => :uint64,
|
265
|
-
:done_tracks => :int,
|
266
|
-
:done_bytes => :uint64,
|
267
|
-
:copied_tracks => :int,
|
268
|
-
:copied_bytes => :uint64,
|
269
|
-
:willnotcopy_tracks => :int,
|
270
|
-
:error_tracks => :int,
|
271
|
-
:syncing => :bool
|
272
|
-
end
|
273
|
-
|
274
|
-
#
|
275
|
-
enum :social_provider, [:spotify, :facebook, :lastfm]
|
276
|
-
|
277
|
-
#
|
278
|
-
enum :scrobbling_state, [:use_global_setting, :local_enabled, :local_disabled, :global_enabled, :global_disabled]
|
279
|
-
|
280
|
-
#
|
281
|
-
enum :connectionstate, [:logged_out, :logged_in, :disconnected, :undefined, :offline]
|
282
|
-
|
283
|
-
#
|
284
|
-
enum :connection_type, [:unknown, :none, :mobile, :mobile_roaming, :wifi, :wired]
|
285
|
-
|
286
|
-
#
|
287
|
-
enum :connection_rules, [:network , 0x1,
|
288
|
-
:network_if_roaming , 0x2,
|
289
|
-
:allow_sync_over_mobile, 0x4,
|
290
|
-
:allow_sync_over_wifi , 0x8]
|
291
|
-
|
292
|
-
attach_function :session_create, :sp_session_create, [ SessionConfig, :buffer_out ], :error
|
293
|
-
attach_function :session_release, :sp_session_release, [ :session ], :error
|
294
|
-
|
295
|
-
attach_function :session_process_events, :sp_session_process_events, [ :session, :buffer_out ], :error
|
296
|
-
attach_function :session_login, :sp_session_login, [ :session, :utf8_string, :string, :bool, :string ], :error
|
297
|
-
attach_function :session_relogin, :sp_session_relogin, [ :session ], :error
|
298
|
-
attach_function :session_forget_me, :sp_session_forget_me, [ :session ], :error
|
299
|
-
attach_function :session_remembered_user, :sp_session_remembered_user, [ :session, :buffer_out, :size_t ], :int
|
300
|
-
|
301
|
-
attach_function :session_user, :sp_session_user, [ :session ], :user
|
302
|
-
attach_function :session_logout, :sp_session_logout, [ :session ], :error
|
303
|
-
attach_function :session_connectionstate, :sp_session_connectionstate, [ :session ], :connectionstate
|
304
|
-
attach_function :session_userdata, :sp_session_userdata, [ :session ], :userdata
|
305
|
-
attach_function :session_set_cache_size, :sp_session_set_cache_size, [ :session, :size_t ], :error
|
306
|
-
attach_function :session_player_load, :sp_session_player_load, [ :session, :track ], :error
|
307
|
-
attach_function :session_player_seek, :sp_session_player_seek, [ :session, :int ], :error
|
308
|
-
attach_function :session_player_play, :sp_session_player_play, [ :session, :bool ], :error
|
309
|
-
attach_function :session_player_unload, :sp_session_player_unload, [ :session ], :error
|
310
|
-
attach_function :session_player_prefetch, :sp_session_player_prefetch, [ :session, :track ], :error
|
311
|
-
attach_function :session_playlistcontainer, :sp_session_playlistcontainer, [ :session ], :playlistcontainer
|
312
|
-
attach_function :session_inbox_create, :sp_session_inbox_create, [ :session ], :playlist
|
313
|
-
attach_function :session_starred_create, :sp_session_starred_create, [ :session ], :playlist
|
314
|
-
attach_function :session_starred_for_user_create, :sp_session_starred_for_user_create, [ :session, :utf8_string ], :playlist
|
315
|
-
attach_function :session_publishedcontainer_for_user_create, :sp_session_publishedcontainer_for_user_create, [ :playlist, :utf8_string ], :playlistcontainer
|
316
|
-
attach_function :session_preferred_bitrate, :sp_session_preferred_bitrate, [ :session, :bitrate ], :error
|
317
|
-
|
318
|
-
attach_function :session_set_connection_type, :sp_session_set_connection_type, [ :session, :connection_type ], :error
|
319
|
-
attach_function :session_set_connection_rules, :sp_session_set_connection_rules, [ :session, :connection_rules ], :error
|
320
|
-
|
321
|
-
attach_function :offline_tracks_to_sync, :sp_offline_tracks_to_sync, [ :session ], :int
|
322
|
-
attach_function :offline_num_playlists, :sp_offline_num_playlists, [ :session ], :int
|
323
|
-
attach_function :offline_sync_get_status, :sp_offline_sync_get_status, [ :session, OfflineSyncStatus ], :bool
|
324
|
-
attach_function :offline_time_left, :sp_offline_time_left, [ :session ], :int
|
325
|
-
|
326
|
-
attach_function :session_user_country, :sp_session_user_country, [ :session ], :int
|
327
|
-
attach_function :session_preferred_offline_bitrate, :sp_session_preferred_offline_bitrate, [ :session, :bitrate, :bool ], :error
|
328
|
-
|
329
|
-
attach_function :session_set_volume_normalization, :sp_session_set_volume_normalization, [ :session, :bool ], :error
|
330
|
-
attach_function :session_get_volume_normalization, :sp_session_get_volume_normalization, [ :session ], :bool
|
331
|
-
|
332
|
-
attach_function :session_flush_caches, :sp_session_flush_caches, [ :session ], :error
|
333
|
-
attach_function :session_user_name, :sp_session_user_name, [ :session ], :string
|
334
|
-
|
335
|
-
attach_function :session_set_private_session, :sp_session_set_private_session, [ :session, :bool ], :error
|
336
|
-
attach_function :session_is_private_session, :sp_session_is_private_session, [ :session ], :bool
|
337
|
-
attach_function :session_set_scrobbling, :sp_session_set_scrobbling, [ :session, :social_provider, :scrobbling_state ], :error
|
338
|
-
attach_function :session_is_scrobbling, :sp_session_is_scrobbling, [ :session, :social_provider, :buffer_out ], :error
|
339
|
-
attach_function :session_is_scrobbling_possible, :sp_session_is_scrobbling_possible, [ :session, :social_provider, :buffer_out ], :error
|
340
|
-
attach_function :session_set_social_credentials, :sp_session_set_social_credentials, [ :session, :social_provider, :utf8_string, :string ], :error
|
341
|
-
|
342
|
-
#
|
343
|
-
# Images
|
344
|
-
#
|
345
|
-
# @see http://developer.spotify.com/en/libspotify/docs/group__image.html
|
346
|
-
|
347
|
-
#
|
348
|
-
enum :imageformat, [:unknown, -1, :jpeg]
|
349
|
-
enum :image_size, [ :normal, :small, :large ]
|
350
|
-
|
351
|
-
callback :image_loaded_cb, [ :image, :userdata ], :void
|
352
|
-
attach_function :image_create, :sp_image_create, [ :session, :image_id ], :image
|
353
|
-
attach_function :image_add_load_callback, :sp_image_add_load_callback, [ :image, :image_loaded_cb, :userdata ], :error
|
354
|
-
attach_function :image_remove_load_callback, :sp_image_remove_load_callback, [ :image, :image_loaded_cb, :userdata ], :error
|
355
|
-
attach_function :image_is_loaded, :sp_image_is_loaded, [ :image ], :bool
|
356
|
-
attach_function :image_error, :sp_image_error, [ :image ], :error
|
357
|
-
attach_function :image_format, :sp_image_format, [ :image ], :imageformat
|
358
|
-
attach_function :image_data, :sp_image_data, [ :image, :buffer_out ], :pointer
|
359
|
-
attach_function :image_image_id, :sp_image_image_id, [ :image ], :image_id
|
360
|
-
attach_function :image_create_from_link, :sp_image_create_from_link, [ :session, :link ], :image
|
361
|
-
|
362
|
-
attach_function :image_add_ref, :sp_image_add_ref, [ :image ], :error
|
363
|
-
attach_function :image_release, :sp_image_release, [ :image ], :error
|
364
|
-
|
365
|
-
|
366
|
-
#
|
367
|
-
# Link
|
368
|
-
#
|
369
|
-
# @see http://developer.spotify.com/en/libspotify/docs/group__link.html
|
370
|
-
|
371
|
-
#
|
372
|
-
enum :linktype, [:invalid, :track, :album, :artist, :search,
|
373
|
-
:playlist, :profile, :starred, :localtrack, :image]
|
374
|
-
|
375
|
-
attach_function :link_create_from_string, :sp_link_create_from_string, [ :string ], :link
|
376
|
-
attach_function :link_create_from_track, :sp_link_create_from_track, [ :track, :int ], :link
|
377
|
-
attach_function :link_create_from_album, :sp_link_create_from_album, [ :album ], :link
|
378
|
-
attach_function :link_create_from_artist, :sp_link_create_from_artist, [ :artist ], :link
|
379
|
-
attach_function :link_create_from_search, :sp_link_create_from_search, [ :search ], :link
|
380
|
-
attach_function :link_create_from_playlist, :sp_link_create_from_playlist, [ :playlist ], :link
|
381
|
-
attach_function :link_create_from_artist_portrait, :sp_link_create_from_artist_portrait, [ :artist, :image_size ], :link
|
382
|
-
attach_function :link_create_from_artistbrowse_portrait, :sp_link_create_from_artistbrowse_portrait, [ :artistbrowse, :int ], :link
|
383
|
-
attach_function :link_create_from_album_cover, :sp_link_create_from_album_cover, [ :album, :image_size ], :link
|
384
|
-
attach_function :link_create_from_image, :sp_link_create_from_image, [ :image ], :link
|
385
|
-
attach_function :link_create_from_user, :sp_link_create_from_user, [ :user ], :link
|
386
|
-
attach_function :link_as_string, :sp_link_as_string, [ :link, :buffer_out, :int ], :int
|
387
|
-
attach_function :link_type, :sp_link_type, [ :link ], :linktype
|
388
|
-
attach_function :link_as_track, :sp_link_as_track, [ :link ], :track
|
389
|
-
attach_function :link_as_track_and_offset, :sp_link_as_track_and_offset, [ :link, :buffer_out ], :track
|
390
|
-
attach_function :link_as_album, :sp_link_as_album, [ :link ], :album
|
391
|
-
attach_function :link_as_artist, :sp_link_as_artist, [ :link ], :artist
|
392
|
-
attach_function :link_as_user, :sp_link_as_user, [ :link ], :user
|
393
|
-
|
394
|
-
attach_function :link_add_ref, :sp_link_add_ref, [ :link ], :error
|
395
|
-
attach_function :link_release, :sp_link_release, [ :link ], :error
|
396
|
-
|
397
|
-
#
|
398
|
-
# Tracks
|
399
|
-
#
|
400
|
-
# @see http://developer.spotify.com/en/libspotify/docs/group__track.html
|
401
|
-
|
402
|
-
enum :availability, [:unavailable, :available, :not_streamable, :banned_by_artist]
|
403
|
-
typedef :availability, :track_availability
|
404
|
-
|
405
|
-
enum :track_offline_status, [:no, :waiting, :downloading, :done, :error, :done_expired, :limit_exceeded, :done_resync]
|
406
|
-
|
407
|
-
#
|
408
|
-
attach_function :track_is_loaded, :sp_track_is_loaded, [ :track ], :bool
|
409
|
-
attach_function :track_error, :sp_track_error, [ :track ], :error
|
410
|
-
attach_function :track_get_availability, :sp_track_get_availability, [ :session, :track ], :track_availability
|
411
|
-
attach_function :track_is_local, :sp_track_is_local, [ :session, :track ], :bool
|
412
|
-
attach_function :track_is_autolinked, :sp_track_is_autolinked, [ :session, :track ], :bool
|
413
|
-
attach_function :track_is_starred, :sp_track_is_starred, [ :session, :track ], :bool
|
414
|
-
attach_function :track_set_starred, :sp_track_set_starred, [ :session, :array, :int, :bool ], :error
|
415
|
-
attach_function :track_num_artists, :sp_track_num_artists, [ :track ], :int
|
416
|
-
attach_function :track_artist, :sp_track_artist, [ :track, :int ], :artist
|
417
|
-
attach_function :track_album, :sp_track_album, [ :track ], :album
|
418
|
-
attach_function :track_name, :sp_track_name, [ :track ], :utf8_string
|
419
|
-
attach_function :track_duration, :sp_track_duration, [ :track ], :int
|
420
|
-
attach_function :track_popularity, :sp_track_popularity, [ :track ], :int
|
421
|
-
attach_function :track_disc, :sp_track_disc, [ :track ], :int
|
422
|
-
attach_function :track_index, :sp_track_index, [ :track ], :int
|
423
|
-
attach_function :track_is_placeholder, :sp_track_is_placeholder, [ :track ], :bool
|
424
|
-
attach_function :track_get_playable, :sp_track_get_playable, [ :session, :track ], :track
|
425
|
-
|
426
|
-
attach_function :track_offline_get_status, :sp_track_offline_get_status, [ :track ], :track_offline_status
|
427
|
-
|
428
|
-
attach_function :localtrack_create, :sp_localtrack_create, [ :utf8_string, :utf8_string, :utf8_string, :int ], :track
|
429
|
-
|
430
|
-
attach_function :track_add_ref, :sp_track_add_ref, [ :track ], :error
|
431
|
-
attach_function :track_release, :sp_track_release, [ :track ], :error
|
432
|
-
|
433
|
-
#
|
434
|
-
# Albums
|
435
|
-
#
|
436
|
-
# @see http://developer.spotify.com/en/libspotify/docs/group__album.html
|
437
|
-
|
438
|
-
#
|
439
|
-
enum :albumtype, [:album, :single, :compilation, :unknown]
|
440
|
-
|
441
|
-
attach_function :album_is_loaded, :sp_album_is_loaded, [ :album ], :bool
|
442
|
-
attach_function :album_is_available, :sp_album_is_available, [ :album ], :bool
|
443
|
-
attach_function :album_artist, :sp_album_artist, [ :album ], :artist
|
444
|
-
attach_function :album_cover, :sp_album_cover, [ :album, :image_size ], :image_id
|
445
|
-
attach_function :album_name, :sp_album_name, [ :album ], :utf8_string
|
446
|
-
attach_function :album_year, :sp_album_year, [ :album ], :int
|
447
|
-
attach_function :album_type, :sp_album_type, [ :album ], :albumtype
|
448
|
-
|
449
|
-
attach_function :album_add_ref, :sp_album_add_ref, [ :album ], :error
|
450
|
-
attach_function :album_release, :sp_album_release, [ :album ], :error
|
451
|
-
|
452
|
-
#
|
453
|
-
# Album Browser
|
454
|
-
#
|
455
|
-
# @see http://developer.spotify.com/en/libspotify/docs/group__albumbrowse.html
|
456
|
-
|
457
|
-
#
|
458
|
-
callback :albumbrowse_complete_cb, [:albumbrowse, :userdata], :void
|
459
|
-
attach_function :albumbrowse_create, :sp_albumbrowse_create, [ :session, :album, :albumbrowse_complete_cb, :userdata ], :albumbrowse
|
460
|
-
attach_function :albumbrowse_is_loaded, :sp_albumbrowse_is_loaded, [ :albumbrowse ], :bool
|
461
|
-
attach_function :albumbrowse_error, :sp_albumbrowse_error, [ :albumbrowse ], :error
|
462
|
-
attach_function :albumbrowse_album, :sp_albumbrowse_album, [ :albumbrowse ], :album
|
463
|
-
attach_function :albumbrowse_artist, :sp_albumbrowse_artist, [ :albumbrowse ], :artist
|
464
|
-
attach_function :albumbrowse_num_copyrights, :sp_albumbrowse_num_copyrights, [ :albumbrowse ], :int
|
465
|
-
attach_function :albumbrowse_copyright, :sp_albumbrowse_copyright, [ :albumbrowse, :int ], :utf8_string
|
466
|
-
attach_function :albumbrowse_num_tracks, :sp_albumbrowse_num_tracks, [ :albumbrowse ], :int
|
467
|
-
attach_function :albumbrowse_track, :sp_albumbrowse_track, [ :albumbrowse, :int ], :track
|
468
|
-
attach_function :albumbrowse_review, :sp_albumbrowse_review, [ :albumbrowse ], :utf8_string
|
469
|
-
attach_function :albumbrowse_backend_request_duration, :sp_albumbrowse_backend_request_duration, [ :albumbrowse ], :int
|
470
|
-
|
471
|
-
attach_function :albumbrowse_add_ref, :sp_albumbrowse_add_ref, [ :albumbrowse ], :error
|
472
|
-
attach_function :albumbrowse_release, :sp_albumbrowse_release, [ :albumbrowse ], :error
|
473
|
-
|
474
|
-
#
|
475
|
-
# Artists
|
476
|
-
#
|
477
|
-
# @see http://developer.spotify.com/en/libspotify/docs/group__artist.html
|
478
|
-
|
479
|
-
#
|
480
|
-
attach_function :artist_name, :sp_artist_name, [ :artist ], :utf8_string
|
481
|
-
attach_function :artist_is_loaded, :sp_artist_is_loaded, [ :artist ], :bool
|
482
|
-
attach_function :artist_portrait, :sp_artist_portrait, [ :artist, :image_size ], :image_id
|
483
|
-
|
484
|
-
attach_function :artist_add_ref, :sp_artist_add_ref, [ :artist ], :error
|
485
|
-
attach_function :artist_release, :sp_artist_release, [ :artist ], :error
|
486
|
-
|
487
|
-
#
|
488
|
-
# Artist Browsing
|
489
|
-
#
|
490
|
-
# @see http://developer.spotify.com/en/libspotify/docs/group__artistbrowse.html
|
491
|
-
|
492
|
-
enum :artistbrowse_type, [:full, :no_tracks, :no_albums]
|
493
|
-
|
494
|
-
#
|
495
|
-
callback :artistbrowse_complete_cb, [:artistbrowse, :userdata], :void
|
496
|
-
attach_function :artistbrowse_create, :sp_artistbrowse_create, [ :session, :artist, :artistbrowse_type, :artistbrowse_complete_cb, :userdata ], :artistbrowse
|
497
|
-
attach_function :artistbrowse_is_loaded, :sp_artistbrowse_is_loaded, [ :artistbrowse ], :bool
|
498
|
-
attach_function :artistbrowse_error, :sp_artistbrowse_error, [ :artistbrowse ], :error
|
499
|
-
attach_function :artistbrowse_artist, :sp_artistbrowse_artist, [ :artistbrowse ], :artist
|
500
|
-
attach_function :artistbrowse_num_portraits, :sp_artistbrowse_num_portraits, [ :artistbrowse ], :int
|
501
|
-
attach_function :artistbrowse_portrait, :sp_artistbrowse_portrait, [ :artistbrowse, :int ], :image_id
|
502
|
-
attach_function :artistbrowse_num_tracks, :sp_artistbrowse_num_tracks, [ :artistbrowse ], :int
|
503
|
-
attach_function :artistbrowse_track, :sp_artistbrowse_track, [ :artistbrowse, :int ], :track
|
504
|
-
attach_function :artistbrowse_num_albums, :sp_artistbrowse_num_albums, [ :artistbrowse ], :int
|
505
|
-
attach_function :artistbrowse_album, :sp_artistbrowse_album, [ :artistbrowse, :int ], :album
|
506
|
-
attach_function :artistbrowse_num_similar_artists, :sp_artistbrowse_num_similar_artists, [ :artistbrowse ], :int
|
507
|
-
attach_function :artistbrowse_similar_artist, :sp_artistbrowse_similar_artist, [ :artistbrowse, :int ], :artist
|
508
|
-
attach_function :artistbrowse_biography, :sp_artistbrowse_biography, [ :artistbrowse ], :utf8_string
|
509
|
-
attach_function :artistbrowse_backend_request_duration, :sp_artistbrowse_backend_request_duration, [ :artistbrowse ], :int
|
510
|
-
attach_function :artistbrowse_num_tophit_tracks, :sp_artistbrowse_num_tophit_tracks, [ :artistbrowse ], :int
|
511
|
-
attach_function :artistbrowse_tophit_track, :sp_artistbrowse_tophit_track, [ :artistbrowse, :int ], :track
|
512
|
-
|
513
|
-
attach_function :artistbrowse_add_ref, :sp_artistbrowse_add_ref, [ :artistbrowse ], :error
|
514
|
-
attach_function :artistbrowse_release, :sp_artistbrowse_release, [ :artistbrowse ], :error
|
515
|
-
|
516
|
-
#
|
517
|
-
# Searching
|
518
|
-
#
|
519
|
-
# @see http://developer.spotify.com/en/libspotify/docs/group__search.html
|
520
|
-
|
521
|
-
enum :search_type, [:standard, :suggest]
|
522
|
-
|
523
|
-
callback :search_complete_cb, [:search, :userdata], :void
|
524
|
-
attach_function :search_create, :sp_search_create, [ :session, :utf8_string, :int, :int, :int, :int, :int, :int, :int, :int, :search_type, :search_complete_cb, :userdata ], :search
|
525
|
-
attach_function :search_is_loaded, :sp_search_is_loaded, [ :search ], :bool
|
526
|
-
attach_function :search_error, :sp_search_error, [ :search ], :error
|
527
|
-
attach_function :search_query, :sp_search_query, [ :search ], :utf8_string
|
528
|
-
attach_function :search_did_you_mean, :sp_search_did_you_mean, [ :search ], :utf8_string
|
529
|
-
attach_function :search_num_tracks, :sp_search_num_tracks, [ :search ], :int
|
530
|
-
attach_function :search_track, :sp_search_track, [ :search, :int ], :track
|
531
|
-
attach_function :search_num_albums, :sp_search_num_albums, [ :search ], :int
|
532
|
-
attach_function :search_album, :sp_search_album, [ :search, :int ], :album
|
533
|
-
attach_function :search_num_artists, :sp_search_num_artists, [ :search ], :int
|
534
|
-
attach_function :search_artist, :sp_search_artist, [ :search, :int ], :artist
|
535
|
-
attach_function :search_num_playlists, :sp_search_num_playlists, [ :search ], :int
|
536
|
-
attach_function :search_playlist, :sp_search_playlist, [ :search, :int ], :playlist
|
537
|
-
attach_function :search_playlist_name, :sp_search_playlist_name, [ :search, :int ], :utf8_string
|
538
|
-
attach_function :search_playlist_uri, :sp_search_playlist_uri, [ :search, :int ], :utf8_string
|
539
|
-
attach_function :search_playlist_image_uri, :sp_search_playlist_image_uri, [ :search, :int ], :utf8_string
|
540
|
-
attach_function :search_total_tracks, :sp_search_total_tracks, [ :search ], :int
|
541
|
-
attach_function :search_total_albums, :sp_search_total_albums, [ :search ], :int
|
542
|
-
attach_function :search_total_artists, :sp_search_total_artists, [ :search ], :int
|
543
|
-
attach_function :search_total_playlists, :sp_search_total_playlists, [ :search ], :int
|
544
|
-
|
545
|
-
attach_function :search_add_ref, :sp_search_add_ref, [ :search ], :error
|
546
|
-
attach_function :search_release, :sp_search_release, [ :search ], :error
|
547
|
-
|
548
|
-
#
|
549
|
-
# Playlists
|
550
|
-
#
|
551
|
-
# @see http://developer.spotify.com/en/libspotify/docs/group__playlist.html
|
552
|
-
|
553
|
-
# FFI::Struct for Playlist callbacks.
|
554
|
-
#
|
555
|
-
# @attr [callback(:playlist, :array, :int, :int, :userdata):void] tracks_added
|
556
|
-
# @attr [callback(:playlist, :array, :int, :userdata):void] tracks_removed
|
557
|
-
# @attr [callback(:playlist, :array, :int, :int, :userdata):void] tracks_moved
|
558
|
-
# @attr [callback(:playlist, :userdata):void] playlist_renamed
|
559
|
-
# @attr [callback(:playlist, :userdata):void] playlist_state_changed
|
560
|
-
# @attr [callback(:playlist, :bool, :userdata):void] playlist_update_in_progress
|
561
|
-
# @attr [callback(:playlist, :userdata):void] playlist_metadata_updated
|
562
|
-
# @attr [callback(:playlist, :int, :user, :int, :userdata):void] track_created_changed
|
563
|
-
# @attr [callback(:playlist, :int, :bool, :userdata):void] track_seen_changed
|
564
|
-
# @attr [callback(:playlist, :utf8_string, :userdata):void] description_changed
|
565
|
-
# @attr [callback(:playlist, :image_id, :userdata):void] image_changed
|
566
|
-
# @attr [callback(:playlist, :int, :utf8_string, :userdata):void] track_message_changed
|
567
|
-
# @attr [callback(:playlist, :userdata):void] subscribers_changed
|
568
|
-
class PlaylistCallbacks < FFI::Struct
|
569
|
-
layout :tracks_added => callback([ :playlist, :array, :int, :int, :userdata ], :void),
|
570
|
-
:tracks_removed => callback([ :playlist, :array, :int, :userdata ], :void),
|
571
|
-
:tracks_moved => callback([ :playlist, :array, :int, :int, :userdata ], :void),
|
572
|
-
:playlist_renamed => callback([ :playlist, :userdata ], :void),
|
573
|
-
:playlist_state_changed => callback([ :playlist, :userdata ], :void),
|
574
|
-
:playlist_update_in_progress => callback([ :playlist, :bool, :userdata ], :void),
|
575
|
-
:playlist_metadata_updated => callback([ :playlist, :userdata ], :void),
|
576
|
-
:track_created_changed => callback([ :playlist, :int, :user, :int, :userdata ], :void),
|
577
|
-
:track_seen_changed => callback([ :playlist, :int, :bool, :userdata ], :void),
|
578
|
-
:description_changed => callback([ :playlist, :utf8_string, :userdata ], :void),
|
579
|
-
:image_changed => callback([ :playlist, :image_id, :userdata ], :void),
|
580
|
-
:track_message_changed => callback([ :playlist, :int, :utf8_string, :userdata ], :void),
|
581
|
-
:subscribers_changed => callback([ :playlist, :userdata ], :void)
|
582
|
-
end
|
583
|
-
|
584
|
-
# FFI::Struct for Subscribers of a Playlist.
|
585
|
-
#
|
586
|
-
# @attr [Fixnum] count
|
587
|
-
# @attr [Array<Pointer<String>>] subscribers
|
588
|
-
class Subscribers < FFI::Struct
|
589
|
-
layout :count => :uint,
|
590
|
-
:subscribers => [:pointer, 1] # array of pointers to strings
|
591
|
-
|
592
|
-
# Redefined, as the layout of the Struct can only be determined
|
593
|
-
# at run-time.
|
594
|
-
#
|
595
|
-
# @param [FFI::Pointer] pointer
|
596
|
-
def initialize(pointer)
|
597
|
-
count = pointer.read_uint
|
598
|
-
|
599
|
-
layout = [:count, :uint]
|
600
|
-
layout += [:subscribers, [:pointer, count]] if count > 0
|
601
|
-
|
602
|
-
super(pointer, *layout)
|
603
|
-
end
|
604
|
-
end
|
605
|
-
|
606
|
-
#
|
607
|
-
enum :playlist_type, [:playlist, :start_folder, :end_folder, :placeholder]
|
608
|
-
|
609
|
-
#
|
610
|
-
enum :playlist_offline_status, [:no, :yes, :downloading, :waiting]
|
611
|
-
|
612
|
-
attach_function :playlist_is_loaded, :sp_playlist_is_loaded, [ :playlist ], :bool
|
613
|
-
attach_function :playlist_add_callbacks, :sp_playlist_add_callbacks, [ :playlist, PlaylistCallbacks, :userdata ], :error
|
614
|
-
attach_function :playlist_remove_callbacks, :sp_playlist_remove_callbacks, [ :playlist, PlaylistCallbacks, :userdata ], :error
|
615
|
-
attach_function :playlist_num_tracks, :sp_playlist_num_tracks, [ :playlist ], :int
|
616
|
-
attach_function :playlist_track, :sp_playlist_track, [ :playlist, :int ], :track
|
617
|
-
attach_function :playlist_track_create_time, :sp_playlist_track_create_time, [ :playlist, :int ], :int
|
618
|
-
attach_function :playlist_track_creator, :sp_playlist_track_creator, [ :playlist, :int ], :user
|
619
|
-
attach_function :playlist_track_seen, :sp_playlist_track_seen, [ :playlist, :int ], :bool
|
620
|
-
attach_function :playlist_track_set_seen, :sp_playlist_track_set_seen, [ :playlist, :int, :bool ], :error
|
621
|
-
attach_function :playlist_track_message, :sp_playlist_track_message, [ :playlist, :int ], :utf8_string
|
622
|
-
attach_function :playlist_name, :sp_playlist_name, [ :playlist ], :utf8_string
|
623
|
-
attach_function :playlist_rename, :sp_playlist_rename, [ :playlist, :utf8_string ], :error
|
624
|
-
attach_function :playlist_owner, :sp_playlist_owner, [ :playlist ], :user
|
625
|
-
attach_function :playlist_is_collaborative, :sp_playlist_is_collaborative, [ :playlist ], :bool
|
626
|
-
attach_function :playlist_set_collaborative, :sp_playlist_set_collaborative, [ :playlist, :bool ], :error
|
627
|
-
attach_function :playlist_set_autolink_tracks, :sp_playlist_set_autolink_tracks, [ :playlist, :bool ], :error
|
628
|
-
attach_function :playlist_get_description, :sp_playlist_get_description, [ :playlist ], :utf8_string
|
629
|
-
attach_function :playlist_get_image, :sp_playlist_get_image, [ :playlist, :buffer_out ], :bool
|
630
|
-
attach_function :playlist_has_pending_changes, :sp_playlist_has_pending_changes, [ :playlist ], :bool
|
631
|
-
attach_function :playlist_add_tracks, :sp_playlist_add_tracks, [ :playlist, :array, :int, :int, :session ], :error
|
632
|
-
attach_function :playlist_remove_tracks, :sp_playlist_remove_tracks, [ :playlist, :array, :int ], :error
|
633
|
-
attach_function :playlist_reorder_tracks, :sp_playlist_reorder_tracks, [ :playlist, :array, :int, :int ], :error
|
634
|
-
attach_function :playlist_num_subscribers, :sp_playlist_num_subscribers, [ :playlist ], :uint
|
635
|
-
attach_function :playlist_subscribers, :sp_playlist_subscribers, [ :playlist ], Subscribers
|
636
|
-
attach_function :playlist_subscribers_free, :sp_playlist_subscribers_free, [ Subscribers ], :error
|
637
|
-
attach_function :playlist_update_subscribers, :sp_playlist_update_subscribers, [ :session, :playlist ], :error
|
638
|
-
attach_function :playlist_is_in_ram, :sp_playlist_is_in_ram, [ :session, :playlist ], :bool
|
639
|
-
attach_function :playlist_set_in_ram, :sp_playlist_set_in_ram, [ :session, :playlist, :bool ], :error
|
640
|
-
attach_function :playlist_create, :sp_playlist_create, [ :session, :link ], :playlist
|
641
|
-
attach_function :playlist_get_offline_status, :sp_playlist_get_offline_status, [ :session, :playlist ], :playlist_offline_status
|
642
|
-
attach_function :playlist_get_offline_download_completed, :sp_playlist_get_offline_download_completed, [ :session, :playlist ], :int
|
643
|
-
attach_function :playlist_set_offline_mode, :sp_playlist_set_offline_mode, [ :session, :playlist, :bool ], :error
|
644
|
-
|
645
|
-
attach_function :playlist_add_ref, :sp_playlist_add_ref, [ :playlist ], :error
|
646
|
-
attach_function :playlist_release, :sp_playlist_release, [ :playlist ], :error
|
647
|
-
|
648
|
-
#
|
649
|
-
# Playlist Container
|
650
|
-
#
|
651
|
-
|
652
|
-
# FFI::Struct for the PlaylistContainer.
|
653
|
-
#
|
654
|
-
# @attr [callback(:playlistcontainer, :playlist, :int, :userdata):void] playlist_added
|
655
|
-
# @attr [callback(:playlistcontainer, :playlist, :int, :userdata):void] playlist_removed
|
656
|
-
# @attr [callback(:playlistcontainer, :playlist, :int, :int, :userdata):void] playlist_moved
|
657
|
-
# @attr [callback(:playlistcontainer, :userdata):void] container_loaded
|
658
|
-
class PlaylistContainerCallbacks < FFI::Struct
|
659
|
-
layout :playlist_added, callback([ :playlistcontainer, :playlist, :int, :userdata ], :void),
|
660
|
-
:playlist_removed, callback([ :playlistcontainer, :playlist, :int, :userdata ], :void),
|
661
|
-
:playlist_moved, callback([ :playlistcontainer, :playlist, :int, :int, :userdata ], :void),
|
662
|
-
:container_loaded, callback([ :playlistcontainer, :userdata ], :void)
|
663
|
-
end
|
664
|
-
|
665
|
-
#
|
666
|
-
attach_function :playlistcontainer_add_callbacks, :sp_playlistcontainer_add_callbacks, [ :playlistcontainer, PlaylistContainerCallbacks, :userdata ], :error
|
667
|
-
attach_function :playlistcontainer_remove_callbacks, :sp_playlistcontainer_remove_callbacks, [ :playlistcontainer, PlaylistContainerCallbacks, :userdata ], :error
|
668
|
-
attach_function :playlistcontainer_num_playlists, :sp_playlistcontainer_num_playlists, [ :playlistcontainer ], :int
|
669
|
-
attach_function :playlistcontainer_playlist, :sp_playlistcontainer_playlist, [ :playlistcontainer, :int ], :playlist
|
670
|
-
attach_function :playlistcontainer_playlist_type, :sp_playlistcontainer_playlist_type, [ :playlistcontainer, :int ], :playlist_type
|
671
|
-
attach_function :playlistcontainer_playlist_folder_name, :sp_playlistcontainer_playlist_folder_name, [ :playlistcontainer, :int, :buffer_out, :int ], :error
|
672
|
-
attach_function :playlistcontainer_playlist_folder_id, :sp_playlistcontainer_playlist_folder_id, [ :playlistcontainer, :int ], :uint64
|
673
|
-
attach_function :playlistcontainer_add_new_playlist, :sp_playlistcontainer_add_new_playlist, [ :playlistcontainer, :utf8_string ], :playlist
|
674
|
-
attach_function :playlistcontainer_add_playlist, :sp_playlistcontainer_add_playlist, [ :playlistcontainer, :link ], :playlist
|
675
|
-
attach_function :playlistcontainer_remove_playlist, :sp_playlistcontainer_remove_playlist, [ :playlistcontainer, :int ], :error
|
676
|
-
attach_function :playlistcontainer_move_playlist, :sp_playlistcontainer_move_playlist, [ :playlistcontainer, :int, :int, :bool ], :error
|
677
|
-
attach_function :playlistcontainer_add_folder, :sp_playlistcontainer_add_folder, [ :playlistcontainer, :int, :utf8_string ], :error
|
678
|
-
attach_function :playlistcontainer_owner, :sp_playlistcontainer_owner, [ :playlistcontainer ], :user
|
679
|
-
attach_function :playlistcontainer_is_loaded, :sp_playlistcontainer_is_loaded, [ :playlistcontainer ], :bool
|
680
|
-
|
681
|
-
attach_function :playlistcontainer_get_unseen_tracks, :sp_playlistcontainer_get_unseen_tracks, [ :playlistcontainer, :playlist, :array, :int ], :int
|
682
|
-
attach_function :playlistcontainer_clear_unseen_tracks, :sp_playlistcontainer_clear_unseen_tracks, [ :playlistcontainer, :playlist ], :int
|
683
|
-
|
684
|
-
attach_function :playlistcontainer_add_ref, :sp_playlistcontainer_add_ref, [ :playlistcontainer ], :error
|
685
|
-
attach_function :playlistcontainer_release, :sp_playlistcontainer_release, [ :playlistcontainer ], :error
|
686
|
-
|
687
|
-
#
|
688
|
-
# User handling
|
689
|
-
#
|
690
|
-
# @see http://developer.spotify.com/en/libspotify/docs/group__user.html
|
691
|
-
|
692
|
-
#
|
693
|
-
enum :relation_type, [:unknown, :none, :unidirectional, :bidirectional]
|
694
|
-
|
695
|
-
attach_function :user_canonical_name, :sp_user_canonical_name, [ :user ], :utf8_string
|
696
|
-
attach_function :user_display_name, :sp_user_display_name, [ :user ], :utf8_string
|
697
|
-
attach_function :user_is_loaded, :sp_user_is_loaded, [ :user ], :bool
|
698
|
-
|
699
|
-
attach_function :user_add_ref, :sp_user_add_ref, [ :user ], :error
|
700
|
-
attach_function :user_release, :sp_user_release, [ :user ], :error
|
701
|
-
|
702
|
-
#
|
703
|
-
# Toplists
|
704
|
-
#
|
705
|
-
# @see http://developer.spotify.com/en/libspotify/docs/group__toplist.html
|
706
|
-
|
707
|
-
#
|
708
|
-
enum :toplisttype, [:artists, :albums, :tracks]
|
709
|
-
enum :toplistregion, [:everywhere, :user]
|
710
|
-
|
711
|
-
callback :toplistbrowse_complete_cb, [:toplistbrowse, :userdata], :void
|
712
|
-
attach_function :toplistbrowse_create, :sp_toplistbrowse_create, [ :session, :toplisttype, :toplistregion, :utf8_string, :toplistbrowse_complete_cb, :userdata ], :toplistbrowse
|
713
|
-
attach_function :toplistbrowse_is_loaded, :sp_toplistbrowse_is_loaded, [ :toplistbrowse ], :bool
|
714
|
-
attach_function :toplistbrowse_error, :sp_toplistbrowse_error, [ :toplistbrowse ], :error
|
715
|
-
attach_function :toplistbrowse_num_artists, :sp_toplistbrowse_num_artists, [ :toplistbrowse ], :int
|
716
|
-
attach_function :toplistbrowse_artist, :sp_toplistbrowse_artist, [ :toplistbrowse, :int ], :artist
|
717
|
-
attach_function :toplistbrowse_num_albums, :sp_toplistbrowse_num_albums, [ :toplistbrowse ], :int
|
718
|
-
attach_function :toplistbrowse_album, :sp_toplistbrowse_album, [ :toplistbrowse, :int ], :album
|
719
|
-
attach_function :toplistbrowse_num_tracks, :sp_toplistbrowse_num_tracks, [ :toplistbrowse ], :int
|
720
|
-
attach_function :toplistbrowse_track, :sp_toplistbrowse_track, [ :toplistbrowse, :int ], :track
|
721
|
-
attach_function :toplistbrowse_backend_request_duration, :sp_toplistbrowse_backend_request_duration, [ :toplistbrowse ], :int
|
722
|
-
|
723
|
-
attach_function :toplistbrowse_add_ref, :sp_toplistbrowse_add_ref, [ :toplistbrowse ], :error
|
724
|
-
attach_function :toplistbrowse_release, :sp_toplistbrowse_release, [ :toplistbrowse ], :error
|
725
|
-
|
726
|
-
#
|
727
|
-
# Inbox
|
728
|
-
#
|
729
|
-
# @see http://developer.spotify.com/en/libspotify/docs/group__inbox.html
|
730
|
-
|
731
|
-
#
|
732
|
-
callback :inboxpost_complete_cb, [:inbox, :userdata], :void
|
733
|
-
attach_function :inbox_post_tracks, :sp_inbox_post_tracks, [ :session, :utf8_string, :array, :int, :utf8_string, :inboxpost_complete_cb, :userdata ], :inbox
|
734
|
-
attach_function :inbox_error, :sp_inbox_error, [ :inbox ], :error
|
735
|
-
|
736
|
-
attach_function :inbox_add_ref, :sp_inbox_add_ref, [ :inbox ], :error
|
737
|
-
attach_function :inbox_release, :sp_inbox_release, [ :inbox ], :error
|
738
|
-
|
739
|
-
# Rescue errors thrown when binding to a method that does not exist. Often
|
740
|
-
# this is because of the user using an old version of libspotify, or a new
|
741
|
-
# one. Either way it’s incompatible.
|
742
|
-
rescue FFI::NotFoundError => e
|
743
|
-
puts "An error was thrown when binding to the libspotify C functions. Please
|
744
|
-
make sure you are using an up-to-date libspotify version, compatible with
|
745
|
-
the current version of the Spotify gem.
|
746
|
-
|
747
|
-
Compatible versions of libspotify should be #{API_VERSION}.x.x
|
748
|
-
|
749
|
-
If it still does not work, see the CHANGELOG for information about which
|
750
|
-
libspotify version the gem was last updated to work with on GitHub:
|
751
|
-
https://github.com/Burgestrand/libspotify-ruby/blob/master/CHANGELOG.md
|
752
|
-
".gsub(/^ +/, "")
|
753
|
-
|
754
|
-
raise
|
755
|
-
end
|