spotify 0.0.0 → 7.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +19 -0
- data/README.markdown +25 -0
- data/Rakefile +11 -1
- data/lib/spotify.rb +470 -1
- data/lib/spotify/version.rb +1 -1
- data/spec/api.h +3096 -0
- data/spec/spotify_spec.rb +120 -0
- data/spotify.gemspec +4 -1
- metadata +43 -5
data/LICENSE
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (c) 2011 Kim Burgestrand <kim@burgestrand.se>
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
THE SOFTWARE.
|
data/README.markdown
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
libspotify FFI bindings for Ruby
|
2
|
+
================================
|
3
|
+
[libspotify](http://developer.spotify.com/en/libspotify/overview/) is a C library which allows developers to interact with the Spotify music streaming service. I wanted to be able to use this library in Ruby, and thus [Hallon](https://github.com/Burgestrand/Hallon) was born. Hallon, however, is more than just bindings to libspotify, it’s my attempt to make the API a joy to use. This is Ruby, after all!
|
4
|
+
|
5
|
+
Hallon recently changed from being a C extension to using [Ruby FFI](https://github.com/ffi/ffi), and in the process I created libspotify for Ruby. I decided to extract that work into its’ own gem, and here it is.
|
6
|
+
|
7
|
+
This is a very primitive library!
|
8
|
+
---------------------------------
|
9
|
+
There is no sugar-coating. When (if) you use this library you will practically be writing C, handling pointers and so on; only you’ll be doing it in Ruby.
|
10
|
+
|
11
|
+
If you want a library that is easier to use, have a look at [Hallon](https://github.com/Burgestrand/Hallon).
|
12
|
+
|
13
|
+
A note about versioning scheme
|
14
|
+
------------------------------
|
15
|
+
Given a version `X.Y.Z`, each segment corresponds to:
|
16
|
+
|
17
|
+
- X reflects supported libspotify version (0.0.7 => 7)
|
18
|
+
- Y is increased **only** on non-backwards-compatible bug fixes or feature additions
|
19
|
+
- Z is increased on backwards-compatible bug fixes or feature additions
|
20
|
+
|
21
|
+
When X increases (support for new libspotify versions) there are **no guarantees** of backwards-compatibility.
|
22
|
+
|
23
|
+
License
|
24
|
+
-------
|
25
|
+
X11 license, see the LICENSE document for details.
|
data/Rakefile
CHANGED
@@ -1,3 +1,13 @@
|
|
1
1
|
require 'bundler'
|
2
|
+
Bundler::GemHelper.install_tasks
|
2
3
|
|
3
|
-
|
4
|
+
require 'rake/testtask'
|
5
|
+
Rake::TestTask.new do |spec|
|
6
|
+
spec.pattern = 'spec/*_spec.rb'
|
7
|
+
end
|
8
|
+
|
9
|
+
require 'yard'
|
10
|
+
YARD::Rake::YardocTask.new
|
11
|
+
|
12
|
+
task :spec => :test
|
13
|
+
task :default => :test
|
data/lib/spotify.rb
CHANGED
@@ -1,7 +1,476 @@
|
|
1
|
+
# coding: utf-8
|
1
2
|
require 'ffi'
|
2
|
-
|
3
3
|
require 'spotify/version'
|
4
4
|
|
5
|
+
# FFI wrapper around libspotify.
|
6
|
+
#
|
7
|
+
# See official documentation for more detailed documentation about
|
8
|
+
# functions and their behavior.
|
9
|
+
#
|
10
|
+
# @see http://developer.spotify.com/en/libspotify/docs/
|
5
11
|
module Spotify
|
12
|
+
extend FFI::Library
|
13
|
+
ffi_lib ['libspotify', '/Library/Frameworks/libspotify.framework/libspotify']
|
14
|
+
|
15
|
+
# libspotify API version
|
16
|
+
# @return [Fixnum]
|
17
|
+
API_VERSION = VERSION.split('.').first.to_i
|
18
|
+
|
19
|
+
#
|
20
|
+
# Error
|
21
|
+
#
|
22
|
+
# @see http://developer.spotify.com/en/libspotify/docs/group__error.html
|
23
|
+
enum :error, [:ok, :bad_api_version, :api_initialization_failed,
|
24
|
+
:track_not_playable, :resource_not_loaded,
|
25
|
+
:bad_application_key, :bad_username_or_password,
|
26
|
+
:user_banned, :unable_to_contact_server,
|
27
|
+
:client_too_old, :other_permanent, :bad_user_agent,
|
28
|
+
:missing_callback, :invalid_indata,
|
29
|
+
:index_out_of_range, :user_needs_premium,
|
30
|
+
:other_transient, :is_loading, :no_stream_available,
|
31
|
+
:permission_denied, :inbox_is_full, :no_cache,
|
32
|
+
:no_such_user]
|
33
|
+
|
34
|
+
attach_function :error_message, :sp_error_message, [ :error ], :string
|
35
|
+
|
36
|
+
#
|
37
|
+
# Audio
|
38
|
+
#
|
39
|
+
# @see http://developer.spotify.com/en/libspotify/docs/group__session.html
|
40
|
+
enum :sampletype, [:int16_native_endian]
|
41
|
+
enum :bitrate, %w(160k 320k)
|
42
|
+
|
43
|
+
# FFI::Struct for Audio Format.
|
44
|
+
#
|
45
|
+
# @attr [:sampletype] sample_type
|
46
|
+
# @attr [Fixnum] sample_rate
|
47
|
+
# @attr [Fixnum] channels
|
48
|
+
class AudioFormat < FFI::Struct
|
49
|
+
layout :sample_type => :sampletype,
|
50
|
+
:sample_rate => :int,
|
51
|
+
:channels => :int
|
52
|
+
end
|
53
|
+
|
54
|
+
# FFI::Struct for Audio Buffer Stats.
|
55
|
+
#
|
56
|
+
# @attr [Fixnum] samples
|
57
|
+
# @attr [Fixnum] stutter
|
58
|
+
class AudioBufferStats < FFI::Struct
|
59
|
+
layout :samples => :int,
|
60
|
+
:stutter => :int
|
61
|
+
end
|
62
|
+
|
63
|
+
#
|
64
|
+
# Session
|
65
|
+
#
|
66
|
+
# @see http://developer.spotify.com/en/libspotify/docs/group__session.html
|
67
|
+
enum :connectionstate, [:logged_out, :logged_in, :disconnected, :undefined]
|
68
|
+
|
69
|
+
attach_function :session_create, :sp_session_create, [ :pointer, :pointer ], :error
|
70
|
+
attach_function :session_release, :sp_session_release, [ :pointer ], :void
|
71
|
+
attach_function :session_login, :sp_session_login, [ :pointer, :string, :string ], :void
|
72
|
+
attach_function :session_user, :sp_session_user, [ :pointer ], :pointer
|
73
|
+
attach_function :session_logout, :sp_session_logout, [ :pointer ], :void
|
74
|
+
attach_function :session_connectionstate, :sp_session_connectionstate, [ :pointer ], :connectionstate
|
75
|
+
attach_function :session_userdata, :sp_session_userdata, [ :pointer ], :pointer
|
76
|
+
attach_function :session_set_cache_size, :sp_session_set_cache_size, [ :pointer, :size_t ], :void
|
77
|
+
attach_function :session_process_events, :sp_session_process_events, [ :pointer, :pointer ], :void
|
78
|
+
attach_function :session_player_load, :sp_session_player_load, [ :pointer, :pointer ], :error
|
79
|
+
attach_function :session_player_seek, :sp_session_player_seek, [ :pointer, :int ], :void
|
80
|
+
attach_function :session_player_play, :sp_session_player_play, [ :pointer, :bool ], :void
|
81
|
+
attach_function :session_player_unload, :sp_session_player_unload, [ :pointer ], :void
|
82
|
+
attach_function :session_player_prefetch, :sp_session_player_prefetch, [ :pointer, :pointer ], :error
|
83
|
+
attach_function :session_playlistcontainer, :sp_session_playlistcontainer, [ :pointer ], :pointer
|
84
|
+
attach_function :session_inbox_create, :sp_session_inbox_create, [ :pointer ], :pointer
|
85
|
+
attach_function :session_starred_create, :sp_session_starred_create, [ :pointer ], :pointer
|
86
|
+
attach_function :session_starred_for_user_create, :sp_session_starred_for_user_create, [ :pointer, :string ], :pointer
|
87
|
+
attach_function :session_publishedcontainer_for_user_create, :sp_session_publishedcontainer_for_user_create, [ :pointer, :string ], :pointer
|
88
|
+
attach_function :session_preferred_bitrate, :sp_session_preferred_bitrate, [ :pointer, :bitrate ], :void
|
89
|
+
attach_function :session_num_friends, :sp_session_num_friends, [ :pointer ], :int
|
90
|
+
attach_function :session_friend, :sp_session_friend, [ :pointer, :int ], :pointer
|
91
|
+
|
92
|
+
# FFI::Struct for Session callbacks.
|
93
|
+
#
|
94
|
+
# @attr [callback(:pointer, :error):void] logged_in
|
95
|
+
# @attr [callback(:pointer):void] logged_out
|
96
|
+
# @attr [callback(:pointer):void] metadata_updated
|
97
|
+
# @attr [callback(:pointer, :error):void] connection_error
|
98
|
+
# @attr [callback(:pointer, :string):void] message_to_user
|
99
|
+
# @attr [callback(:pointer):void] notify_main_thread
|
100
|
+
# @attr [callback(:pointer, :pointer, :pointer, :int):int] music_delivery
|
101
|
+
# @attr [callback(:pointer):void] play_token_lost
|
102
|
+
# @attr [callback(:pointer, :string):void] log_message
|
103
|
+
# @attr [callback(:pointer):void] end_of_track
|
104
|
+
# @attr [callback(:pointer, :error):void] streaming_error
|
105
|
+
# @attr [callback(:pointer):void] userinfo_updated
|
106
|
+
# @attr [callback(:pointer):void] start_playback
|
107
|
+
# @attr [callback(:pointer):void] stop_playback
|
108
|
+
# @attr [callback(:pointer, :pointer):void] get_audio_buffer_stats
|
109
|
+
class SessionCallbacks < FFI::Struct
|
110
|
+
layout :logged_in => callback([ :pointer, :error ], :void),
|
111
|
+
:logged_out => callback([ :pointer ], :void),
|
112
|
+
:metadata_updated => callback([ :pointer ], :void),
|
113
|
+
:connection_error => callback([ :pointer, :error ], :void),
|
114
|
+
:message_to_user => callback([ :pointer, :string ], :void),
|
115
|
+
:notify_main_thread => callback([ :pointer ], :void),
|
116
|
+
:music_delivery => callback([ :pointer, :pointer, :pointer, :int ], :int),
|
117
|
+
:play_token_lost => callback([ :pointer ], :void),
|
118
|
+
:log_message => callback([ :pointer, :string ], :void),
|
119
|
+
:end_of_track => callback([ :pointer ], :void),
|
120
|
+
:streaming_error => callback([ :pointer, :error ], :void),
|
121
|
+
:userinfo_updated => callback([ :pointer ], :void),
|
122
|
+
:start_playback => callback([ :pointer ], :void),
|
123
|
+
:stop_playback => callback([ :pointer ], :void),
|
124
|
+
:get_audio_buffer_stats => callback([ :pointer, :pointer ], :void)
|
125
|
+
end
|
126
|
+
|
127
|
+
# FFI::Struct for Session configuration.
|
128
|
+
#
|
129
|
+
# @attr [Fixnum] api_version
|
130
|
+
# @attr [Pointer] cache_location
|
131
|
+
# @attr [Pointer] settings_location
|
132
|
+
# @attr [size_t] application_key_size
|
133
|
+
# @attr [Pointer] user_agent
|
134
|
+
# @attr [Pointer] callbacks
|
135
|
+
# @attr [Pointer] userdata
|
136
|
+
# @attr [Fixnum] dont_save_metadata_for_playlists
|
137
|
+
# @attr [Fixnum] initially_unload_playlists
|
138
|
+
class SessionConfig < FFI::Struct
|
139
|
+
layout :api_version => :int,
|
140
|
+
:cache_location => :pointer,
|
141
|
+
:settings_location => :pointer,
|
142
|
+
:application_key => :pointer,
|
143
|
+
:application_key_size => :size_t,
|
144
|
+
:user_agent => :pointer,
|
145
|
+
:callbacks => :pointer,
|
146
|
+
:userdata => :pointer,
|
147
|
+
:compress_playlists => :int,
|
148
|
+
:dont_save_metadata_for_playlists => :int,
|
149
|
+
:initially_unload_playlists => :int
|
150
|
+
end
|
151
|
+
|
152
|
+
#
|
153
|
+
# Link
|
154
|
+
#
|
155
|
+
# @see http://developer.spotify.com/en/libspotify/docs/group__link.html
|
156
|
+
enum :linktype, [:invalid, :track, :album, :artist, :search,
|
157
|
+
:playlist, :profile, :starred, :localtrack]
|
158
|
+
|
159
|
+
attach_function :link_create_from_string, :sp_link_create_from_string, [ :string ], :pointer
|
160
|
+
attach_function :link_create_from_track, :sp_link_create_from_track, [ :pointer, :int ], :pointer
|
161
|
+
attach_function :link_create_from_album, :sp_link_create_from_album, [ :pointer ], :pointer
|
162
|
+
attach_function :link_create_from_artist, :sp_link_create_from_artist, [ :pointer ], :pointer
|
163
|
+
attach_function :link_create_from_search, :sp_link_create_from_search, [ :pointer ], :pointer
|
164
|
+
attach_function :link_create_from_playlist, :sp_link_create_from_playlist, [ :pointer ], :pointer
|
165
|
+
attach_function :link_create_from_user, :sp_link_create_from_user, [ :pointer ], :pointer
|
166
|
+
attach_function :link_as_string, :sp_link_as_string, [ :pointer, :buffer_out, :int ], :int
|
167
|
+
attach_function :link_type, :sp_link_type, [ :pointer ], :linktype
|
168
|
+
attach_function :link_as_track, :sp_link_as_track, [ :pointer ], :pointer
|
169
|
+
attach_function :link_as_track_and_offset, :sp_link_as_track_and_offset, [ :pointer, :pointer ], :pointer
|
170
|
+
attach_function :link_as_album, :sp_link_as_album, [ :pointer ], :pointer
|
171
|
+
attach_function :link_as_artist, :sp_link_as_artist, [ :pointer ], :pointer
|
172
|
+
attach_function :link_as_user, :sp_link_as_user, [ :pointer ], :pointer
|
173
|
+
attach_function :link_add_ref, :sp_link_add_ref, [ :pointer ], :void
|
174
|
+
attach_function :link_release, :sp_link_release, [ :pointer ], :void
|
175
|
+
|
176
|
+
#
|
177
|
+
# Tracks
|
178
|
+
#
|
179
|
+
# @see http://developer.spotify.com/en/libspotify/docs/group__track.html
|
180
|
+
attach_function :track_is_loaded, :sp_track_is_loaded, [ :pointer ], :bool
|
181
|
+
attach_function :track_error, :sp_track_error, [ :pointer ], :error
|
182
|
+
attach_function :track_is_available, :sp_track_is_available, [ :pointer, :pointer ], :bool
|
183
|
+
attach_function :track_is_local, :sp_track_is_local, [ :pointer, :pointer ], :bool
|
184
|
+
attach_function :track_is_autolinked, :sp_track_is_autolinked, [ :pointer, :pointer ], :bool
|
185
|
+
attach_function :track_is_starred, :sp_track_is_starred, [ :pointer, :pointer ], :bool
|
186
|
+
attach_function :track_set_starred, :sp_track_set_starred, [ :pointer, :pointer, :int, :bool ], :void
|
187
|
+
attach_function :track_num_artists, :sp_track_num_artists, [ :pointer ], :int
|
188
|
+
attach_function :track_artist, :sp_track_artist, [ :pointer, :int ], :pointer
|
189
|
+
attach_function :track_album, :sp_track_album, [ :pointer ], :pointer
|
190
|
+
attach_function :track_name, :sp_track_name, [ :pointer ], :string
|
191
|
+
attach_function :track_duration, :sp_track_duration, [ :pointer ], :int
|
192
|
+
attach_function :track_popularity, :sp_track_popularity, [ :pointer ], :int
|
193
|
+
attach_function :track_disc, :sp_track_disc, [ :pointer ], :int
|
194
|
+
attach_function :track_index, :sp_track_index, [ :pointer ], :int
|
195
|
+
attach_function :localtrack_create, :sp_localtrack_create, [ :string, :string, :string, :int ], :pointer
|
196
|
+
attach_function :track_add_ref, :sp_track_add_ref, [ :pointer ], :void
|
197
|
+
attach_function :track_release, :sp_track_release, [ :pointer ], :void
|
198
|
+
|
199
|
+
#
|
200
|
+
# Albums
|
201
|
+
#
|
202
|
+
# @see http://developer.spotify.com/en/libspotify/docs/group__album.html
|
203
|
+
enum :albumtype, [:album, :single, :compilation, :unknown]
|
204
|
+
|
205
|
+
attach_function :album_is_loaded, :sp_album_is_loaded, [ :pointer ], :bool
|
206
|
+
attach_function :album_is_available, :sp_album_is_available, [ :pointer ], :bool
|
207
|
+
attach_function :album_artist, :sp_album_artist, [ :pointer ], :pointer
|
208
|
+
attach_function :album_cover, :sp_album_cover, [ :pointer ], :pointer
|
209
|
+
attach_function :album_name, :sp_album_name, [ :pointer ], :string
|
210
|
+
attach_function :album_year, :sp_album_year, [ :pointer ], :int
|
211
|
+
attach_function :album_type, :sp_album_type, [ :pointer ], :albumtype
|
212
|
+
attach_function :album_add_ref, :sp_album_add_ref, [ :pointer ], :void
|
213
|
+
attach_function :album_release, :sp_album_release, [ :pointer ], :void
|
214
|
+
|
215
|
+
#
|
216
|
+
# Album Browser
|
217
|
+
#
|
218
|
+
# @see http://developer.spotify.com/en/libspotify/docs/group__albumbrowse.html
|
219
|
+
attach_function :albumbrowse_create, :sp_albumbrowse_create, [ :pointer, :pointer, callback([:pointer, :pointer], :void), :pointer ], :pointer
|
220
|
+
attach_function :albumbrowse_is_loaded, :sp_albumbrowse_is_loaded, [ :pointer ], :bool
|
221
|
+
attach_function :albumbrowse_error, :sp_albumbrowse_error, [ :pointer ], :error
|
222
|
+
attach_function :albumbrowse_album, :sp_albumbrowse_album, [ :pointer ], :pointer
|
223
|
+
attach_function :albumbrowse_artist, :sp_albumbrowse_artist, [ :pointer ], :pointer
|
224
|
+
attach_function :albumbrowse_num_copyrights, :sp_albumbrowse_num_copyrights, [ :pointer ], :int
|
225
|
+
attach_function :albumbrowse_copyright, :sp_albumbrowse_copyright, [ :pointer, :int ], :string
|
226
|
+
attach_function :albumbrowse_num_tracks, :sp_albumbrowse_num_tracks, [ :pointer ], :int
|
227
|
+
attach_function :albumbrowse_track, :sp_albumbrowse_track, [ :pointer, :int ], :pointer
|
228
|
+
attach_function :albumbrowse_review, :sp_albumbrowse_review, [ :pointer ], :string
|
229
|
+
attach_function :albumbrowse_add_ref, :sp_albumbrowse_add_ref, [ :pointer ], :void
|
230
|
+
attach_function :albumbrowse_release, :sp_albumbrowse_release, [ :pointer ], :void
|
231
|
+
|
232
|
+
#
|
233
|
+
# Artists
|
234
|
+
#
|
235
|
+
# @see http://developer.spotify.com/en/libspotify/docs/group__artist.html
|
236
|
+
attach_function :artist_name, :sp_artist_name, [ :pointer ], :string
|
237
|
+
attach_function :artist_is_loaded, :sp_artist_is_loaded, [ :pointer ], :bool
|
238
|
+
attach_function :artist_add_ref, :sp_artist_add_ref, [ :pointer ], :void
|
239
|
+
attach_function :artist_release, :sp_artist_release, [ :pointer ], :void
|
240
|
+
|
241
|
+
#
|
242
|
+
# Artist Browsing
|
243
|
+
#
|
244
|
+
# @see http://developer.spotify.com/en/libspotify/docs/group__artistbrowse.html
|
245
|
+
attach_function :artistbrowse_create, :sp_artistbrowse_create, [ :pointer, :pointer, callback([:pointer, :pointer], :void), :pointer ], :pointer
|
246
|
+
attach_function :artistbrowse_is_loaded, :sp_artistbrowse_is_loaded, [ :pointer ], :bool
|
247
|
+
attach_function :artistbrowse_error, :sp_artistbrowse_error, [ :pointer ], :error
|
248
|
+
attach_function :artistbrowse_artist, :sp_artistbrowse_artist, [ :pointer ], :pointer
|
249
|
+
attach_function :artistbrowse_num_portraits, :sp_artistbrowse_num_portraits, [ :pointer ], :int
|
250
|
+
attach_function :artistbrowse_portrait, :sp_artistbrowse_portrait, [ :pointer, :int ], :pointer
|
251
|
+
attach_function :artistbrowse_num_tracks, :sp_artistbrowse_num_tracks, [ :pointer ], :int
|
252
|
+
attach_function :artistbrowse_track, :sp_artistbrowse_track, [ :pointer, :int ], :pointer
|
253
|
+
attach_function :artistbrowse_num_albums, :sp_artistbrowse_num_albums, [ :pointer ], :int
|
254
|
+
attach_function :artistbrowse_album, :sp_artistbrowse_album, [ :pointer, :int ], :pointer
|
255
|
+
attach_function :artistbrowse_num_similar_artists, :sp_artistbrowse_num_similar_artists, [ :pointer ], :int
|
256
|
+
attach_function :artistbrowse_similar_artist, :sp_artistbrowse_similar_artist, [ :pointer, :int ], :pointer
|
257
|
+
attach_function :artistbrowse_biography, :sp_artistbrowse_biography, [ :pointer ], :string
|
258
|
+
attach_function :artistbrowse_add_ref, :sp_artistbrowse_add_ref, [ :pointer ], :void
|
259
|
+
attach_function :artistbrowse_release, :sp_artistbrowse_release, [ :pointer ], :void
|
260
|
+
|
261
|
+
#
|
262
|
+
# Images
|
263
|
+
#
|
264
|
+
# @see http://developer.spotify.com/en/libspotify/docs/group__image.html
|
265
|
+
enum :imageformat, [:unknown, -1, :jpeg]
|
266
|
+
|
267
|
+
callback :image_loaded, [ :pointer, :pointer ], :void
|
268
|
+
attach_function :image_create, :sp_image_create, [ :pointer, :uchar], :pointer
|
269
|
+
attach_function :image_add_load_callback, :sp_image_add_load_callback, [ :pointer, :image_loaded, :pointer ], :void
|
270
|
+
attach_function :image_remove_load_callback, :sp_image_remove_load_callback, [ :pointer, :image_loaded, :pointer ], :void
|
271
|
+
attach_function :image_is_loaded, :sp_image_is_loaded, [ :pointer ], :bool
|
272
|
+
attach_function :image_error, :sp_image_error, [ :pointer ], :error
|
273
|
+
attach_function :image_format, :sp_image_format, [ :pointer ], :imageformat
|
274
|
+
attach_function :image_data, :sp_image_data, [ :pointer, :pointer ], :pointer
|
275
|
+
attach_function :image_image_id, :sp_image_image_id, [ :pointer ], :pointer # string?
|
276
|
+
attach_function :image_add_ref, :sp_image_add_ref, [ :pointer ], :void
|
277
|
+
attach_function :image_release, :sp_image_release, [ :pointer ], :void
|
278
|
+
|
279
|
+
#
|
280
|
+
# Searching
|
281
|
+
#
|
282
|
+
# @see http://developer.spotify.com/en/libspotify/docs/group__search.html
|
283
|
+
enum :radio_genre, {
|
284
|
+
:alt_pop_rock => 0x1,
|
285
|
+
:blues => 0x2,
|
286
|
+
:country => 0x4,
|
287
|
+
:disco => 0x8,
|
288
|
+
:funk => 0x10,
|
289
|
+
:hard_rock => 0x20,
|
290
|
+
:heavy_metal => 0x40,
|
291
|
+
:rap => 0x80,
|
292
|
+
:house => 0x100,
|
293
|
+
:jazz => 0x200,
|
294
|
+
:new_wave => 0x400,
|
295
|
+
:rnb => 0x800,
|
296
|
+
:pop => 0x1000,
|
297
|
+
:punk => 0x2000,
|
298
|
+
:reggae => 0x4000,
|
299
|
+
:pop_rock => 0x8000,
|
300
|
+
:soul => 0x10000,
|
301
|
+
:techno => 0x20000
|
302
|
+
}.flatten
|
303
|
+
|
304
|
+
|
305
|
+
attach_function :search_create, :sp_search_create, [ :pointer, :string, :int, :int, :int, :int, :int, :int, callback([:pointer, :pointer], :void), :pointer ], :pointer
|
306
|
+
attach_function :radio_search_create, :sp_radio_search_create, [ :pointer, :uint, :uint, :radio_genre, :pointer, :pointer ], :pointer
|
307
|
+
attach_function :search_is_loaded, :sp_search_is_loaded, [ :pointer ], :bool
|
308
|
+
attach_function :search_error, :sp_search_error, [ :pointer ], :error
|
309
|
+
attach_function :search_num_tracks, :sp_search_num_tracks, [ :pointer ], :int
|
310
|
+
attach_function :search_track, :sp_search_track, [ :pointer, :int ], :pointer
|
311
|
+
attach_function :search_num_albums, :sp_search_num_albums, [ :pointer ], :int
|
312
|
+
attach_function :search_album, :sp_search_album, [ :pointer, :int ], :pointer
|
313
|
+
attach_function :search_num_artists, :sp_search_num_artists, [ :pointer ], :int
|
314
|
+
attach_function :search_artist, :sp_search_artist, [ :pointer, :int ], :pointer
|
315
|
+
attach_function :search_query, :sp_search_query, [ :pointer ], :string
|
316
|
+
attach_function :search_did_you_mean, :sp_search_did_you_mean, [ :pointer ], :string
|
317
|
+
attach_function :search_total_tracks, :sp_search_total_tracks, [ :pointer ], :int
|
318
|
+
attach_function :search_total_albums, :sp_search_total_albums, [ :pointer ], :int
|
319
|
+
attach_function :search_total_artists, :sp_search_total_artists, [ :pointer ], :int
|
320
|
+
attach_function :search_add_ref, :sp_search_add_ref, [ :pointer ], :void
|
321
|
+
attach_function :search_release, :sp_search_release, [ :pointer ], :void
|
322
|
+
|
323
|
+
#
|
324
|
+
# Playlists
|
325
|
+
#
|
326
|
+
# @see http://developer.spotify.com/en/libspotify/docs/group__playlist.html
|
327
|
+
enum :playlist_type, [:playlist, :start_folder, :end_folder, :placeholder]
|
328
|
+
|
329
|
+
attach_function :playlist_is_loaded, :sp_playlist_is_loaded, [ :pointer ], :bool
|
330
|
+
attach_function :playlist_add_callbacks, :sp_playlist_add_callbacks, [ :pointer, :pointer, :pointer ], :void
|
331
|
+
attach_function :playlist_remove_callbacks, :sp_playlist_remove_callbacks, [ :pointer, :pointer, :pointer ], :void
|
332
|
+
attach_function :playlist_num_tracks, :sp_playlist_num_tracks, [ :pointer ], :int
|
333
|
+
attach_function :playlist_track, :sp_playlist_track, [ :pointer, :int ], :pointer
|
334
|
+
attach_function :playlist_track_create_time, :sp_playlist_track_create_time, [ :pointer, :int ], :int
|
335
|
+
attach_function :playlist_track_creator, :sp_playlist_track_creator, [ :pointer, :int ], :pointer
|
336
|
+
attach_function :playlist_track_seen, :sp_playlist_track_seen, [ :pointer, :int ], :bool
|
337
|
+
attach_function :playlist_track_set_seen, :sp_playlist_track_set_seen, [ :pointer, :int, :bool ], :error
|
338
|
+
attach_function :playlist_track_message, :sp_playlist_track_message, [ :pointer, :int ], :string
|
339
|
+
attach_function :playlist_name, :sp_playlist_name, [ :pointer ], :string
|
340
|
+
attach_function :playlist_rename, :sp_playlist_rename, [ :pointer, :string ], :error
|
341
|
+
attach_function :playlist_owner, :sp_playlist_owner, [ :pointer ], :pointer
|
342
|
+
attach_function :playlist_is_collaborative, :sp_playlist_is_collaborative, [ :pointer ], :bool
|
343
|
+
attach_function :playlist_set_collaborative, :sp_playlist_set_collaborative, [ :pointer, :bool ], :void
|
344
|
+
attach_function :playlist_set_autolink_tracks, :sp_playlist_set_autolink_tracks, [ :pointer, :bool ], :void
|
345
|
+
attach_function :playlist_get_description, :sp_playlist_get_description, [ :pointer ], :string
|
346
|
+
attach_function :playlist_get_image, :sp_playlist_get_image, [ :pointer, :uchar ], :bool
|
347
|
+
attach_function :playlist_has_pending_changes, :sp_playlist_has_pending_changes, [ :pointer ], :bool
|
348
|
+
attach_function :playlist_add_tracks, :sp_playlist_add_tracks, [ :pointer, :pointer, :int, :int, :pointer ], :error
|
349
|
+
attach_function :playlist_remove_tracks, :sp_playlist_remove_tracks, [ :pointer, :pointer, :int ], :error
|
350
|
+
attach_function :playlist_reorder_tracks, :sp_playlist_reorder_tracks, [ :pointer, :pointer, :int, :int ], :error
|
351
|
+
attach_function :playlist_num_subscribers, :sp_playlist_num_subscribers, [ :pointer ], :uint
|
352
|
+
attach_function :playlist_subscribers, :sp_playlist_subscribers, [ :pointer ], :pointer
|
353
|
+
attach_function :playlist_subscribers_free, :sp_playlist_subscribers_free, [ :pointer ], :void
|
354
|
+
attach_function :playlist_update_subscribers, :sp_playlist_update_subscribers, [ :pointer, :pointer ], :void
|
355
|
+
attach_function :playlist_is_in_ram, :sp_playlist_is_in_ram, [ :pointer, :pointer ], :bool
|
356
|
+
attach_function :playlist_set_in_ram, :sp_playlist_set_in_ram, [ :pointer, :pointer, :bool ], :void
|
357
|
+
attach_function :playlist_create, :sp_playlist_create, [ :pointer, :pointer ], :pointer
|
358
|
+
attach_function :playlist_add_ref, :sp_playlist_add_ref, [ :pointer ], :void
|
359
|
+
attach_function :playlist_release, :sp_playlist_release, [ :pointer ], :void
|
360
|
+
|
361
|
+
# FFI::Struct for Playlist callbacks.
|
362
|
+
#
|
363
|
+
# @attr [callback(:pointer, :pointer, :int, :int, :pointer):void] tracks_added
|
364
|
+
# @attr [callback(:pointer, :pointer, :int, :pointer):void] tracks_removed
|
365
|
+
# @attr [callback(:pointer, :pointer, :int, :int, :pointer):void] tracks_moved
|
366
|
+
# @attr [callback(:pointer, :pointer):void] playlist_renamed
|
367
|
+
# @attr [callback(:pointer, :pointer):void] playlist_state_changed
|
368
|
+
# @attr [callback(:pointer, :bool, :pointer):void] playlist_update_in_progress
|
369
|
+
# @attr [callback(:pointer, :pointer):void] playlist_metadata_updated
|
370
|
+
# @attr [callback(:pointer, :int, :pointer, :int, :pointer):void] track_created_changed
|
371
|
+
# @attr [callback(:pointer, :int, :bool, :pointer):void] track_seen_changed
|
372
|
+
# @attr [callback(:pointer, :string, :pointer):void] description_changed
|
373
|
+
# @attr [callback(:pointer, :pointer, :pointer):void] image_changed
|
374
|
+
# @attr [callback(:pointer, :int, :string, :pointer):void] track_message_changed
|
375
|
+
# @attr [callback(:pointer, :pointer):void] subscribers_changed
|
376
|
+
class PlaylistCallbacks < FFI::Struct
|
377
|
+
layout :tracks_added => callback([ :pointer, :pointer, :int, :int, :pointer ], :void),
|
378
|
+
:tracks_removed => callback([ :pointer, :pointer, :int, :pointer ], :void),
|
379
|
+
:tracks_moved => callback([ :pointer, :pointer, :int, :int, :pointer ], :void),
|
380
|
+
:playlist_renamed => callback([ :pointer, :pointer ], :void),
|
381
|
+
:playlist_state_changed => callback([ :pointer, :pointer ], :void),
|
382
|
+
:playlist_update_in_progress => callback([ :pointer, :bool, :pointer ], :void),
|
383
|
+
:playlist_metadata_updated => callback([ :pointer, :pointer ], :void),
|
384
|
+
:track_created_changed => callback([ :pointer, :int, :pointer, :int, :pointer ], :void),
|
385
|
+
:track_seen_changed => callback([ :pointer, :int, :bool, :pointer ], :void),
|
386
|
+
:description_changed => callback([ :pointer, :string, :pointer ], :void),
|
387
|
+
:image_changed => callback([ :pointer, :pointer, :pointer ], :void),
|
388
|
+
:track_message_changed => callback([ :pointer, :int, :string, :pointer ], :void),
|
389
|
+
:subscribers_changed => callback([ :pointer, :pointer ], :void)
|
390
|
+
end
|
391
|
+
|
392
|
+
# FFI::Struct for Subscribers of a Playlist.
|
393
|
+
#
|
394
|
+
# @attr [Fixnum] count
|
395
|
+
# @attr [Pointer<String>] subscribers
|
396
|
+
class Subscribers < FFI::Struct
|
397
|
+
layout :count => :uint,
|
398
|
+
:subscribers => :pointer # array of count strings
|
399
|
+
end
|
400
|
+
|
401
|
+
#
|
402
|
+
# Playlist Container
|
403
|
+
#
|
404
|
+
|
405
|
+
attach_function :playlistcontainer_add_callbacks, :sp_playlistcontainer_add_callbacks, [ :pointer, :pointer, :pointer ], :void
|
406
|
+
attach_function :playlistcontainer_remove_callbacks, :sp_playlistcontainer_remove_callbacks, [ :pointer, :pointer, :pointer ], :void
|
407
|
+
attach_function :playlistcontainer_num_playlists, :sp_playlistcontainer_num_playlists, [ :pointer ], :int
|
408
|
+
attach_function :playlistcontainer_playlist, :sp_playlistcontainer_playlist, [ :pointer, :int ], :pointer
|
409
|
+
attach_function :playlistcontainer_playlist_type, :sp_playlistcontainer_playlist_type, [ :pointer, :int ], :int
|
410
|
+
attach_function :playlistcontainer_playlist_folder_name, :sp_playlistcontainer_playlist_folder_name, [ :pointer, :int, :string, :int ], :error
|
411
|
+
attach_function :playlistcontainer_playlist_folder_id, :sp_playlistcontainer_playlist_folder_id, [ :pointer, :int ], :uint64
|
412
|
+
attach_function :playlistcontainer_add_new_playlist, :sp_playlistcontainer_add_new_playlist, [ :pointer, :string ], :pointer
|
413
|
+
attach_function :playlistcontainer_add_playlist, :sp_playlistcontainer_add_playlist, [ :pointer, :pointer ], :pointer
|
414
|
+
attach_function :playlistcontainer_remove_playlist, :sp_playlistcontainer_remove_playlist, [ :pointer, :int ], :error
|
415
|
+
attach_function :playlistcontainer_move_playlist, :sp_playlistcontainer_move_playlist, [ :pointer, :int, :int, :bool ], :error
|
416
|
+
attach_function :playlistcontainer_add_folder, :sp_playlistcontainer_add_folder, [ :pointer, :int, :string ], :error
|
417
|
+
attach_function :playlistcontainer_owner, :sp_playlistcontainer_owner, [ :pointer ], :pointer
|
418
|
+
attach_function :playlistcontainer_add_ref, :sp_playlistcontainer_add_ref, [ :pointer ], :void
|
419
|
+
attach_function :playlistcontainer_release, :sp_playlistcontainer_release, [ :pointer ], :void
|
420
|
+
|
421
|
+
# FFI::Struct for the PlaylistContainer.
|
422
|
+
#
|
423
|
+
# @attr [callback(:pointer, :pointer, :int, :pointer):void] playlist_added
|
424
|
+
# @attr [callback(:pointer, :pointer, :int, :pointer):void] playlist_removed
|
425
|
+
# @attr [callback(:pointer, :pointer, :int, :int, :pointer):void] playlist_moved
|
426
|
+
# @attr [callback(:pointer, :pointer):void] container_loaded
|
427
|
+
class PlaylistContainerCallbacks < FFI::Struct
|
428
|
+
layout :playlist_added => callback([ :pointer, :pointer, :int, :pointer ], :void),
|
429
|
+
:playlist_removed => callback([ :pointer, :pointer, :int, :pointer ], :void),
|
430
|
+
:playlist_moved => callback([ :pointer, :pointer, :int, :int, :pointer ], :void),
|
431
|
+
:container_loaded => callback([ :pointer, :pointer ], :void)
|
432
|
+
end
|
433
|
+
|
434
|
+
#
|
435
|
+
# User handling
|
436
|
+
#
|
437
|
+
# @see http://developer.spotify.com/en/libspotify/docs/group__user.html
|
438
|
+
enum :relation_type, [:unknown, :none, :unidirectional, :bidirectional]
|
439
|
+
|
440
|
+
attach_function :user_canonical_name, :sp_user_canonical_name, [ :pointer ], :string
|
441
|
+
attach_function :user_display_name, :sp_user_display_name, [ :pointer ], :string
|
442
|
+
attach_function :user_is_loaded, :sp_user_is_loaded, [ :pointer ], :bool
|
443
|
+
attach_function :user_full_name, :sp_user_full_name, [ :pointer ], :string
|
444
|
+
attach_function :user_picture, :sp_user_picture, [ :pointer ], :string
|
445
|
+
attach_function :user_relation_type, :sp_user_relation_type, [ :pointer, :pointer ], :relation_type
|
446
|
+
attach_function :user_add_ref, :sp_user_add_ref, [ :pointer ], :void
|
447
|
+
attach_function :user_release, :sp_user_release, [ :pointer ], :void
|
448
|
+
|
449
|
+
#
|
450
|
+
# Toplists
|
451
|
+
#
|
452
|
+
# @see http://developer.spotify.com/en/libspotify/docs/group__toplist.html
|
453
|
+
enum :toplisttype, [:artists, :albums, :tracks]
|
454
|
+
enum :toplistregion, [:everywhere, :user]
|
455
|
+
|
456
|
+
attach_function :toplistbrowse_create, :sp_toplistbrowse_create, [ :pointer, :toplisttype, :toplistregion, :string, callback([:pointer, :pointer], :void), :pointer ], :pointer
|
457
|
+
attach_function :toplistbrowse_is_loaded, :sp_toplistbrowse_is_loaded, [ :pointer ], :bool
|
458
|
+
attach_function :toplistbrowse_error, :sp_toplistbrowse_error, [ :pointer ], :error
|
459
|
+
attach_function :toplistbrowse_add_ref, :sp_toplistbrowse_add_ref, [ :pointer ], :void
|
460
|
+
attach_function :toplistbrowse_release, :sp_toplistbrowse_release, [ :pointer ], :void
|
461
|
+
attach_function :toplistbrowse_num_artists, :sp_toplistbrowse_num_artists, [ :pointer ], :int
|
462
|
+
attach_function :toplistbrowse_artist, :sp_toplistbrowse_artist, [ :pointer, :int ], :pointer
|
463
|
+
attach_function :toplistbrowse_num_albums, :sp_toplistbrowse_num_albums, [ :pointer ], :int
|
464
|
+
attach_function :toplistbrowse_album, :sp_toplistbrowse_album, [ :pointer, :int ], :pointer
|
465
|
+
attach_function :toplistbrowse_num_tracks, :sp_toplistbrowse_num_tracks, [ :pointer ], :int
|
466
|
+
attach_function :toplistbrowse_track, :sp_toplistbrowse_track, [ :pointer, :int ], :pointer
|
6
467
|
|
468
|
+
#
|
469
|
+
# Inbox
|
470
|
+
#
|
471
|
+
# @see http://developer.spotify.com/en/libspotify/docs/group__inbox.html
|
472
|
+
attach_function :inbox_post_tracks, :sp_inbox_post_tracks, [ :pointer, :string, :pointer, :int, :string, callback([:pointer, :pointer], :void), :pointer ], :pointer
|
473
|
+
attach_function :inbox_error, :sp_inbox_error, [ :pointer ], :error
|
474
|
+
attach_function :inbox_add_ref, :sp_inbox_add_ref, [ :pointer ], :void
|
475
|
+
attach_function :inbox_release, :sp_inbox_release, [ :pointer ], :void
|
7
476
|
end
|