spotify 12.5.3 → 12.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.travis.yml +20 -5
- data/CHANGELOG.md +29 -1
- data/Gemfile +5 -0
- data/MIT-LICENSE +21 -0
- data/README.markdown +75 -50
- data/Rakefile +1 -1
- data/examples/example-audio_delivery_speed.rb +48 -0
- data/examples/{audio-stream_example.rb → example-audio_stream.rb} +14 -29
- data/examples/example-console.rb +9 -0
- data/examples/example-listing_playlists.rb +89 -0
- data/examples/example-loading_object.rb +25 -0
- data/examples/example-random_related_artists.rb +53 -0
- data/examples/support.rb +106 -0
- data/lib/spotify.rb +36 -55
- data/lib/spotify/api.rb +54 -26
- data/lib/spotify/api/album.rb +45 -2
- data/lib/spotify/api/album_browse.rb +81 -3
- data/lib/spotify/api/artist.rb +21 -2
- data/lib/spotify/api/artist_browse.rb +121 -3
- data/lib/spotify/api/error.rb +5 -1
- data/lib/spotify/api/image.rb +72 -6
- data/lib/spotify/api/inbox.rb +33 -4
- data/lib/spotify/api/link.rb +117 -4
- data/lib/spotify/api/miscellaneous.rb +12 -0
- data/lib/spotify/api/playlist.rb +321 -16
- data/lib/spotify/api/playlist_container.rb +168 -9
- data/lib/spotify/api/search.rb +156 -3
- data/lib/spotify/api/session.rb +390 -26
- data/lib/spotify/api/toplist_browse.rb +74 -3
- data/lib/spotify/api/track.rb +134 -4
- data/lib/spotify/api/user.rb +18 -2
- data/lib/spotify/api_helpers.rb +47 -0
- data/lib/spotify/data_converters.rb +7 -0
- data/lib/spotify/{types → data_converters}/best_effort_string.rb +1 -1
- data/lib/spotify/{types → data_converters}/byte_string.rb +0 -0
- data/lib/spotify/data_converters/country_code.rb +30 -0
- data/lib/spotify/{types → data_converters}/image_id.rb +1 -1
- data/lib/spotify/{type_safety.rb → data_converters/type_safety.rb} +0 -0
- data/lib/spotify/{types → data_converters}/utf8_string.rb +2 -2
- data/lib/spotify/{types → data_converters}/utf8_string_pointer.rb +2 -2
- data/lib/spotify/error.rb +180 -47
- data/lib/spotify/managed_pointer.rb +32 -12
- data/lib/spotify/monkey_patches/ffi_buffer.rb +11 -0
- data/lib/spotify/monkey_patches/ffi_enums.rb +4 -0
- data/lib/spotify/monkey_patches/ffi_pointer.rb +1 -0
- data/lib/spotify/structs.rb +4 -0
- data/lib/spotify/structs/session_callbacks.rb +97 -26
- data/lib/spotify/structs/session_config.rb +1 -1
- data/lib/spotify/structs/subscribers.rb +4 -3
- data/lib/spotify/types.rb +104 -5
- data/lib/spotify/{objects → types}/album.rb +0 -0
- data/lib/spotify/{objects → types}/album_browse.rb +0 -0
- data/lib/spotify/{objects → types}/artist.rb +0 -0
- data/lib/spotify/{objects → types}/artist_browse.rb +0 -0
- data/lib/spotify/{objects → types}/image.rb +0 -0
- data/lib/spotify/{objects → types}/inbox.rb +0 -0
- data/lib/spotify/{objects → types}/link.rb +0 -0
- data/lib/spotify/{objects → types}/playlist.rb +0 -0
- data/lib/spotify/{objects → types}/playlist_container.rb +0 -0
- data/lib/spotify/{objects → types}/search.rb +0 -0
- data/lib/spotify/{objects → types}/session.rb +0 -0
- data/lib/spotify/{objects → types}/toplist_browse.rb +0 -0
- data/lib/spotify/{objects → types}/track.rb +0 -0
- data/lib/spotify/{objects → types}/user.rb +0 -0
- data/lib/spotify/util.rb +38 -35
- data/lib/spotify/version.rb +1 -1
- data/spec/spec_helper.rb +24 -13
- data/spec/spotify/api/image_spec.rb +32 -0
- data/spec/spotify/api/inbox_spec.rb +34 -0
- data/spec/spotify/api/link_spec.rb +40 -0
- data/spec/spotify/api/playlist_spec.rb +99 -0
- data/spec/spotify/api/playlistcontainer_spec.rb +82 -0
- data/spec/spotify/api/session_spec.rb +97 -0
- data/spec/spotify/api/track_spec.rb +29 -0
- data/spec/spotify/api_error_spec.rb +55 -0
- data/spec/spotify/api_spec.rb +17 -11
- data/spec/spotify/{types → data_converters}/best_effort_string_spec.rb +4 -4
- data/spec/spotify/{types → data_converters}/byte_string_spec.rb +0 -0
- data/spec/spotify/data_converters/country_code_spec.rb +16 -0
- data/spec/spotify/{types → data_converters}/image_id_spec.rb +1 -1
- data/spec/spotify/{type_safety_spec.rb → data_converters/type_safety_spec.rb} +0 -0
- data/spec/spotify/{types → data_converters}/utf8_string_pointer_spec.rb +0 -0
- data/spec/spotify/{types → data_converters}/utf8_string_spec.rb +1 -1
- data/spec/spotify/{api/functions_spec.rb → functions_spec.rb} +2 -0
- data/spec/spotify/managed_pointer_spec.rb +13 -13
- data/spec/spotify/structs/subscribers_spec.rb +5 -3
- data/spec/spotify/{defines_spec.rb → types_spec.rb} +16 -3
- data/spec/spotify/util_spec.rb +24 -0
- data/spec/spotify_spec.rb +74 -0
- data/spec/support/spotify_util.rb +6 -2
- data/spec/support/spy_output.rb +16 -0
- data/spotify.gemspec +4 -2
- metadata +111 -71
- data/examples/README.md +0 -15
- data/examples/console_example.rb +0 -22
- data/examples/example_support.rb +0 -66
- data/examples/loading-object_example.rb +0 -43
- data/examples/logging-in_example.rb +0 -58
- data/lib/spotify/defines.rb +0 -109
- data/lib/spotify/objects.rb +0 -17
- data/spec/spotify/enums_spec.rb +0 -9
- data/spec/spotify/spotify_spec.rb +0 -69
data/spotify.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |gem|
|
|
8
8
|
gem.homepage = 'https://github.com/Burgestrand/spotify'
|
9
9
|
gem.authors = ["Kim Burgestrand"]
|
10
10
|
gem.email = ['kim@burgestrand.se']
|
11
|
-
gem.license = '
|
11
|
+
gem.license = 'MIT License'
|
12
12
|
|
13
13
|
gem.files = `git ls-files`.split("\n")
|
14
14
|
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
@@ -17,10 +17,12 @@ Gem::Specification.new do |gem|
|
|
17
17
|
|
18
18
|
gem.version = Spotify::VERSION
|
19
19
|
gem.platform = Gem::Platform::RUBY
|
20
|
-
gem.required_ruby_version = '>=
|
20
|
+
gem.required_ruby_version = '>= 2.0'
|
21
21
|
|
22
22
|
gem.add_dependency 'ffi', ['~> 1.0', '>= 1.0.11']
|
23
23
|
gem.add_dependency 'libspotify', '~> 12.1.51'
|
24
|
+
gem.add_dependency 'performer', '~> 1.0'
|
25
|
+
|
24
26
|
gem.add_development_dependency 'rake'
|
25
27
|
gem.add_development_dependency 'rbgccxml'
|
26
28
|
gem.add_development_dependency 'rspec'
|
metadata
CHANGED
@@ -1,89 +1,103 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spotify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 12.
|
4
|
+
version: 12.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kim Burgestrand
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-09-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.0'
|
20
|
-
- -
|
20
|
+
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: 1.0.11
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
|
-
- - ~>
|
27
|
+
- - "~>"
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '1.0'
|
30
|
-
- -
|
30
|
+
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 1.0.11
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: libspotify
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- - ~>
|
37
|
+
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
39
|
version: 12.1.51
|
40
40
|
type: :runtime
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
|
-
- - ~>
|
44
|
+
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: 12.1.51
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: performer
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '1.0'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '1.0'
|
47
61
|
- !ruby/object:Gem::Dependency
|
48
62
|
name: rake
|
49
63
|
requirement: !ruby/object:Gem::Requirement
|
50
64
|
requirements:
|
51
|
-
- -
|
65
|
+
- - ">="
|
52
66
|
- !ruby/object:Gem::Version
|
53
67
|
version: '0'
|
54
68
|
type: :development
|
55
69
|
prerelease: false
|
56
70
|
version_requirements: !ruby/object:Gem::Requirement
|
57
71
|
requirements:
|
58
|
-
- -
|
72
|
+
- - ">="
|
59
73
|
- !ruby/object:Gem::Version
|
60
74
|
version: '0'
|
61
75
|
- !ruby/object:Gem::Dependency
|
62
76
|
name: rbgccxml
|
63
77
|
requirement: !ruby/object:Gem::Requirement
|
64
78
|
requirements:
|
65
|
-
- -
|
79
|
+
- - ">="
|
66
80
|
- !ruby/object:Gem::Version
|
67
81
|
version: '0'
|
68
82
|
type: :development
|
69
83
|
prerelease: false
|
70
84
|
version_requirements: !ruby/object:Gem::Requirement
|
71
85
|
requirements:
|
72
|
-
- -
|
86
|
+
- - ">="
|
73
87
|
- !ruby/object:Gem::Version
|
74
88
|
version: '0'
|
75
89
|
- !ruby/object:Gem::Dependency
|
76
90
|
name: rspec
|
77
91
|
requirement: !ruby/object:Gem::Requirement
|
78
92
|
requirements:
|
79
|
-
- -
|
93
|
+
- - ">="
|
80
94
|
- !ruby/object:Gem::Version
|
81
95
|
version: '0'
|
82
96
|
type: :development
|
83
97
|
prerelease: false
|
84
98
|
version_requirements: !ruby/object:Gem::Requirement
|
85
99
|
requirements:
|
86
|
-
- -
|
100
|
+
- - ">="
|
87
101
|
- !ruby/object:Gem::Version
|
88
102
|
version: '0'
|
89
103
|
description:
|
@@ -93,21 +107,23 @@ executables: []
|
|
93
107
|
extensions: []
|
94
108
|
extra_rdoc_files: []
|
95
109
|
files:
|
96
|
-
- .gemtest
|
97
|
-
- .gitignore
|
98
|
-
- .rspec
|
99
|
-
- .travis.yml
|
110
|
+
- ".gemtest"
|
111
|
+
- ".gitignore"
|
112
|
+
- ".rspec"
|
113
|
+
- ".travis.yml"
|
100
114
|
- CHANGELOG.md
|
101
115
|
- Gemfile
|
116
|
+
- MIT-LICENSE
|
102
117
|
- README.markdown
|
103
118
|
- Rakefile
|
104
119
|
- examples/.gitignore
|
105
|
-
- examples/
|
106
|
-
- examples/
|
107
|
-
- examples/
|
108
|
-
- examples/
|
109
|
-
- examples/
|
110
|
-
- examples/
|
120
|
+
- examples/example-audio_delivery_speed.rb
|
121
|
+
- examples/example-audio_stream.rb
|
122
|
+
- examples/example-console.rb
|
123
|
+
- examples/example-listing_playlists.rb
|
124
|
+
- examples/example-loading_object.rb
|
125
|
+
- examples/example-random_related_artists.rb
|
126
|
+
- examples/support.rb
|
111
127
|
- lib/spotify.rb
|
112
128
|
- lib/spotify/api.rb
|
113
129
|
- lib/spotify/api/album.rb
|
@@ -118,6 +134,7 @@ files:
|
|
118
134
|
- lib/spotify/api/image.rb
|
119
135
|
- lib/spotify/api/inbox.rb
|
120
136
|
- lib/spotify/api/link.rb
|
137
|
+
- lib/spotify/api/miscellaneous.rb
|
121
138
|
- lib/spotify/api/playlist.rb
|
122
139
|
- lib/spotify/api/playlist_container.rb
|
123
140
|
- lib/spotify/api/search.rb
|
@@ -125,25 +142,20 @@ files:
|
|
125
142
|
- lib/spotify/api/toplist_browse.rb
|
126
143
|
- lib/spotify/api/track.rb
|
127
144
|
- lib/spotify/api/user.rb
|
128
|
-
- lib/spotify/
|
145
|
+
- lib/spotify/api_helpers.rb
|
146
|
+
- lib/spotify/data_converters.rb
|
147
|
+
- lib/spotify/data_converters/best_effort_string.rb
|
148
|
+
- lib/spotify/data_converters/byte_string.rb
|
149
|
+
- lib/spotify/data_converters/country_code.rb
|
150
|
+
- lib/spotify/data_converters/image_id.rb
|
151
|
+
- lib/spotify/data_converters/type_safety.rb
|
152
|
+
- lib/spotify/data_converters/utf8_string.rb
|
153
|
+
- lib/spotify/data_converters/utf8_string_pointer.rb
|
129
154
|
- lib/spotify/error.rb
|
130
155
|
- lib/spotify/managed_pointer.rb
|
156
|
+
- lib/spotify/monkey_patches/ffi_buffer.rb
|
157
|
+
- lib/spotify/monkey_patches/ffi_enums.rb
|
131
158
|
- lib/spotify/monkey_patches/ffi_pointer.rb
|
132
|
-
- lib/spotify/objects.rb
|
133
|
-
- lib/spotify/objects/album.rb
|
134
|
-
- lib/spotify/objects/album_browse.rb
|
135
|
-
- lib/spotify/objects/artist.rb
|
136
|
-
- lib/spotify/objects/artist_browse.rb
|
137
|
-
- lib/spotify/objects/image.rb
|
138
|
-
- lib/spotify/objects/inbox.rb
|
139
|
-
- lib/spotify/objects/link.rb
|
140
|
-
- lib/spotify/objects/playlist.rb
|
141
|
-
- lib/spotify/objects/playlist_container.rb
|
142
|
-
- lib/spotify/objects/search.rb
|
143
|
-
- lib/spotify/objects/session.rb
|
144
|
-
- lib/spotify/objects/toplist_browse.rb
|
145
|
-
- lib/spotify/objects/track.rb
|
146
|
-
- lib/spotify/objects/user.rb
|
147
159
|
- lib/spotify/structs.rb
|
148
160
|
- lib/spotify/structs/audio_buffer_stats.rb
|
149
161
|
- lib/spotify/structs/audio_format.rb
|
@@ -153,35 +165,52 @@ files:
|
|
153
165
|
- lib/spotify/structs/session_callbacks.rb
|
154
166
|
- lib/spotify/structs/session_config.rb
|
155
167
|
- lib/spotify/structs/subscribers.rb
|
156
|
-
- lib/spotify/type_safety.rb
|
157
168
|
- lib/spotify/types.rb
|
158
|
-
- lib/spotify/types/
|
159
|
-
- lib/spotify/types/
|
160
|
-
- lib/spotify/types/
|
161
|
-
- lib/spotify/types/
|
162
|
-
- lib/spotify/types/
|
169
|
+
- lib/spotify/types/album.rb
|
170
|
+
- lib/spotify/types/album_browse.rb
|
171
|
+
- lib/spotify/types/artist.rb
|
172
|
+
- lib/spotify/types/artist_browse.rb
|
173
|
+
- lib/spotify/types/image.rb
|
174
|
+
- lib/spotify/types/inbox.rb
|
175
|
+
- lib/spotify/types/link.rb
|
176
|
+
- lib/spotify/types/playlist.rb
|
177
|
+
- lib/spotify/types/playlist_container.rb
|
178
|
+
- lib/spotify/types/search.rb
|
179
|
+
- lib/spotify/types/session.rb
|
180
|
+
- lib/spotify/types/toplist_browse.rb
|
181
|
+
- lib/spotify/types/track.rb
|
182
|
+
- lib/spotify/types/user.rb
|
163
183
|
- lib/spotify/util.rb
|
164
184
|
- lib/spotify/version.rb
|
165
185
|
- spec/bench_helper.rb
|
166
186
|
- spec/benchmarks/managed_pointer_bench.rb
|
167
187
|
- spec/spec_helper.rb
|
168
|
-
- spec/spotify/api/
|
188
|
+
- spec/spotify/api/image_spec.rb
|
189
|
+
- spec/spotify/api/inbox_spec.rb
|
190
|
+
- spec/spotify/api/link_spec.rb
|
191
|
+
- spec/spotify/api/playlist_spec.rb
|
192
|
+
- spec/spotify/api/playlistcontainer_spec.rb
|
193
|
+
- spec/spotify/api/session_spec.rb
|
194
|
+
- spec/spotify/api/track_spec.rb
|
195
|
+
- spec/spotify/api_error_spec.rb
|
169
196
|
- spec/spotify/api_spec.rb
|
170
|
-
- spec/spotify/
|
171
|
-
- spec/spotify/
|
197
|
+
- spec/spotify/data_converters/best_effort_string_spec.rb
|
198
|
+
- spec/spotify/data_converters/byte_string_spec.rb
|
199
|
+
- spec/spotify/data_converters/country_code_spec.rb
|
200
|
+
- spec/spotify/data_converters/image_id_spec.rb
|
201
|
+
- spec/spotify/data_converters/type_safety_spec.rb
|
202
|
+
- spec/spotify/data_converters/utf8_string_pointer_spec.rb
|
203
|
+
- spec/spotify/data_converters/utf8_string_spec.rb
|
204
|
+
- spec/spotify/functions_spec.rb
|
172
205
|
- spec/spotify/managed_pointer_spec.rb
|
173
206
|
- spec/spotify/monkey_patches/ffi_pointer_spec.rb
|
174
|
-
- spec/spotify/spotify_spec.rb
|
175
207
|
- spec/spotify/structs/session_config_spec.rb
|
176
208
|
- spec/spotify/structs/struct_spec.rb
|
177
209
|
- spec/spotify/structs/subscribers_spec.rb
|
178
210
|
- spec/spotify/structs_spec.rb
|
179
|
-
- spec/spotify/
|
180
|
-
- spec/spotify/
|
181
|
-
- spec/
|
182
|
-
- spec/spotify/types/image_id_spec.rb
|
183
|
-
- spec/spotify/types/utf8_string_pointer_spec.rb
|
184
|
-
- spec/spotify/types/utf8_string_spec.rb
|
211
|
+
- spec/spotify/types_spec.rb
|
212
|
+
- spec/spotify/util_spec.rb
|
213
|
+
- spec/spotify_spec.rb
|
185
214
|
- spec/support/api-linux.h
|
186
215
|
- spec/support/api-linux.xml
|
187
216
|
- spec/support/api-mac.h
|
@@ -190,10 +219,11 @@ files:
|
|
190
219
|
- spec/support/linux-platform.rb
|
191
220
|
- spec/support/mac-platform.rb
|
192
221
|
- spec/support/spotify_util.rb
|
222
|
+
- spec/support/spy_output.rb
|
193
223
|
- spotify.gemspec
|
194
224
|
homepage: https://github.com/Burgestrand/spotify
|
195
225
|
licenses:
|
196
|
-
-
|
226
|
+
- MIT License
|
197
227
|
metadata: {}
|
198
228
|
post_install_message:
|
199
229
|
rdoc_options: []
|
@@ -201,17 +231,17 @@ require_paths:
|
|
201
231
|
- lib
|
202
232
|
required_ruby_version: !ruby/object:Gem::Requirement
|
203
233
|
requirements:
|
204
|
-
- -
|
234
|
+
- - ">="
|
205
235
|
- !ruby/object:Gem::Version
|
206
|
-
version: '
|
236
|
+
version: '2.0'
|
207
237
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
208
238
|
requirements:
|
209
|
-
- -
|
239
|
+
- - ">="
|
210
240
|
- !ruby/object:Gem::Version
|
211
241
|
version: '0'
|
212
242
|
requirements: []
|
213
243
|
rubyforge_project:
|
214
|
-
rubygems_version: 2.
|
244
|
+
rubygems_version: 2.2.2
|
215
245
|
signing_key:
|
216
246
|
specification_version: 4
|
217
247
|
summary: Low-level Ruby bindings for libspotify, the official Spotify C API
|
@@ -219,23 +249,32 @@ test_files:
|
|
219
249
|
- spec/bench_helper.rb
|
220
250
|
- spec/benchmarks/managed_pointer_bench.rb
|
221
251
|
- spec/spec_helper.rb
|
222
|
-
- spec/spotify/api/
|
252
|
+
- spec/spotify/api/image_spec.rb
|
253
|
+
- spec/spotify/api/inbox_spec.rb
|
254
|
+
- spec/spotify/api/link_spec.rb
|
255
|
+
- spec/spotify/api/playlist_spec.rb
|
256
|
+
- spec/spotify/api/playlistcontainer_spec.rb
|
257
|
+
- spec/spotify/api/session_spec.rb
|
258
|
+
- spec/spotify/api/track_spec.rb
|
259
|
+
- spec/spotify/api_error_spec.rb
|
223
260
|
- spec/spotify/api_spec.rb
|
224
|
-
- spec/spotify/
|
225
|
-
- spec/spotify/
|
261
|
+
- spec/spotify/data_converters/best_effort_string_spec.rb
|
262
|
+
- spec/spotify/data_converters/byte_string_spec.rb
|
263
|
+
- spec/spotify/data_converters/country_code_spec.rb
|
264
|
+
- spec/spotify/data_converters/image_id_spec.rb
|
265
|
+
- spec/spotify/data_converters/type_safety_spec.rb
|
266
|
+
- spec/spotify/data_converters/utf8_string_pointer_spec.rb
|
267
|
+
- spec/spotify/data_converters/utf8_string_spec.rb
|
268
|
+
- spec/spotify/functions_spec.rb
|
226
269
|
- spec/spotify/managed_pointer_spec.rb
|
227
270
|
- spec/spotify/monkey_patches/ffi_pointer_spec.rb
|
228
|
-
- spec/spotify/spotify_spec.rb
|
229
271
|
- spec/spotify/structs/session_config_spec.rb
|
230
272
|
- spec/spotify/structs/struct_spec.rb
|
231
273
|
- spec/spotify/structs/subscribers_spec.rb
|
232
274
|
- spec/spotify/structs_spec.rb
|
233
|
-
- spec/spotify/
|
234
|
-
- spec/spotify/
|
235
|
-
- spec/
|
236
|
-
- spec/spotify/types/image_id_spec.rb
|
237
|
-
- spec/spotify/types/utf8_string_pointer_spec.rb
|
238
|
-
- spec/spotify/types/utf8_string_spec.rb
|
275
|
+
- spec/spotify/types_spec.rb
|
276
|
+
- spec/spotify/util_spec.rb
|
277
|
+
- spec/spotify_spec.rb
|
239
278
|
- spec/support/api-linux.h
|
240
279
|
- spec/support/api-linux.xml
|
241
280
|
- spec/support/api-mac.h
|
@@ -244,4 +283,5 @@ test_files:
|
|
244
283
|
- spec/support/linux-platform.rb
|
245
284
|
- spec/support/mac-platform.rb
|
246
285
|
- spec/support/spotify_util.rb
|
286
|
+
- spec/support/spy_output.rb
|
247
287
|
has_rdoc:
|
data/examples/README.md
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
# How to run the examples:
|
2
|
-
|
3
|
-
1. Install the dependencies. Preferrably via bundler with `bundle install`.
|
4
|
-
2. Configure your environment variables SPOTIFY\_USERNAME, SPOTIFY\_PASSWORD.
|
5
|
-
3. Download your binary application key from <https://developer.spotify.com/technologies/libspotify/keys/>.
|
6
|
-
4. Put your `spotify_appkey.key` application key in the example directory.
|
7
|
-
5. Run your specific example, e.g. `bundle exec ruby logging-in.rb`.
|
8
|
-
|
9
|
-
## Available examples and what they do
|
10
|
-
|
11
|
-
- **logging-in.rb**
|
12
|
-
|
13
|
-
a fairly small example on how you could login with the spotify API. It
|
14
|
-
has some callbacks to provide more information on what happens during
|
15
|
-
the process.
|
data/examples/console_example.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# encoding: utf-8
|
3
|
-
|
4
|
-
require_relative "example_support"
|
5
|
-
|
6
|
-
config = Spotify::SessionConfig.new({
|
7
|
-
api_version: Spotify::API_VERSION.to_i,
|
8
|
-
application_key: $appkey,
|
9
|
-
cache_location: ".spotify/",
|
10
|
-
settings_location: ".spotify/",
|
11
|
-
user_agent: "spotify for ruby",
|
12
|
-
callbacks: nil,
|
13
|
-
})
|
14
|
-
|
15
|
-
$logger.info "Creating session."
|
16
|
-
$session = Support.create_session(config)
|
17
|
-
|
18
|
-
$logger.info "Created! Logging in."
|
19
|
-
Spotify.session_login($session, $username, $password, false, nil)
|
20
|
-
|
21
|
-
$logger.info "Logged in! Entering interactive session…"
|
22
|
-
binding.pry
|
data/examples/example_support.rb
DELETED
@@ -1,66 +0,0 @@
|
|
1
|
-
require "bundler/setup"
|
2
|
-
require "spotify"
|
3
|
-
require "logger"
|
4
|
-
require "pry"
|
5
|
-
|
6
|
-
# Kill main thread if any other thread dies.
|
7
|
-
Thread.abort_on_exception = true
|
8
|
-
|
9
|
-
# We use a logger to print some information on when things are happening.
|
10
|
-
$stderr.sync = true
|
11
|
-
$logger = Logger.new($stderr)
|
12
|
-
$logger.level = Logger::INFO
|
13
|
-
|
14
|
-
#
|
15
|
-
# Some utility.
|
16
|
-
#
|
17
|
-
|
18
|
-
module Support
|
19
|
-
module_function
|
20
|
-
|
21
|
-
def logger
|
22
|
-
$logger
|
23
|
-
end
|
24
|
-
|
25
|
-
# libspotify supports callbacks, but they are not useful for waiting on
|
26
|
-
# operations (how they fire can be strange at times, and sometimes they
|
27
|
-
# might not fire at all). As a result, polling is the way to go.
|
28
|
-
def poll(session)
|
29
|
-
until yield
|
30
|
-
FFI::MemoryPointer.new(:int) do |ptr|
|
31
|
-
Spotify.session_process_events(session, ptr)
|
32
|
-
end
|
33
|
-
sleep(0.1)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
# For making sure fetching configuration options fail with a useful error
|
38
|
-
# message when running the examples.
|
39
|
-
def env(name)
|
40
|
-
ENV.fetch(name) do
|
41
|
-
raise "Missing ENV['#{name}']. Please: export #{name}='your value'"
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
# Ask the user for input with a prompt explaining what kind of input.
|
46
|
-
def prompt(message)
|
47
|
-
print "#{message}: "
|
48
|
-
gets.chomp
|
49
|
-
end
|
50
|
-
|
51
|
-
def create_session(config)
|
52
|
-
FFI::MemoryPointer.new(Spotify::Session) do |ptr|
|
53
|
-
Spotify.try(:session_create, config, ptr)
|
54
|
-
return Spotify::Session.new(ptr.read_pointer)
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
# Load the configuration.
|
60
|
-
$appkey = IO.read("./spotify_appkey.key", encoding: "BINARY")
|
61
|
-
$username = Support.env("SPOTIFY_USERNAME")
|
62
|
-
if ENV.has_key?("SPOTIFY_BLOB")
|
63
|
-
$blob = ENV["SPOTIFY_BLOB"]
|
64
|
-
else
|
65
|
-
$password = Support.env("SPOTIFY_PASSWORD")
|
66
|
-
end
|