spotify 12.0.2 → 12.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +5 -0
- data/Rakefile +4 -0
- data/lib/spotify/functions.rb +1 -0
- data/lib/spotify/gc_wrappers.rb +1 -0
- data/lib/spotify/version.rb +1 -1
- data/spec/api.h +648 -638
- metadata +4 -4
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,10 @@ __v12.1.0__
|
|
2
2
|
-----------
|
3
3
|
- erroneously released (wrong version number, does not follow version policy)
|
4
4
|
|
5
|
+
[v12.0.3][]
|
6
|
+
-----------
|
7
|
+
- add support for search_playlist (retrieves a playlist object directly from a search)
|
8
|
+
|
5
9
|
[v12.0.2][]
|
6
10
|
-----------
|
7
11
|
- use error checking in Spotify::Pointer add_ref and release
|
@@ -122,6 +126,7 @@ v0.0.0
|
|
122
126
|
------
|
123
127
|
- release to register rubygems.org name
|
124
128
|
|
129
|
+
[v12.0.3]: https://github.com/Burgestrand/libspotify-ruby/compare/v12.0.2...v12.0.3
|
125
130
|
[v12.0.2]: https://github.com/Burgestrand/libspotify-ruby/compare/v12.0.1...v12.0.2
|
126
131
|
[v12.0.1]: https://github.com/Burgestrand/libspotify-ruby/compare/v12.0.0...v12.0.1
|
127
132
|
[v12.0.0]: https://github.com/Burgestrand/libspotify-ruby/compare/v11.0.2...v12.0.0
|
data/Rakefile
CHANGED
data/lib/spotify/functions.rb
CHANGED
@@ -509,6 +509,7 @@ module Spotify
|
|
509
509
|
attach_function :search_num_artists, :sp_search_num_artists, [ :search ], :int
|
510
510
|
attach_function :search_artist, :sp_search_artist, [ :search, :int ], :artist
|
511
511
|
attach_function :search_num_playlists, :sp_search_num_playlists, [ :search ], :int
|
512
|
+
attach_function :search_playlist, :sp_search_playlist, [ :search, :int ], :playlist
|
512
513
|
attach_function :search_playlist_name, :sp_search_playlist_name, [ :search, :int ], :utf8_string
|
513
514
|
attach_function :search_playlist_uri, :sp_search_playlist_uri, [ :search, :int ], :utf8_string
|
514
515
|
attach_function :search_playlist_image_uri, :sp_search_playlist_image_uri, [ :search, :int ], :utf8_string
|
data/lib/spotify/gc_wrappers.rb
CHANGED
@@ -81,6 +81,7 @@ module Spotify
|
|
81
81
|
wrap_function :search_track, :track
|
82
82
|
wrap_function :search_album, :album
|
83
83
|
wrap_function :search_artist, :artist
|
84
|
+
wrap_function :search_playlist, :playlist
|
84
85
|
|
85
86
|
wrap_function :playlist_track, :track
|
86
87
|
wrap_function :playlist_track_creator, :user
|
data/lib/spotify/version.rb
CHANGED
data/spec/api.h
CHANGED
@@ -93,42 +93,42 @@ typedef struct sp_inbox sp_inbox; ///< Add to inbox request handle
|
|
93
93
|
* Error codes returned by various functions
|
94
94
|
*/
|
95
95
|
typedef enum sp_error {
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
96
|
+
SP_ERROR_OK = 0, ///< No errors encountered
|
97
|
+
SP_ERROR_BAD_API_VERSION = 1, ///< The library version targeted does not match the one you claim you support
|
98
|
+
SP_ERROR_API_INITIALIZATION_FAILED = 2, ///< Initialization of library failed - are cache locations etc. valid?
|
99
|
+
SP_ERROR_TRACK_NOT_PLAYABLE = 3, ///< The track specified for playing cannot be played
|
100
|
+
SP_ERROR_BAD_APPLICATION_KEY = 5, ///< The application key is invalid
|
101
|
+
SP_ERROR_BAD_USERNAME_OR_PASSWORD = 6, ///< Login failed because of bad username and/or password
|
102
|
+
SP_ERROR_USER_BANNED = 7, ///< The specified username is banned
|
103
|
+
SP_ERROR_UNABLE_TO_CONTACT_SERVER = 8, ///< Cannot connect to the Spotify backend system
|
104
|
+
SP_ERROR_CLIENT_TOO_OLD = 9, ///< Client is too old, library will need to be updated
|
105
|
+
SP_ERROR_OTHER_PERMANENT = 10, ///< Some other error occurred, and it is permanent (e.g. trying to relogin will not help)
|
106
|
+
SP_ERROR_BAD_USER_AGENT = 11, ///< The user agent string is invalid or too long
|
107
|
+
SP_ERROR_MISSING_CALLBACK = 12, ///< No valid callback registered to handle events
|
108
|
+
SP_ERROR_INVALID_INDATA = 13, ///< Input data was either missing or invalid
|
109
|
+
SP_ERROR_INDEX_OUT_OF_RANGE = 14, ///< Index out of range
|
110
|
+
SP_ERROR_USER_NEEDS_PREMIUM = 15, ///< The specified user needs a premium account
|
111
|
+
SP_ERROR_OTHER_TRANSIENT = 16, ///< A transient error occurred.
|
112
|
+
SP_ERROR_IS_LOADING = 17, ///< The resource is currently loading
|
113
|
+
SP_ERROR_NO_STREAM_AVAILABLE = 18, ///< Could not find any suitable stream to play
|
114
|
+
SP_ERROR_PERMISSION_DENIED = 19, ///< Requested operation is not allowed
|
115
|
+
SP_ERROR_INBOX_IS_FULL = 20, ///< Target inbox is full
|
116
|
+
SP_ERROR_NO_CACHE = 21, ///< Cache is not enabled
|
117
|
+
SP_ERROR_NO_SUCH_USER = 22, ///< Requested user does not exist
|
118
|
+
SP_ERROR_NO_CREDENTIALS = 23, ///< No credentials are stored
|
119
|
+
SP_ERROR_NETWORK_DISABLED = 24, ///< Network disabled
|
120
|
+
SP_ERROR_INVALID_DEVICE_ID = 25, ///< Invalid device ID
|
121
|
+
SP_ERROR_CANT_OPEN_TRACE_FILE = 26, ///< Unable to open trace file
|
122
|
+
SP_ERROR_APPLICATION_BANNED = 27, ///< This application is no longer allowed to use the Spotify service
|
123
|
+
SP_ERROR_OFFLINE_TOO_MANY_TRACKS = 31, ///< Reached the device limit for number of tracks to download
|
124
|
+
SP_ERROR_OFFLINE_DISK_CACHE = 32, ///< Disk cache is full so no more tracks can be downloaded to offline mode
|
125
|
+
SP_ERROR_OFFLINE_EXPIRED = 33, ///< Offline key has expired, the user needs to go online again
|
126
|
+
SP_ERROR_OFFLINE_NOT_ALLOWED = 34, ///< This user is not allowed to use offline mode
|
127
|
+
SP_ERROR_OFFLINE_LICENSE_LOST = 35, ///< The license for this device has been lost. Most likely because the user used offline on three other device
|
128
|
+
SP_ERROR_OFFLINE_LICENSE_ERROR = 36, ///< The Spotify license server does not respond correctly
|
129
|
+
SP_ERROR_LASTFM_AUTH_ERROR = 39, ///< A LastFM scrobble authentication error has occurred
|
130
|
+
SP_ERROR_INVALID_ARGUMENT = 40, ///< An invalid argument was specified
|
131
|
+
SP_ERROR_SYSTEM_FAILURE = 41, ///< An operating system error
|
132
132
|
} sp_error;
|
133
133
|
|
134
134
|
/**
|
@@ -168,11 +168,11 @@ SP_LIBEXPORT(const char*) sp_error_message(sp_error error);
|
|
168
168
|
* Describes the current state of the connection
|
169
169
|
*/
|
170
170
|
typedef enum sp_connectionstate {
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
171
|
+
SP_CONNECTION_STATE_LOGGED_OUT = 0, ///< User not yet logged in
|
172
|
+
SP_CONNECTION_STATE_LOGGED_IN = 1, ///< Logged in against a Spotify access point
|
173
|
+
SP_CONNECTION_STATE_DISCONNECTED = 2, ///< Was logged in, but has now been disconnected
|
174
|
+
SP_CONNECTION_STATE_UNDEFINED = 3, ///< The connection state is undefined
|
175
|
+
SP_CONNECTION_STATE_OFFLINE = 4 ///< Logged in in offline mode
|
176
176
|
} sp_connectionstate;
|
177
177
|
|
178
178
|
|
@@ -180,16 +180,16 @@ typedef enum sp_connectionstate {
|
|
180
180
|
* Sample type descriptor
|
181
181
|
*/
|
182
182
|
typedef enum sp_sampletype {
|
183
|
-
|
183
|
+
SP_SAMPLETYPE_INT16_NATIVE_ENDIAN = 0, ///< 16-bit signed integer samples
|
184
184
|
} sp_sampletype;
|
185
185
|
|
186
186
|
/**
|
187
187
|
* Audio format descriptor
|
188
188
|
*/
|
189
189
|
typedef struct sp_audioformat {
|
190
|
-
|
191
|
-
|
192
|
-
|
190
|
+
sp_sampletype sample_type; ///< Sample type enum,
|
191
|
+
int sample_rate; ///< Audio sample rate, in samples per second.
|
192
|
+
int channels; ///< Number of channels. Currently 1 or 2.
|
193
193
|
} sp_audioformat;
|
194
194
|
|
195
195
|
/**
|
@@ -205,10 +205,10 @@ typedef enum sp_bitrate {
|
|
205
205
|
* Playlist types
|
206
206
|
*/
|
207
207
|
typedef enum sp_playlist_type {
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
208
|
+
SP_PLAYLIST_TYPE_PLAYLIST = 0, ///< A normal playlist.
|
209
|
+
SP_PLAYLIST_TYPE_START_FOLDER = 1, ///< Marks a folder starting point,
|
210
|
+
SP_PLAYLIST_TYPE_END_FOLDER = 2, ///< and ending point.
|
211
|
+
SP_PLAYLIST_TYPE_PLACEHOLDER = 3, ///< Unknown entry.
|
212
212
|
} sp_playlist_type;
|
213
213
|
|
214
214
|
|
@@ -217,67 +217,67 @@ typedef enum sp_playlist_type {
|
|
217
217
|
* Search types
|
218
218
|
*/
|
219
219
|
typedef enum sp_search_type {
|
220
|
-
|
221
|
-
|
220
|
+
SP_SEARCH_STANDARD = 0,
|
221
|
+
SP_SEARCH_SUGGEST = 1,
|
222
222
|
} sp_search_type;
|
223
223
|
|
224
224
|
/**
|
225
225
|
* Playlist offline status
|
226
226
|
*/
|
227
227
|
typedef enum sp_playlist_offline_status {
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
228
|
+
SP_PLAYLIST_OFFLINE_STATUS_NO = 0, ///< Playlist is not offline enabled
|
229
|
+
SP_PLAYLIST_OFFLINE_STATUS_YES = 1, ///< Playlist is synchronized to local storage
|
230
|
+
SP_PLAYLIST_OFFLINE_STATUS_DOWNLOADING = 2, ///< This playlist is currently downloading. Only one playlist can be in this state any given time
|
231
|
+
SP_PLAYLIST_OFFLINE_STATUS_WAITING = 3, ///< Playlist is queued for download
|
232
232
|
} sp_playlist_offline_status;
|
233
233
|
|
234
234
|
/**
|
235
235
|
* Track availability
|
236
236
|
*/
|
237
237
|
typedef enum sp_availability {
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
238
|
+
SP_TRACK_AVAILABILITY_UNAVAILABLE = 0, ///< Track is not available
|
239
|
+
SP_TRACK_AVAILABILITY_AVAILABLE = 1, ///< Track is available and can be played
|
240
|
+
SP_TRACK_AVAILABILITY_NOT_STREAMABLE = 2, ///< Track can not be streamed using this account
|
241
|
+
SP_TRACK_AVAILABILITY_BANNED_BY_ARTIST = 3, ///< Track not available on artist's reqeust
|
242
242
|
} sp_track_availability;
|
243
243
|
|
244
244
|
/**
|
245
245
|
* Track offline status
|
246
246
|
*/
|
247
247
|
typedef enum sp_track_offline_status {
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
248
|
+
SP_TRACK_OFFLINE_NO = 0, ///< Not marked for offline
|
249
|
+
SP_TRACK_OFFLINE_WAITING = 1, ///< Waiting for download
|
250
|
+
SP_TRACK_OFFLINE_DOWNLOADING = 2, ///< Currently downloading
|
251
|
+
SP_TRACK_OFFLINE_DONE = 3, ///< Downloaded OK and can be played
|
252
|
+
SP_TRACK_OFFLINE_ERROR = 4, ///< Error during download
|
253
|
+
SP_TRACK_OFFLINE_DONE_EXPIRED = 5, ///< Downloaded OK but not playable due to expiery
|
254
|
+
SP_TRACK_OFFLINE_LIMIT_EXCEEDED = 6, ///< Waiting because device have reached max number of allowed tracks
|
255
|
+
SP_TRACK_OFFLINE_DONE_RESYNC = 7, ///< Downloaded OK and available but scheduled for re-download
|
256
256
|
} sp_track_offline_status;
|
257
257
|
|
258
258
|
/**
|
259
259
|
* Image size
|
260
260
|
*/
|
261
261
|
typedef enum sp_image_size {
|
262
|
-
|
263
|
-
|
264
|
-
|
262
|
+
SP_IMAGE_SIZE_NORMAL = 0, ///< Normal image size
|
263
|
+
SP_IMAGE_SIZE_SMALL = 1, ///< Small image size
|
264
|
+
SP_IMAGE_SIZE_LARGE = 2, ///< Large image size
|
265
265
|
} sp_image_size;
|
266
266
|
|
267
267
|
/**
|
268
268
|
* Buffer stats used by get_audio_buffer_stats callback
|
269
269
|
*/
|
270
270
|
typedef struct sp_audio_buffer_stats {
|
271
|
-
|
272
|
-
|
271
|
+
int samples; ///< Samples in buffer
|
272
|
+
int stutter; ///< Number of stutters (audio dropouts) since last query
|
273
273
|
} sp_audio_buffer_stats;
|
274
274
|
|
275
275
|
/**
|
276
276
|
* List of subscribers returned by sp_playlist_subscribers()
|
277
277
|
*/
|
278
278
|
typedef struct sp_subscribers {
|
279
|
-
|
280
|
-
|
279
|
+
unsigned int count; ///< Number of elements in 'subscribers'
|
280
|
+
char *subscribers[1]; ///< Actual size is 'count'. Array of pointers to canonical usernames
|
281
281
|
} sp_subscribers;
|
282
282
|
|
283
283
|
|
@@ -285,12 +285,12 @@ typedef struct sp_subscribers {
|
|
285
285
|
* Current connection type set using sp_session_set_connection_type()
|
286
286
|
*/
|
287
287
|
typedef enum sp_connection_type {
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
288
|
+
SP_CONNECTION_TYPE_UNKNOWN = 0, ///< Connection type unknown (Default)
|
289
|
+
SP_CONNECTION_TYPE_NONE = 1, ///< No connection
|
290
|
+
SP_CONNECTION_TYPE_MOBILE = 2, ///< Mobile data (EDGE, 3G, etc)
|
291
|
+
SP_CONNECTION_TYPE_MOBILE_ROAMING = 3, ///< Roamed mobile data (EDGE, 3G, etc)
|
292
|
+
SP_CONNECTION_TYPE_WIFI = 4, ///< Wireless connection
|
293
|
+
SP_CONNECTION_TYPE_WIRED = 5, ///< Ethernet cable, etc
|
294
294
|
} sp_connection_type;
|
295
295
|
|
296
296
|
|
@@ -300,10 +300,10 @@ typedef enum sp_connection_type {
|
|
300
300
|
* The default is SP_CONNECTION_RULE_NETWORK | SP_CONNECTION_RULE_ALLOW_SYNC
|
301
301
|
*/
|
302
302
|
typedef enum sp_connection_rules {
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
303
|
+
SP_CONNECTION_RULE_NETWORK = 0x1, ///< Allow network traffic. When not set libspotify will force itself into offline mode
|
304
|
+
SP_CONNECTION_RULE_NETWORK_IF_ROAMING = 0x2, ///< Allow network traffic even if roaming
|
305
|
+
SP_CONNECTION_RULE_ALLOW_SYNC_OVER_MOBILE = 0x4, ///< Set to allow syncing of offline content over mobile connections
|
306
|
+
SP_CONNECTION_RULE_ALLOW_SYNC_OVER_WIFI = 0x8, ///< Set to allow syncing of offline content over WiFi
|
307
307
|
} sp_connection_rules;
|
308
308
|
|
309
309
|
|
@@ -311,17 +311,17 @@ typedef enum sp_connection_rules {
|
|
311
311
|
* Controls the type of data that will be included in artist browse queries
|
312
312
|
*/
|
313
313
|
typedef enum sp_artistbrowse_type {
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
314
|
+
SP_ARTISTBROWSE_FULL, /**< All information except tophit tracks
|
315
|
+
This mode is deprecated and will removed in a future release */
|
316
|
+
SP_ARTISTBROWSE_NO_TRACKS, /**< Only albums and data about them, no tracks.
|
317
|
+
In other words, sp_artistbrowse_num_tracks() will return 0
|
318
|
+
*/
|
319
|
+
SP_ARTISTBROWSE_NO_ALBUMS, /**< Only return data about the artist (artist name, similar artist
|
320
|
+
biography, etc
|
321
|
+
No tracks or album will be abailable.
|
322
|
+
sp_artistbrowse_num_tracks() and sp_artistbrowse_num_albums()
|
323
|
+
will both return 0
|
324
|
+
*/
|
325
325
|
} sp_artistbrowse_type;
|
326
326
|
|
327
327
|
typedef enum sp_social_provider {
|
@@ -343,43 +343,43 @@ typedef enum sp_scrobbling_state {
|
|
343
343
|
* Offline sync status
|
344
344
|
*/
|
345
345
|
typedef struct sp_offline_sync_status {
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
346
|
+
/**
|
347
|
+
* Queued tracks/bytes is things left to sync in current sync
|
348
|
+
* operation
|
349
|
+
*/
|
350
|
+
int queued_tracks;
|
351
|
+
sp_uint64 queued_bytes;
|
352
|
+
|
353
|
+
/**
|
354
|
+
* Done tracks/bytes is things marked for sync that existed on
|
355
|
+
* device before current sync operation
|
356
|
+
*/
|
357
|
+
int done_tracks;
|
358
|
+
sp_uint64 done_bytes;
|
359
|
+
|
360
|
+
/**
|
361
|
+
* Copied tracks/bytes is things that has been copied in
|
362
|
+
* current sync operation
|
363
|
+
*/
|
364
|
+
int copied_tracks;
|
365
|
+
sp_uint64 copied_bytes;
|
366
|
+
|
367
|
+
/**
|
368
|
+
* Tracks that are marked as synced but will not be copied
|
369
|
+
* (for various reasons)
|
370
|
+
*/
|
371
|
+
int willnotcopy_tracks;
|
372
|
+
|
373
|
+
/**
|
374
|
+
* A track is counted as error when something goes wrong while
|
375
|
+
* syncing the track
|
376
|
+
*/
|
377
|
+
int error_tracks;
|
378
|
+
|
379
|
+
/**
|
380
|
+
* Set if sync operation is in progress
|
381
|
+
*/
|
382
|
+
bool syncing;
|
383
383
|
|
384
384
|
} sp_offline_sync_status;
|
385
385
|
|
@@ -392,319 +392,319 @@ typedef struct sp_offline_sync_status {
|
|
392
392
|
*/
|
393
393
|
typedef struct sp_session_callbacks {
|
394
394
|
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
395
|
+
/**
|
396
|
+
* Called when login has been processed and was successful
|
397
|
+
*
|
398
|
+
* @param[in] session Session
|
399
|
+
* @param[in] error One of the following errors, from ::sp_error
|
400
|
+
* SP_ERROR_OK
|
401
|
+
* SP_ERROR_CLIENT_TOO_OLD
|
402
|
+
* SP_ERROR_UNABLE_TO_CONTACT_SERVER
|
403
|
+
* SP_ERROR_BAD_USERNAME_OR_PASSWORD
|
404
|
+
* SP_ERROR_USER_BANNED
|
405
|
+
* SP_ERROR_USER_NEEDS_PREMIUM
|
406
|
+
* SP_ERROR_OTHER_TRANSIENT
|
407
|
+
* SP_ERROR_OTHER_PERMANENT
|
408
|
+
*/
|
409
|
+
void (SP_CALLCONV *logged_in)(sp_session *session, sp_error error);
|
410
|
+
|
411
|
+
/**
|
412
|
+
* Called when logout has been processed. Either called explicitly
|
413
|
+
* if you initialize a logout operation, or implicitly if there
|
414
|
+
* is a permanent connection error
|
415
|
+
*
|
416
|
+
* @param[in] session Session
|
417
|
+
*/
|
418
|
+
void (SP_CALLCONV *logged_out)(sp_session *session);
|
419
|
+
/**
|
420
|
+
* Called whenever metadata has been updated
|
421
|
+
*
|
422
|
+
* If you have metadata cached outside of libspotify, you should purge
|
423
|
+
* your caches and fetch new versions.
|
424
|
+
*
|
425
|
+
* @param[in] session Session
|
426
|
+
*/
|
427
|
+
void (SP_CALLCONV *metadata_updated)(sp_session *session);
|
428
|
+
|
429
|
+
/**
|
430
|
+
* Called when there is a connection error, and the library has problems
|
431
|
+
* reconnecting to the Spotify service. Could be called multiple times (as
|
432
|
+
* long as the problem is present)
|
433
|
+
*
|
434
|
+
*
|
435
|
+
* @param[in] session Session
|
436
|
+
* @param[in] error One of the following errors, from ::sp_error
|
437
|
+
* SP_ERROR_OK
|
438
|
+
* SP_ERROR_CLIENT_TOO_OLD
|
439
|
+
* SP_ERROR_UNABLE_TO_CONTACT_SERVER
|
440
|
+
* SP_ERROR_BAD_USERNAME_OR_PASSWORD
|
441
|
+
* SP_ERROR_USER_BANNED
|
442
|
+
* SP_ERROR_USER_NEEDS_PREMIUM
|
443
|
+
* SP_ERROR_OTHER_TRANSIENT
|
444
|
+
* SP_ERROR_OTHER_PERMANENT
|
445
|
+
*/
|
446
|
+
void (SP_CALLCONV *connection_error)(sp_session *session, sp_error error);
|
447
|
+
|
448
|
+
/**
|
449
|
+
* Called when the access point wants to display a message to the user
|
450
|
+
*
|
451
|
+
* In the desktop client, these are shown in a blueish toolbar just below the
|
452
|
+
* search box.
|
453
|
+
*
|
454
|
+
* @param[in] session Session
|
455
|
+
* @param[in] message String in UTF-8 format.
|
456
|
+
*/
|
457
|
+
void (SP_CALLCONV *message_to_user)(sp_session *session, const char *message);
|
458
|
+
|
459
|
+
/**
|
460
|
+
* Called when processing needs to take place on the main thread.
|
461
|
+
*
|
462
|
+
* You need to call sp_session_process_events() in the main thread to get
|
463
|
+
* libspotify to do more work. Failure to do so may cause request timeouts,
|
464
|
+
* or a lost connection.
|
465
|
+
*
|
466
|
+
* @param[in] session Session
|
467
|
+
*
|
468
|
+
* @note This function is called from an internal session thread - you need to have proper synchronization!
|
469
|
+
*/
|
470
|
+
void (SP_CALLCONV *notify_main_thread)(sp_session *session);
|
471
|
+
|
472
|
+
/**
|
473
|
+
* Called when there is decompressed audio data available.
|
474
|
+
*
|
475
|
+
* @param[in] session Session
|
476
|
+
* @param[in] format Audio format descriptor sp_audioformat
|
477
|
+
* @param[in] frames Points to raw PCM data as described by \p format
|
478
|
+
* @param[in] num_frames Number of available samples in \p frames.
|
479
|
+
* If this is 0, a discontinuity has occurred (such as after a seek). The application
|
480
|
+
* should flush its audio fifos, etc.
|
481
|
+
*
|
482
|
+
* @return Number of frames consumed.
|
483
|
+
* This value can be used to rate limit the output from the library if your
|
484
|
+
* output buffers are saturated. The library will retry delivery in about 100ms.
|
485
|
+
*
|
486
|
+
* @note This function is called from an internal session thread - you need to have proper synchronization!
|
487
|
+
*
|
488
|
+
* @note This function must never block. If your output buffers are full you must return 0 to signal
|
489
|
+
* that the library should retry delivery in a short while.
|
490
|
+
*/
|
491
|
+
int (SP_CALLCONV *music_delivery)(sp_session *session, const sp_audioformat *format, const void *frames, int num_frames);
|
492
|
+
|
493
|
+
/**
|
494
|
+
* Music has been paused because an account only allows music
|
495
|
+
* to be played from one location simultaneously.
|
496
|
+
*
|
497
|
+
* @note When this callback is invoked the application should
|
498
|
+
* behave just as if the user pressed the pause
|
499
|
+
* button. The application should also display a message
|
500
|
+
* to the user indicating the playback has been paused
|
501
|
+
* because another application is playing using the same
|
502
|
+
* account.
|
503
|
+
*
|
504
|
+
* @note IT MUST NOT automatically resume playback but must
|
505
|
+
* instead wait for the user to press play.
|
506
|
+
*
|
507
|
+
* @param[in] session Session
|
508
|
+
*/
|
509
|
+
void (SP_CALLCONV *play_token_lost)(sp_session *session);
|
510
|
+
|
511
|
+
/**
|
512
|
+
* Logging callback.
|
513
|
+
*
|
514
|
+
* @param[in] session Session
|
515
|
+
* @param[in] data Log data
|
516
|
+
*/
|
517
|
+
void (SP_CALLCONV *log_message)(sp_session *session, const char *data);
|
518
|
+
|
519
|
+
/**
|
520
|
+
* End of track.
|
521
|
+
* Called when the currently played track has reached its end.
|
522
|
+
*
|
523
|
+
* @note This function is invoked from the main thread
|
524
|
+
*
|
525
|
+
* @param[in] session Session
|
526
|
+
*/
|
527
|
+
void (SP_CALLCONV *end_of_track)(sp_session *session);
|
528
|
+
|
529
|
+
/**
|
530
|
+
* Streaming error.
|
531
|
+
* Called when streaming cannot start or continue.
|
532
|
+
*
|
533
|
+
* @note This function is invoked from the main thread
|
534
|
+
*
|
535
|
+
* @param[in] session Session
|
536
|
+
* @param[in] error One of the following errors, from ::sp_error
|
537
|
+
* SP_ERROR_NO_STREAM_AVAILABLE
|
538
|
+
* SP_ERROR_OTHER_TRANSIENT
|
539
|
+
* SP_ERROR_OTHER_PERMANENT
|
540
|
+
*/
|
541
|
+
void (SP_CALLCONV *streaming_error)(sp_session *session, sp_error error);
|
542
|
+
|
543
|
+
/**
|
544
|
+
* Called after user info (anything related to sp_user objects) have been updated.
|
545
|
+
*
|
546
|
+
* @param[in] session Session
|
547
|
+
*/
|
548
|
+
void (SP_CALLCONV *userinfo_updated)(sp_session *session);
|
549
|
+
|
550
|
+
/**
|
551
|
+
* Called when audio playback should start
|
552
|
+
*
|
553
|
+
* @note For this to work correctly the application must also implement get_audio_buffer_stats()
|
554
|
+
*
|
555
|
+
* @note This function is called from an internal session thread - you need to have proper synchronization!
|
556
|
+
*
|
557
|
+
* @note This function must never block.
|
558
|
+
*
|
559
|
+
* @param[in] session Session
|
560
|
+
*/
|
561
|
+
void (SP_CALLCONV *start_playback)(sp_session *session);
|
562
|
+
|
563
|
+
|
564
|
+
/**
|
565
|
+
* Called when audio playback should stop
|
566
|
+
*
|
567
|
+
* @note For this to work correctly the application must also implement get_audio_buffer_stats()
|
568
|
+
*
|
569
|
+
* @note This function is called from an internal session thread - you need to have proper synchronization!
|
570
|
+
*
|
571
|
+
* @note This function must never block.
|
572
|
+
*
|
573
|
+
* @param[in] session Session
|
574
|
+
*/
|
575
|
+
void (SP_CALLCONV *stop_playback)(sp_session *session);
|
576
|
+
|
577
|
+
/**
|
578
|
+
* Called to query application about its audio buffer
|
579
|
+
*
|
580
|
+
* @note This function is called from an internal session thread - you need to have proper synchronization!
|
581
|
+
*
|
582
|
+
* @note This function must never block.
|
583
|
+
*
|
584
|
+
* @param[in] session Session
|
585
|
+
* @param[out] stats Stats struct to be filled by application
|
586
|
+
*/
|
587
|
+
void (SP_CALLCONV *get_audio_buffer_stats)(sp_session *session, sp_audio_buffer_stats *stats);
|
588
|
+
|
589
|
+
/**
|
590
|
+
* Called when offline synchronization status is updated
|
591
|
+
*
|
592
|
+
* @param[in] session Session
|
593
|
+
*/
|
594
|
+
void (SP_CALLCONV *offline_status_updated)(sp_session *session);
|
595
|
+
|
596
|
+
/**
|
597
|
+
* Called when offline synchronization status is updated
|
598
|
+
*
|
599
|
+
* @param[in] session Session
|
600
|
+
* @param[in] error Offline error. Will be SP_ERROR_OK if the offline synchronization
|
601
|
+
* error state has cleared
|
602
|
+
*/
|
603
|
+
void (SP_CALLCONV *offline_error)(sp_session *session, sp_error error);
|
604
|
+
|
605
|
+
/**
|
606
|
+
* Called when storable credentials have been updated, usually called when
|
607
|
+
* we have connected to the AP.
|
608
|
+
*
|
609
|
+
* @param[in] session Session
|
610
|
+
* @param[in] blob Blob is a null-terminated string which contains
|
611
|
+
* an encrypted token that can be stored safely on disk
|
612
|
+
* instead of storing plaintext passwords.
|
613
|
+
*/
|
614
|
+
void (SP_CALLCONV *credentials_blob_updated)(sp_session *session, const char *blob);
|
615
|
+
|
616
|
+
/**
|
617
|
+
* Called when the connection state has updated - such as when logging in, going offline, etc.
|
618
|
+
*
|
619
|
+
* @param[in] session Session
|
620
|
+
*/
|
621
|
+
void (SP_CALLCONV *connectionstate_updated)(sp_session *session);
|
622
622
|
|
623
623
|
/**
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
624
|
+
* Called when there is a scrobble error event
|
625
|
+
*
|
626
|
+
* @param[in] session Session
|
627
|
+
* @param[in] error Scrobble error. Currently SP_ERROR_LASTFM_AUTH_ERROR.
|
628
|
+
*/
|
629
|
+
void (SP_CALLCONV *scrobble_error)(sp_session *session, sp_error error);
|
630
630
|
|
631
631
|
/**
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
632
|
+
* Called when there is a change in the private session mode
|
633
|
+
*
|
634
|
+
* @param[in] session Session
|
635
|
+
* @param[in] isPrivate True if in private session, false otherwhise
|
636
|
+
*/
|
637
|
+
void (SP_CALLCONV *private_session_mode_changed)(sp_session *session, bool is_private);
|
638
638
|
} sp_session_callbacks;
|
639
639
|
|
640
640
|
/**
|
641
641
|
* Session config
|
642
642
|
*/
|
643
643
|
typedef struct sp_session_config {
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
644
|
+
int api_version; ///< The version of the Spotify API your application is compiled with. Set to #SPOTIFY_API_VERSION
|
645
|
+
const char *cache_location; /**< The location where Spotify will write cache files.
|
646
|
+
* This cache include tracks, cached browse results and coverarts.
|
647
|
+
* Set to empty string ("") to disable cache
|
648
|
+
*/
|
649
|
+
const char *settings_location; /**< The location where Spotify will write setting files and per-user
|
650
|
+
* cache items. This includes playlists, track metadata, etc.
|
651
|
+
* 'settings_location' may be the same path as 'cache_location'.
|
652
|
+
* 'settings_location' folder will not be created (unlike 'cache_location'),
|
653
|
+
* if you don't want to create the folder yourself, you can set 'settings_location' to 'cache_location'.
|
654
|
+
*/
|
655
|
+
const void *application_key; ///< Your application key
|
656
|
+
size_t application_key_size; ///< The size of the application key in bytes
|
657
|
+
const char *user_agent; /**< "User-Agent" for your application - max 255 characters long
|
658
|
+
The User-Agent should be a relevant, customer facing identification of your application
|
659
|
+
*/
|
660
|
+
|
661
|
+
const sp_session_callbacks *callbacks; ///< Delivery callbacks for session events, or NULL if you are not interested in any callbacks (not recommended!)
|
662
|
+
void *userdata; ///< User supplied data for your application
|
663
|
+
|
664
|
+
/**
|
665
|
+
* Compress local copy of playlists, reduces disk space usage
|
666
|
+
*/
|
667
|
+
bool compress_playlists;
|
668
|
+
|
669
|
+
/**
|
670
|
+
* Don't save metadata for local copies of playlists
|
671
|
+
* Reduces disk space usage at the expense of needing
|
672
|
+
* to request metadata from Spotify backend when loading list
|
673
|
+
*/
|
674
|
+
bool dont_save_metadata_for_playlists;
|
675
|
+
|
676
|
+
/**
|
677
|
+
* Avoid loading playlists into RAM on startup.
|
678
|
+
* See sp_playlist_is_in_ram() for more details.
|
679
|
+
*/
|
680
|
+
bool initially_unload_playlists;
|
681
|
+
|
682
|
+
/**
|
683
|
+
* Device ID for offline synchronization and logging purposes. The Device Id must be unique to the particular device instance,
|
684
|
+
* i.e. no two units must supply the same Device ID. The Device ID must not change between sessions or power cycles.
|
685
|
+
* Good examples is the device's MAC address or unique serial number.
|
686
|
+
*/
|
687
|
+
const char *device_id;
|
688
|
+
|
689
|
+
/**
|
690
|
+
* Url to the proxy server that should be used.
|
691
|
+
* The format is protocol://<host>:port (where protocal is http/https/socks4/socks5)
|
692
|
+
*/
|
693
|
+
const char *proxy;
|
694
|
+
/**
|
695
|
+
* Username to authenticate with proxy server
|
696
|
+
*/
|
697
|
+
const char *proxy_username;
|
698
|
+
/**
|
699
|
+
* Password to authenticate with proxy server
|
700
|
+
*/
|
701
|
+
const char *proxy_password;
|
702
|
+
|
703
|
+
|
704
|
+
/**
|
705
|
+
* Path to API trace file
|
706
|
+
*/
|
707
|
+
const char *tracefile;
|
708
708
|
|
709
709
|
} sp_session_config;
|
710
710
|
|
@@ -757,7 +757,7 @@ SP_LIBEXPORT(sp_error) sp_session_release(sp_session *sess);
|
|
757
757
|
* @param[in] username The username to log in
|
758
758
|
* @param[in] password The password for the specified username
|
759
759
|
* @param[in] remember_me If set, the username / password will be remembered by libspotify
|
760
|
-
* @param[in] blob
|
760
|
+
* @param[in] blob If you have received a blob in the #credentials_blob_updated
|
761
761
|
* you can pas this here instead of password
|
762
762
|
* @return One of the following errors, from ::sp_error
|
763
763
|
* SP_ERROR_OK
|
@@ -904,7 +904,7 @@ SP_LIBEXPORT(sp_error) sp_session_process_events(sp_session *session, int *next_
|
|
904
904
|
* SP_ERROR_OK
|
905
905
|
* SP_ERROR_MISSING_CALLBACK
|
906
906
|
* SP_ERROR_TRACK_NOT_PLAYABLE
|
907
|
-
*
|
907
|
+
*
|
908
908
|
*/
|
909
909
|
SP_LIBEXPORT(sp_error) sp_session_player_load(sp_session *session, sp_track *track);
|
910
910
|
|
@@ -1005,7 +1005,7 @@ SP_LIBEXPORT(sp_playlist *) sp_session_starred_for_user_create(sp_session *sessi
|
|
1005
1005
|
* Return the published container for a given @a canonical_username,
|
1006
1006
|
* or the currently logged in user if @a canonical_username is NULL.
|
1007
1007
|
*
|
1008
|
-
* When done with the list you should call sp_playlistconatiner_release() to
|
1008
|
+
* When done with the list you should call sp_playlistconatiner_release() to
|
1009
1009
|
* decrese the reference you own by having created it.
|
1010
1010
|
*
|
1011
1011
|
* @param[in] session Your session object.
|
@@ -1045,7 +1045,7 @@ SP_LIBEXPORT(sp_error) sp_session_preferred_offline_bitrate(sp_session *session,
|
|
1045
1045
|
* Return status of volume normalization
|
1046
1046
|
*
|
1047
1047
|
* @param[in] session Session object
|
1048
|
-
*
|
1048
|
+
*
|
1049
1049
|
* @return true iff volume normalization is enabled
|
1050
1050
|
*
|
1051
1051
|
*/
|
@@ -1248,16 +1248,16 @@ SP_LIBEXPORT(int) sp_session_user_country(sp_session *session);
|
|
1248
1248
|
* Link types
|
1249
1249
|
*/
|
1250
1250
|
typedef enum {
|
1251
|
-
|
1252
|
-
|
1253
|
-
|
1254
|
-
|
1255
|
-
|
1256
|
-
|
1257
|
-
|
1258
|
-
|
1259
|
-
|
1260
|
-
|
1251
|
+
SP_LINKTYPE_INVALID = 0, ///< Link type not valid - default until the library has parsed the link, or when parsing failed
|
1252
|
+
SP_LINKTYPE_TRACK = 1, ///< Link type is track
|
1253
|
+
SP_LINKTYPE_ALBUM = 2, ///< Link type is album
|
1254
|
+
SP_LINKTYPE_ARTIST = 3, ///< Link type is artist
|
1255
|
+
SP_LINKTYPE_SEARCH = 4, ///< Link type is search
|
1256
|
+
SP_LINKTYPE_PLAYLIST = 5, ///< Link type is playlist
|
1257
|
+
SP_LINKTYPE_PROFILE = 6, ///< Link type is profile
|
1258
|
+
SP_LINKTYPE_STARRED = 7, ///< Link type is starred
|
1259
|
+
SP_LINKTYPE_LOCALTRACK = 8, ///< Link type is a local file
|
1260
|
+
SP_LINKTYPE_IMAGE = 9, ///< Link type is an image
|
1261
1261
|
} sp_linktype;
|
1262
1262
|
|
1263
1263
|
/**
|
@@ -1773,10 +1773,10 @@ SP_LIBEXPORT(sp_error) sp_track_release(sp_track *track);
|
|
1773
1773
|
* Album types
|
1774
1774
|
*/
|
1775
1775
|
typedef enum {
|
1776
|
-
|
1777
|
-
|
1778
|
-
|
1779
|
-
|
1776
|
+
SP_ALBUMTYPE_ALBUM = 0, ///< Normal album
|
1777
|
+
SP_ALBUMTYPE_SINGLE = 1, ///< Single
|
1778
|
+
SP_ALBUMTYPE_COMPILATION = 2, ///< Compilation
|
1779
|
+
SP_ALBUMTYPE_UNKNOWN = 3, ///< Unknown type
|
1780
1780
|
} sp_albumtype;
|
1781
1781
|
|
1782
1782
|
/**
|
@@ -2332,8 +2332,8 @@ SP_LIBEXPORT(sp_error) sp_artistbrowse_release(sp_artistbrowse *arb);
|
|
2332
2332
|
* Image format
|
2333
2333
|
*/
|
2334
2334
|
typedef enum {
|
2335
|
-
|
2336
|
-
|
2335
|
+
SP_IMAGE_FORMAT_UNKNOWN = -1, ///< Unknown image format
|
2336
|
+
SP_IMAGE_FORMAT_JPEG = 0, ///< JPEG image
|
2337
2337
|
} sp_imageformat;
|
2338
2338
|
|
2339
2339
|
/**
|
@@ -2577,6 +2577,16 @@ SP_LIBEXPORT(sp_album *) sp_search_album(sp_search *search, int index);
|
|
2577
2577
|
*/
|
2578
2578
|
SP_LIBEXPORT(int) sp_search_num_playlists(sp_search *search);
|
2579
2579
|
|
2580
|
+
/**
|
2581
|
+
* Load the playlist at the given index in the given search object
|
2582
|
+
*
|
2583
|
+
* @param[in] search Search object
|
2584
|
+
* @param[in] index Index of the wanted playlist. Should be in the interval [0, sp_search_num_playlists() - 1]
|
2585
|
+
*
|
2586
|
+
* @return A playlist object. This reference is owned by the caller and should be released with sp_playlist_release()
|
2587
|
+
*/
|
2588
|
+
SP_LIBEXPORT(sp_playlist *) sp_search_playlist(sp_search *search, int index);
|
2589
|
+
|
2580
2590
|
/**
|
2581
2591
|
* Return the playlist at the given index in the given search object
|
2582
2592
|
*
|
@@ -2731,142 +2741,142 @@ SP_LIBEXPORT(sp_error) sp_search_release(sp_search *search);
|
|
2731
2741
|
*/
|
2732
2742
|
typedef struct sp_playlist_callbacks {
|
2733
2743
|
|
2734
|
-
|
2735
|
-
|
2736
|
-
|
2737
|
-
|
2738
|
-
|
2739
|
-
|
2740
|
-
|
2741
|
-
|
2742
|
-
|
2743
|
-
|
2744
|
-
|
2745
|
-
|
2746
|
-
|
2747
|
-
|
2748
|
-
|
2749
|
-
|
2750
|
-
|
2751
|
-
|
2752
|
-
|
2753
|
-
|
2754
|
-
|
2755
|
-
|
2756
|
-
|
2757
|
-
|
2758
|
-
|
2759
|
-
|
2760
|
-
|
2761
|
-
|
2762
|
-
|
2763
|
-
|
2764
|
-
|
2765
|
-
|
2766
|
-
|
2767
|
-
|
2768
|
-
|
2769
|
-
|
2770
|
-
|
2771
|
-
|
2772
|
-
|
2773
|
-
|
2774
|
-
|
2775
|
-
|
2776
|
-
|
2777
|
-
|
2778
|
-
|
2779
|
-
|
2780
|
-
|
2781
|
-
|
2782
|
-
|
2783
|
-
|
2784
|
-
|
2785
|
-
|
2786
|
-
|
2787
|
-
|
2788
|
-
|
2789
|
-
|
2790
|
-
|
2791
|
-
|
2792
|
-
|
2793
|
-
|
2794
|
-
|
2795
|
-
|
2796
|
-
|
2797
|
-
|
2798
|
-
|
2799
|
-
|
2800
|
-
|
2801
|
-
|
2802
|
-
|
2803
|
-
|
2804
|
-
|
2805
|
-
|
2806
|
-
|
2807
|
-
|
2808
|
-
|
2809
|
-
|
2810
|
-
|
2811
|
-
|
2812
|
-
|
2813
|
-
|
2814
|
-
|
2815
|
-
|
2816
|
-
|
2817
|
-
|
2818
|
-
|
2819
|
-
|
2820
|
-
|
2821
|
-
|
2822
|
-
|
2823
|
-
|
2824
|
-
|
2825
|
-
|
2826
|
-
|
2827
|
-
|
2828
|
-
|
2829
|
-
|
2830
|
-
|
2831
|
-
|
2832
|
-
|
2833
|
-
|
2834
|
-
|
2835
|
-
|
2836
|
-
|
2837
|
-
|
2838
|
-
|
2839
|
-
|
2840
|
-
|
2841
|
-
|
2842
|
-
|
2843
|
-
|
2844
|
-
|
2845
|
-
|
2846
|
-
|
2847
|
-
|
2848
|
-
|
2849
|
-
|
2850
|
-
|
2851
|
-
|
2852
|
-
|
2853
|
-
|
2854
|
-
|
2855
|
-
|
2856
|
-
|
2857
|
-
|
2858
|
-
|
2859
|
-
|
2860
|
-
|
2861
|
-
|
2862
|
-
|
2863
|
-
|
2864
|
-
|
2865
|
-
|
2866
|
-
|
2867
|
-
|
2868
|
-
|
2869
|
-
|
2744
|
+
/**
|
2745
|
+
* Called when one or more tracks have been added to a playlist
|
2746
|
+
*
|
2747
|
+
* @param[in] pl Playlist object
|
2748
|
+
* @param[in] tracks Array of pointers to track objects
|
2749
|
+
* @param[in] num_tracks Number of entries in \p tracks
|
2750
|
+
* @param[in] position Position in the playlist for the first track.
|
2751
|
+
* @param[in] userdata Userdata passed to sp_playlist_add_callbacks()
|
2752
|
+
*/
|
2753
|
+
void (SP_CALLCONV *tracks_added)(sp_playlist *pl, sp_track * const *tracks, int num_tracks, int position, void *userdata);
|
2754
|
+
|
2755
|
+
/**
|
2756
|
+
* Called when one or more tracks have been removed from a playlist
|
2757
|
+
*
|
2758
|
+
* @param[in] pl Playlist object
|
2759
|
+
* @param[in] tracks Array of positions representing the tracks that were removed
|
2760
|
+
* @param[in] num_tracks Number of entries in \p tracks
|
2761
|
+
* @param[in] userdata Userdata passed to sp_playlist_add_callbacks()
|
2762
|
+
*/
|
2763
|
+
void (SP_CALLCONV *tracks_removed)(sp_playlist *pl, const int *tracks, int num_tracks, void *userdata);
|
2764
|
+
|
2765
|
+
/**
|
2766
|
+
* Called when one or more tracks have been moved within a playlist
|
2767
|
+
*
|
2768
|
+
* @param[in] pl Playlist object
|
2769
|
+
* @param[in] tracks Array of positions representing the tracks that were moved
|
2770
|
+
* @param[in] num_tracks Number of entries in \p tracks
|
2771
|
+
* @param[in] position New position in the playlist for the first track.
|
2772
|
+
* @param[in] userdata Userdata passed to sp_playlist_add_callbacks()
|
2773
|
+
*/
|
2774
|
+
void (SP_CALLCONV *tracks_moved)(sp_playlist *pl, const int *tracks, int num_tracks, int new_position, void *userdata);
|
2775
|
+
|
2776
|
+
/**
|
2777
|
+
* Called when a playlist has been renamed. sp_playlist_name() can be used to find out the new name
|
2778
|
+
*
|
2779
|
+
* @param[in] pl Playlist object
|
2780
|
+
* @param[in] userdata Userdata passed to sp_playlist_add_callbacks()
|
2781
|
+
*/
|
2782
|
+
void (SP_CALLCONV *playlist_renamed)(sp_playlist *pl, void *userdata);
|
2783
|
+
|
2784
|
+
/**
|
2785
|
+
* Called when state changed for a playlist.
|
2786
|
+
*
|
2787
|
+
* There are three states that trigger this callback:
|
2788
|
+
* - Collaboration for this playlist has been turned on or off
|
2789
|
+
* - The playlist started having pending changes, or all pending changes have now been committed
|
2790
|
+
* - The playlist started loading, or finished loading
|
2791
|
+
*
|
2792
|
+
* @param[in] pl Playlist object
|
2793
|
+
* @param[in] userdata Userdata passed to sp_playlist_add_callbacks()
|
2794
|
+
* @sa sp_playlist_is_collaborative
|
2795
|
+
* @sa sp_playlist_has_pending_changes
|
2796
|
+
* @sa sp_playlist_is_loaded
|
2797
|
+
*/
|
2798
|
+
void (SP_CALLCONV *playlist_state_changed)(sp_playlist *pl, void *userdata);
|
2799
|
+
|
2800
|
+
/**
|
2801
|
+
* Called when a playlist is updating or is done updating
|
2802
|
+
*
|
2803
|
+
* This is called before and after a series of changes are applied to the
|
2804
|
+
* playlist. It allows e.g. the user interface to defer updating until the
|
2805
|
+
* entire operation is complete.
|
2806
|
+
*
|
2807
|
+
* @param[in] pl Playlist object
|
2808
|
+
* @param[in] done True iff the update is completed
|
2809
|
+
* @param[in] userdata Userdata passed to sp_playlist_add_callbacks()
|
2810
|
+
*/
|
2811
|
+
void (SP_CALLCONV *playlist_update_in_progress)(sp_playlist *pl, bool done, void *userdata);
|
2812
|
+
|
2813
|
+
/**
|
2814
|
+
* Called when metadata for one or more tracks in a playlist has been updated.
|
2815
|
+
*
|
2816
|
+
* @param[in] pl Playlist object
|
2817
|
+
* @param[in] userdata Userdata passed to sp_playlist_add_callbacks()
|
2818
|
+
*/
|
2819
|
+
void (SP_CALLCONV *playlist_metadata_updated)(sp_playlist *pl, void *userdata);
|
2820
|
+
|
2821
|
+
/**
|
2822
|
+
* Called when create time and/or creator for a playlist entry changes
|
2823
|
+
*
|
2824
|
+
* @param[in] pl Playlist object
|
2825
|
+
* @param[in] position Position in playlist
|
2826
|
+
* @param[in] user User object
|
2827
|
+
* @param[in] time When entry was created, seconds since the unix epoch.
|
2828
|
+
* @param[in] userdata Userdata passed to sp_playlist_add_callbacks()
|
2829
|
+
*/
|
2830
|
+
void (SP_CALLCONV *track_created_changed)(sp_playlist *pl, int position, sp_user *user, int when, void *userdata);
|
2831
|
+
|
2832
|
+
/**
|
2833
|
+
* Called when seen attribute for a playlist entry changes.
|
2834
|
+
*
|
2835
|
+
* @param[in] pl Playlist object
|
2836
|
+
* @param[in] position Position in playlist
|
2837
|
+
* @param[in] seen Set if entry it marked as seen
|
2838
|
+
* @param[in] userdata Userdata passed to sp_playlist_add_callbacks()
|
2839
|
+
*/
|
2840
|
+
void (SP_CALLCONV *track_seen_changed)(sp_playlist *pl, int position, bool seen, void *userdata);
|
2841
|
+
|
2842
|
+
/**
|
2843
|
+
* Called when playlist description has changed
|
2844
|
+
*
|
2845
|
+
* @param[in] pl Playlist object
|
2846
|
+
* @param[in] desc New description
|
2847
|
+
* @param[in] userdata Userdata passed to sp_playlist_add_callbacks()
|
2848
|
+
*/
|
2849
|
+
void (SP_CALLCONV *description_changed)(sp_playlist *pl, const char *desc, void *userdata);
|
2850
|
+
|
2851
|
+
|
2852
|
+
/**
|
2853
|
+
* Called when playlist image has changed
|
2854
|
+
*
|
2855
|
+
* @param[in] pl Playlist object
|
2856
|
+
* @param[in] image New image
|
2857
|
+
* @param[in] userdata Userdata passed to sp_playlist_add_callbacks()
|
2858
|
+
*/
|
2859
|
+
void (SP_CALLCONV *image_changed)(sp_playlist *pl, const byte *image, void *userdata);
|
2860
|
+
|
2861
|
+
|
2862
|
+
/**
|
2863
|
+
* Called when message attribute for a playlist entry changes.
|
2864
|
+
*
|
2865
|
+
* @param[in] pl Playlist object
|
2866
|
+
* @param[in] position Position in playlist
|
2867
|
+
* @param[in] message UTF-8 encoded message
|
2868
|
+
* @param[in] userdata Userdata passed to sp_playlist_add_callbacks()
|
2869
|
+
*/
|
2870
|
+
void (SP_CALLCONV *track_message_changed)(sp_playlist *pl, int position, const char *message, void *userdata);
|
2871
|
+
|
2872
|
+
|
2873
|
+
/**
|
2874
|
+
* Called when playlist subscribers changes (count or list of names)
|
2875
|
+
*
|
2876
|
+
* @param[in] pl Playlist object
|
2877
|
+
* @param[in] userdata Userdata passed to sp_playlist_add_callbacks()
|
2878
|
+
*/
|
2879
|
+
void (SP_CALLCONV *subscribers_changed)(sp_playlist *pl, void *userdata);
|
2870
2880
|
|
2871
2881
|
} sp_playlist_callbacks;
|
2872
2882
|
|
@@ -3310,46 +3320,46 @@ SP_LIBEXPORT(sp_error) sp_playlist_release(sp_playlist *playlist);
|
|
3310
3320
|
* @see sp_playlistcontainer_remove_callbacks
|
3311
3321
|
*/
|
3312
3322
|
typedef struct sp_playlistcontainer_callbacks {
|
3313
|
-
|
3314
|
-
|
3315
|
-
|
3316
|
-
|
3317
|
-
|
3318
|
-
|
3319
|
-
|
3320
|
-
|
3321
|
-
|
3322
|
-
|
3323
|
-
|
3324
|
-
|
3325
|
-
|
3326
|
-
|
3327
|
-
|
3328
|
-
|
3329
|
-
|
3330
|
-
|
3331
|
-
|
3332
|
-
|
3333
|
-
|
3334
|
-
|
3335
|
-
|
3336
|
-
|
3337
|
-
|
3338
|
-
|
3339
|
-
|
3340
|
-
|
3341
|
-
|
3342
|
-
|
3343
|
-
|
3344
|
-
|
3345
|
-
|
3346
|
-
|
3347
|
-
|
3348
|
-
|
3349
|
-
|
3350
|
-
|
3351
|
-
|
3352
|
-
|
3323
|
+
/**
|
3324
|
+
* Called when a new playlist has been added to the playlist container.
|
3325
|
+
*
|
3326
|
+
* @param[in] pc Playlist container
|
3327
|
+
* @param[in] playlist Playlist object.
|
3328
|
+
* @param[in] position Position in list
|
3329
|
+
* @param[in] userdata Userdata as set in sp_playlistcontainer_add_callbacks()
|
3330
|
+
*/
|
3331
|
+
void (SP_CALLCONV *playlist_added)(sp_playlistcontainer *pc, sp_playlist *playlist, int position, void *userdata);
|
3332
|
+
|
3333
|
+
|
3334
|
+
/**
|
3335
|
+
* Called when a new playlist has been removed from playlist container
|
3336
|
+
*
|
3337
|
+
* @param[in] pc Playlist container
|
3338
|
+
* @param[in] playlist Playlist object.
|
3339
|
+
* @param[in] position Position in list
|
3340
|
+
* @param[in] userdata Userdata as set in sp_playlistcontainer_add_callbacks()
|
3341
|
+
*/
|
3342
|
+
void (SP_CALLCONV *playlist_removed)(sp_playlistcontainer *pc, sp_playlist *playlist, int position, void *userdata);
|
3343
|
+
|
3344
|
+
|
3345
|
+
/**
|
3346
|
+
* Called when a playlist has been moved in the playlist container
|
3347
|
+
*
|
3348
|
+
* @param[in] pc Playlist container
|
3349
|
+
* @param[in] playlist Playlist object.
|
3350
|
+
* @param[in] position Previous position in playlist container list
|
3351
|
+
* @param[in] new_position New position in playlist container list
|
3352
|
+
* @param[in] userdata Userdata as set in sp_playlistcontainer_add_callbacks()
|
3353
|
+
*/
|
3354
|
+
void (SP_CALLCONV *playlist_moved)(sp_playlistcontainer *pc, sp_playlist *playlist, int position, int new_position, void *userdata);
|
3355
|
+
|
3356
|
+
/**
|
3357
|
+
* Called when the playlist container is loaded
|
3358
|
+
*
|
3359
|
+
* @param[in] pc Playlist container
|
3360
|
+
* @param[in] userdata Userdata as set in sp_playlistcontainer_add_callbacks()
|
3361
|
+
*/
|
3362
|
+
void (SP_CALLCONV *container_loaded)(sp_playlistcontainer *pc, void *userdata);
|
3353
3363
|
} sp_playlistcontainer_callbacks;
|
3354
3364
|
|
3355
3365
|
|
@@ -3539,7 +3549,7 @@ SP_LIBEXPORT(sp_error) sp_playlistcontainer_add_folder(sp_playlistcontainer *pc,
|
|
3539
3549
|
* Return a pointer to the user object of the owner.
|
3540
3550
|
*
|
3541
3551
|
* @param[in] pc Playlist container.
|
3542
|
-
* @return The user object or NULL if unknown or none.
|
3552
|
+
* @return The user object or NULL if unknown or none.
|
3543
3553
|
*/
|
3544
3554
|
SP_LIBEXPORT(sp_user *) sp_playlistcontainer_owner(sp_playlistcontainer *pc);
|
3545
3555
|
|
@@ -3669,9 +3679,9 @@ SP_LIBEXPORT(sp_error) sp_user_release(sp_user *user);
|
|
3669
3679
|
* Toplist types
|
3670
3680
|
*/
|
3671
3681
|
typedef enum {
|
3672
|
-
|
3673
|
-
|
3674
|
-
|
3682
|
+
SP_TOPLIST_TYPE_ARTISTS = 0, ///< Top artists
|
3683
|
+
SP_TOPLIST_TYPE_ALBUMS = 1, ///< Top albums
|
3684
|
+
SP_TOPLIST_TYPE_TRACKS = 2, ///< Top tracks
|
3675
3685
|
} sp_toplisttype;
|
3676
3686
|
|
3677
3687
|
|
@@ -3688,8 +3698,8 @@ typedef enum {
|
|
3688
3698
|
* Special toplist regions
|
3689
3699
|
*/
|
3690
3700
|
typedef enum {
|
3691
|
-
|
3692
|
-
|
3701
|
+
SP_TOPLIST_REGION_EVERYWHERE = 0, ///< Global toplist
|
3702
|
+
SP_TOPLIST_REGION_USER = 1, ///< Toplist for a given user
|
3693
3703
|
} sp_toplistregion;
|
3694
3704
|
|
3695
3705
|
|
@@ -3859,7 +3869,7 @@ SP_LIBEXPORT(int) sp_toplistbrowse_backend_request_duration(sp_toplistbrowse *tl
|
|
3859
3869
|
typedef void SP_CALLCONV inboxpost_complete_cb(sp_inbox *result, void *userdata);
|
3860
3870
|
|
3861
3871
|
/**
|
3862
|
-
* Add to inbox
|
3872
|
+
* Add to inbox
|
3863
3873
|
*
|
3864
3874
|
* @param[in] session Session object
|
3865
3875
|
* @param[in] user Canonical username of recipient
|