spotify 8.0.5 → 9.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +58 -0
- data/lib/spotify.rb +18 -5
- data/lib/spotify/version.rb +1 -1
- data/spec/api.h +130 -38
- data/spec/spotify_spec.rb +5 -8
- data/spotify.gemspec +4 -3
- metadata +28 -16
data/CHANGELOG.md
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
[v8.0.5][]
|
2
|
+
----------
|
3
|
+
- improve documentation and remove YARD plugin
|
4
|
+
- add specs for return type and argument types of functions
|
5
|
+
- fix return type and arguments for a bunch of functions
|
6
|
+
- add typedefs for spotify pointers (makes better docs)
|
7
|
+
- allow setting SessionConfig boolean values to true/false
|
8
|
+
- optimize by using `:buffer_out` where applicable
|
9
|
+
|
10
|
+
[v8.0.2][]
|
11
|
+
----------
|
12
|
+
- fix arguments of `image_create`
|
13
|
+
|
14
|
+
[v8.0.1][]
|
15
|
+
----------
|
16
|
+
- mark some session functions as blocking
|
17
|
+
|
18
|
+
[v8.0.0][]
|
19
|
+
----------
|
20
|
+
- upgrade to libspotify v0.0.8 compatibility
|
21
|
+
- 96k bitrate
|
22
|
+
- offline functionality
|
23
|
+
- improved image support
|
24
|
+
|
25
|
+
[v7.0.4][]
|
26
|
+
----------
|
27
|
+
- improve documentation
|
28
|
+
|
29
|
+
[v7.0.3][]
|
30
|
+
----------
|
31
|
+
- adjust definitions for 1.8.7 compatibility
|
32
|
+
|
33
|
+
[v7.0.2][]
|
34
|
+
----------
|
35
|
+
- insignificant
|
36
|
+
|
37
|
+
[v7.0.1][]
|
38
|
+
----------
|
39
|
+
- participate in http://test.rubygems.org/
|
40
|
+
|
41
|
+
[v7.0.0][]
|
42
|
+
----------
|
43
|
+
- first release
|
44
|
+
- add all function definitions and structs
|
45
|
+
|
46
|
+
v0.0.0
|
47
|
+
------
|
48
|
+
- release to register rubygems.org name
|
49
|
+
|
50
|
+
[v8.0.5]: https://github.com/Burgestrand/libspotify-ruby/compare/v8.0.2...v8.0.5
|
51
|
+
[v8.0.2]: https://github.com/Burgestrand/libspotify-ruby/compare/v8.0.1...v8.0.2
|
52
|
+
[v8.0.1]: https://github.com/Burgestrand/libspotify-ruby/compare/v8.0.0...v8.0.1
|
53
|
+
[v8.0.0]: https://github.com/Burgestrand/libspotify-ruby/compare/v7.0.4...v8.0.0
|
54
|
+
[v7.0.4]: https://github.com/Burgestrand/libspotify-ruby/compare/v7.0.3...v7.0.4
|
55
|
+
[v7.0.3]: https://github.com/Burgestrand/libspotify-ruby/compare/v7.0.2...v7.0.3
|
56
|
+
[v7.0.2]: https://github.com/Burgestrand/libspotify-ruby/compare/v7.0.1...v7.0.2
|
57
|
+
[v7.0.1]: https://github.com/Burgestrand/libspotify-ruby/compare/v7.0.0...v7.0.1
|
58
|
+
[v7.0.0]: https://github.com/Burgestrand/libspotify-ruby/compare/v0.0.0...v7.0.0
|
data/lib/spotify.rb
CHANGED
@@ -70,7 +70,7 @@ module Spotify
|
|
70
70
|
:index_out_of_range, :user_needs_premium,
|
71
71
|
:other_transient, :is_loading, :no_stream_available,
|
72
72
|
:permission_denied, :inbox_is_full, :no_cache,
|
73
|
-
:no_such_user]
|
73
|
+
:no_such_user, :no_credentials]
|
74
74
|
|
75
75
|
# @macro [attach] attach_function
|
76
76
|
#
|
@@ -80,6 +80,12 @@ module Spotify
|
|
80
80
|
# @return [$4]
|
81
81
|
attach_function :error_message, :sp_error_message, [ :error ], :string
|
82
82
|
|
83
|
+
#
|
84
|
+
# Miscellaneous
|
85
|
+
#
|
86
|
+
# These don’t fit anywhere else :(
|
87
|
+
attach_function :build_id, :sp_build_id, [], :string
|
88
|
+
|
83
89
|
#
|
84
90
|
# Audio
|
85
91
|
#
|
@@ -200,7 +206,7 @@ module Spotify
|
|
200
206
|
end
|
201
207
|
|
202
208
|
#
|
203
|
-
enum :connectionstate, [:logged_out, :logged_in, :disconnected, :undefined]
|
209
|
+
enum :connectionstate, [:logged_out, :logged_in, :disconnected, :undefined, :offline]
|
204
210
|
|
205
211
|
#
|
206
212
|
enum :connection_type, [:unknown, :none, :mobile, :mobile_roaming, :wifi, :wired]
|
@@ -215,7 +221,10 @@ module Spotify
|
|
215
221
|
attach_function :session_release, :sp_session_release, [ :session ], :void
|
216
222
|
|
217
223
|
attach_function :session_process_events, :sp_session_process_events, [ :session, :buffer_out ], :void, :blocking => true
|
218
|
-
attach_function :session_login, :sp_session_login, [ :session, :string, :string ], :void, :blocking => true
|
224
|
+
attach_function :session_login, :sp_session_login, [ :session, :string, :string, :bool ], :void, :blocking => true
|
225
|
+
attach_function :session_relogin, :sp_session_relogin, [ :session ], :error
|
226
|
+
attach_function :session_forget_me, :sp_session_forget_me, [ :session ], :void
|
227
|
+
attach_function :session_remembered_user, :sp_session_remembered_user, [ :session, :buffer_out, :size_t ], :int
|
219
228
|
|
220
229
|
attach_function :session_user, :sp_session_user, [ :session ], :user
|
221
230
|
attach_function :session_logout, :sp_session_logout, [ :session ], :void
|
@@ -238,9 +247,12 @@ module Spotify
|
|
238
247
|
|
239
248
|
attach_function :session_set_connection_type, :sp_session_set_connection_type, [ :session, :connection_type ], :void
|
240
249
|
attach_function :session_set_connection_rules, :sp_session_set_connection_rules, [ :session, :connection_rules ], :void
|
250
|
+
|
241
251
|
attach_function :offline_tracks_to_sync, :sp_offline_tracks_to_sync, [ :session ], :int
|
242
252
|
attach_function :offline_num_playlists, :sp_offline_num_playlists, [ :session ], :int
|
243
|
-
attach_function :offline_sync_get_status, :sp_offline_sync_get_status, [ :session, OfflineSyncStatus ], :
|
253
|
+
attach_function :offline_sync_get_status, :sp_offline_sync_get_status, [ :session, OfflineSyncStatus ], :bool
|
254
|
+
attach_function :offline_time_left, :sp_offline_time_left, [ :session ], :int
|
255
|
+
|
244
256
|
attach_function :session_user_country, :sp_session_user_country, [ :session ], :int
|
245
257
|
attach_function :session_preferred_offline_bitrate, :sp_session_preferred_offline_bitrate, [ :session, :bitrate, :bool ], :void
|
246
258
|
|
@@ -259,7 +271,8 @@ module Spotify
|
|
259
271
|
attach_function :link_create_from_artist, :sp_link_create_from_artist, [ :artist ], :link
|
260
272
|
attach_function :link_create_from_search, :sp_link_create_from_search, [ :search ], :link
|
261
273
|
attach_function :link_create_from_playlist, :sp_link_create_from_playlist, [ :playlist ], :link
|
262
|
-
attach_function :link_create_from_artist_portrait, :sp_link_create_from_artist_portrait, [ :artist
|
274
|
+
attach_function :link_create_from_artist_portrait, :sp_link_create_from_artist_portrait, [ :artist ], :link
|
275
|
+
attach_function :link_create_from_artistbrowse_portrait, :sp_link_create_from_artistbrowse_portrait, [ :artistbrowse, :int ], :link
|
263
276
|
attach_function :link_create_from_album_cover, :sp_link_create_from_album_cover, [ :album ], :link
|
264
277
|
attach_function :link_create_from_image, :sp_link_create_from_image, [ :image ], :link
|
265
278
|
attach_function :link_create_from_user, :sp_link_create_from_user, [ :user ], :link
|
data/lib/spotify/version.rb
CHANGED
data/spec/api.h
CHANGED
@@ -97,25 +97,25 @@ typedef enum sp_error {
|
|
97
97
|
SP_ERROR_BAD_API_VERSION = 1, ///< The library version targeted does not match the one you claim you support
|
98
98
|
SP_ERROR_API_INITIALIZATION_FAILED = 2, ///< Initialization of library failed - are cache locations etc. valid?
|
99
99
|
SP_ERROR_TRACK_NOT_PLAYABLE = 3, ///< The track specified for playing cannot be played
|
100
|
-
SP_ERROR_RESOURCE_NOT_LOADED = 4, ///< One or several of the supplied resources is not yet loaded
|
101
100
|
SP_ERROR_BAD_APPLICATION_KEY = 5, ///< The application key is invalid
|
102
101
|
SP_ERROR_BAD_USERNAME_OR_PASSWORD = 6, ///< Login failed because of bad username and/or password
|
103
102
|
SP_ERROR_USER_BANNED = 7, ///< The specified username is banned
|
104
103
|
SP_ERROR_UNABLE_TO_CONTACT_SERVER = 8, ///< Cannot connect to the Spotify backend system
|
105
104
|
SP_ERROR_CLIENT_TOO_OLD = 9, ///< Client is too old, library will need to be updated
|
106
|
-
SP_ERROR_OTHER_PERMANENT = 10, ///< Some other error
|
105
|
+
SP_ERROR_OTHER_PERMANENT = 10, ///< Some other error occurred, and it is permanent (e.g. trying to relogin will not help)
|
107
106
|
SP_ERROR_BAD_USER_AGENT = 11, ///< The user agent string is invalid or too long
|
108
107
|
SP_ERROR_MISSING_CALLBACK = 12, ///< No valid callback registered to handle events
|
109
108
|
SP_ERROR_INVALID_INDATA = 13, ///< Input data was either missing or invalid
|
110
109
|
SP_ERROR_INDEX_OUT_OF_RANGE = 14, ///< Index out of range
|
111
110
|
SP_ERROR_USER_NEEDS_PREMIUM = 15, ///< The specified user needs a premium account
|
112
|
-
SP_ERROR_OTHER_TRANSIENT = 16, ///< A transient error
|
111
|
+
SP_ERROR_OTHER_TRANSIENT = 16, ///< A transient error occurred.
|
113
112
|
SP_ERROR_IS_LOADING = 17, ///< The resource is currently loading
|
114
113
|
SP_ERROR_NO_STREAM_AVAILABLE = 18, ///< Could not find any suitable stream to play
|
115
114
|
SP_ERROR_PERMISSION_DENIED = 19, ///< Requested operation is not allowed
|
116
115
|
SP_ERROR_INBOX_IS_FULL = 20, ///< Target inbox is full
|
117
116
|
SP_ERROR_NO_CACHE = 21, ///< Cache is not enabled
|
118
117
|
SP_ERROR_NO_SUCH_USER = 22, ///< Requested user does not exist
|
118
|
+
SP_ERROR_NO_CREDENTIALS = 23, ///< No credentials are stored
|
119
119
|
} sp_error;
|
120
120
|
|
121
121
|
/**
|
@@ -147,7 +147,7 @@ SP_LIBEXPORT(const char*) sp_error_message(sp_error error);
|
|
147
147
|
* returned from sp_session_create(). Future versions of the library will provide you with some kind of mechanism
|
148
148
|
* to request an updated version of the library.
|
149
149
|
*/
|
150
|
-
#define SPOTIFY_API_VERSION
|
150
|
+
#define SPOTIFY_API_VERSION 9
|
151
151
|
|
152
152
|
/**
|
153
153
|
* Describes the current state of the connection
|
@@ -157,6 +157,7 @@ typedef enum sp_connectionstate {
|
|
157
157
|
SP_CONNECTION_STATE_LOGGED_IN = 1, ///< Logged in against a Spotify access point
|
158
158
|
SP_CONNECTION_STATE_DISCONNECTED = 2, ///< Was logged in, but has now been disconnected
|
159
159
|
SP_CONNECTION_STATE_UNDEFINED = 3, ///< The connection state is undefined
|
160
|
+
SP_CONNECTION_STATE_OFFLINE = 4 ///< Logged in in offline mode
|
160
161
|
} sp_connectionstate;
|
161
162
|
|
162
163
|
|
@@ -195,7 +196,7 @@ typedef enum sp_playlist_type {
|
|
195
196
|
SP_PLAYLIST_TYPE_PLACEHOLDER = 3, ///< Unknown entry.
|
196
197
|
} sp_playlist_type;
|
197
198
|
|
198
|
-
|
199
|
+
/**
|
199
200
|
* Playlist offline status
|
200
201
|
*/
|
201
202
|
typedef enum sp_playlist_offline_status {
|
@@ -217,7 +218,7 @@ typedef struct sp_audio_buffer_stats {
|
|
217
218
|
* List of subscribers returned by sp_playlist_subscribers()
|
218
219
|
*/
|
219
220
|
typedef struct sp_subscribers {
|
220
|
-
unsigned int count;
|
221
|
+
unsigned int count; ///< Number of elements in 'subscribers'
|
221
222
|
char *subscribers[1]; ///< Actual size is 'count'. Array of pointers to canonical usernames
|
222
223
|
} sp_subscribers;
|
223
224
|
|
@@ -388,7 +389,7 @@ typedef struct sp_session_callbacks {
|
|
388
389
|
* @param[in] format Audio format descriptor sp_audioformat
|
389
390
|
* @param[in] frames Points to raw PCM data as described by \p format
|
390
391
|
* @param[in] num_frames Number of available samples in \p frames.
|
391
|
-
* If this is 0, a discontinuity has
|
392
|
+
* If this is 0, a discontinuity has occurred (such as after a seek). The application
|
392
393
|
* should flush its audio fifos, etc.
|
393
394
|
*
|
394
395
|
* @return Number of frames consumed.
|
@@ -503,11 +504,14 @@ typedef struct sp_session_callbacks {
|
|
503
504
|
typedef struct sp_session_config {
|
504
505
|
int api_version; ///< The version of the Spotify API your application is compiled with. Set to #SPOTIFY_API_VERSION
|
505
506
|
const char *cache_location; /**< The location where Spotify will write cache files.
|
506
|
-
* This cache include tracks, cached browse results and coverarts
|
507
|
+
* This cache include tracks, cached browse results and coverarts.
|
507
508
|
* Set to empty string ("") to disable cache
|
508
509
|
*/
|
509
510
|
const char *settings_location; /**< The location where Spotify will write setting files and per-user
|
510
|
-
* cache items. This includes playlists, track metadata, etc
|
511
|
+
* cache items. This includes playlists, track metadata, etc.
|
512
|
+
* 'settings_location' may be the same path as 'cache_location'.
|
513
|
+
* 'settings_location' folder will not be created (unlike 'cache_location'),
|
514
|
+
* if you don't want to create the folder yourself, you can set 'settings_location' to 'cache_location'.
|
511
515
|
*/
|
512
516
|
const void *application_key; ///< Your application key
|
513
517
|
size_t application_key_size; ///< The size of the application key in bytes
|
@@ -525,7 +529,7 @@ typedef struct sp_session_config {
|
|
525
529
|
|
526
530
|
/**
|
527
531
|
* Don't save metadata for local copies of playlists
|
528
|
-
* Reduces disk space usage at the
|
532
|
+
* Reduces disk space usage at the expense of needing
|
529
533
|
* to request metadata from Spotify backend when loading list
|
530
534
|
*/
|
531
535
|
bool dont_save_metadata_for_playlists;
|
@@ -540,6 +544,7 @@ typedef struct sp_session_config {
|
|
540
544
|
/**
|
541
545
|
* Initialize a session. The session returned will be initialized, but you will need
|
542
546
|
* to log in before you can perform any other operation
|
547
|
+
* Currently it is not supported to have multiple active sessions, and it's recommended to only call this once per process.
|
543
548
|
*
|
544
549
|
* Here is a snippet from \c spshell.c:
|
545
550
|
* @dontinclude spshell.c
|
@@ -565,21 +570,65 @@ SP_LIBEXPORT(sp_error) sp_session_create(const sp_session_config *config, sp_ses
|
|
565
570
|
*/
|
566
571
|
SP_LIBEXPORT(void) sp_session_release(sp_session *sess);
|
567
572
|
|
573
|
+
|
568
574
|
/**
|
569
|
-
* Logs in the specified username/password combo. This initiates the
|
575
|
+
* Logs in the specified username/password combo. This initiates the login in the background.
|
570
576
|
* A callback is called when login is complete
|
571
577
|
*
|
578
|
+
* An application MUST NEVER store the user's password in clear text.
|
579
|
+
* If automatic relogin is required, use sp_session_relogin()
|
580
|
+
*
|
572
581
|
* Here is a snippet from \c spshell.c:
|
573
582
|
* @dontinclude spshell.c
|
574
583
|
* @skip sp_session_login
|
575
584
|
* @until }
|
576
585
|
*
|
577
|
-
* @param[in] session
|
578
|
-
* @param[in] username
|
579
|
-
* @param[in] password
|
586
|
+
* @param[in] session Your session object
|
587
|
+
* @param[in] username The username to log in
|
588
|
+
* @param[in] password The password for the specified username
|
589
|
+
* @param[in] remember_me If set, the username / password will be remembered by libspotify
|
590
|
+
*
|
591
|
+
*/
|
592
|
+
SP_LIBEXPORT(void) sp_session_login(sp_session *session, const char *username, const char *password, bool remember_me);
|
593
|
+
|
594
|
+
|
595
|
+
/**
|
596
|
+
* Log in the remembered user if last user that logged in logged in with remember_me set.
|
597
|
+
* If no credentials are stored, this will return SP_ERROR_NO_CREDENTIALS.
|
598
|
+
*
|
599
|
+
* @param[in] session Your session object
|
600
|
+
*
|
601
|
+
* @return One of the following errors, from ::sp_error
|
602
|
+
* SP_ERROR_OK
|
603
|
+
* SP_ERROR_NO_CREDENTIALS
|
604
|
+
*/
|
605
|
+
SP_LIBEXPORT(sp_error) sp_session_relogin(sp_session *session);
|
606
|
+
|
607
|
+
|
608
|
+
/**
|
609
|
+
* Get username of the user that will be logged in via sp_session_relogin()
|
610
|
+
*
|
611
|
+
* @param[in] session Your session object
|
612
|
+
* @param[out] buffer The buffer to hold the username
|
613
|
+
* @param[in] buffer_size The max size of the buffer that will hold the username.
|
614
|
+
* The resulting string is guaranteed to always be null terminated if
|
615
|
+
* buffer_size > 0
|
580
616
|
*
|
617
|
+
* @return The number of characters in the username.
|
618
|
+
* If value is greater or equal than \p buffer_size, output was truncated.
|
619
|
+
* If returned value is -1 no credentials are stored in libspotify.
|
581
620
|
*/
|
582
|
-
SP_LIBEXPORT(
|
621
|
+
SP_LIBEXPORT(int) sp_session_remembered_user(sp_session *session, char *buffer, size_t buffer_size);
|
622
|
+
|
623
|
+
|
624
|
+
/**
|
625
|
+
* Remove stored credentials in libspotify. If no credentials are currently stored, nothing will happen.
|
626
|
+
*
|
627
|
+
* @param[in] session Your session object
|
628
|
+
*
|
629
|
+
*/
|
630
|
+
SP_LIBEXPORT(void) sp_session_forget_me(sp_session *session);
|
631
|
+
|
583
632
|
|
584
633
|
/**
|
585
634
|
* Fetches the currently logged in user
|
@@ -716,7 +765,7 @@ SP_LIBEXPORT(sp_playlistcontainer *) sp_session_playlistcontainer(sp_session *se
|
|
716
765
|
*
|
717
766
|
* @param[in] session Session object
|
718
767
|
*
|
719
|
-
* @return A playlist
|
768
|
+
* @return A playlist or NULL if no user is logged in
|
720
769
|
* @note You need to release the playlist when you are done with it.
|
721
770
|
* @see sp_playlist_release()
|
722
771
|
*/
|
@@ -727,7 +776,7 @@ SP_LIBEXPORT(sp_playlist *) sp_session_inbox_create(sp_session *session);
|
|
727
776
|
*
|
728
777
|
* @param[in] session Session object
|
729
778
|
*
|
730
|
-
* @return A playlist
|
779
|
+
* @return A playlist or NULL if no user is logged in
|
731
780
|
* @note You need to release the playlist when you are done with it.
|
732
781
|
* @see sp_playlist_release()
|
733
782
|
*/
|
@@ -739,7 +788,7 @@ SP_LIBEXPORT(sp_playlist *) sp_session_starred_create(sp_session *session);
|
|
739
788
|
* @param[in] session Session object
|
740
789
|
* @param[in] canonical_username Canonical username
|
741
790
|
*
|
742
|
-
* @return A playlist
|
791
|
+
* @return A playlist or NULL if no user is logged in
|
743
792
|
* @note You need to release the playlist when you are done with it.
|
744
793
|
* @see sp_playlist_release()
|
745
794
|
*/
|
@@ -755,7 +804,7 @@ SP_LIBEXPORT(sp_playlist *) sp_session_starred_for_user_create(sp_session *sessi
|
|
755
804
|
* @param[in] session Your session object.
|
756
805
|
* @param[in] canonical_username The canonical username, or NULL.
|
757
806
|
*
|
758
|
-
* @return Playlist container object, NULL if not logged in
|
807
|
+
* @return Playlist container object, NULL if not logged in.
|
759
808
|
*/
|
760
809
|
SP_LIBEXPORT(sp_playlistcontainer *) sp_session_publishedcontainer_for_user_create(sp_session *session, const char *canonical_username);
|
761
810
|
|
@@ -856,8 +905,21 @@ SP_LIBEXPORT(int) sp_offline_num_playlists(sp_session *session);
|
|
856
905
|
* @param[in] session Session object
|
857
906
|
* @param[out] status Status object that will be filled with info
|
858
907
|
*
|
908
|
+
* @return false if no synching is in progress (in which case the contents
|
909
|
+
* of status is undefined)
|
910
|
+
*
|
911
|
+
*/
|
912
|
+
SP_LIBEXPORT(bool) sp_offline_sync_get_status(sp_session *session, sp_offline_sync_status *status);
|
913
|
+
|
914
|
+
/**
|
915
|
+
* Return remaining time (in seconds) until the offline key store expires
|
916
|
+
* and the user is required to relogin
|
917
|
+
*
|
918
|
+
* @param[in] session Session object
|
919
|
+
* @return Seconds until expiration
|
920
|
+
*
|
859
921
|
*/
|
860
|
-
SP_LIBEXPORT(
|
922
|
+
SP_LIBEXPORT(int) sp_offline_time_left(sp_session *session);
|
861
923
|
|
862
924
|
/**
|
863
925
|
* Get currently logged in users country
|
@@ -961,6 +1023,20 @@ SP_LIBEXPORT(sp_link *) sp_link_create_from_album_cover(sp_album *album);
|
|
961
1023
|
*/
|
962
1024
|
SP_LIBEXPORT(sp_link *) sp_link_create_from_artist(sp_artist *artist);
|
963
1025
|
|
1026
|
+
/**
|
1027
|
+
* Creates a link object pointing to an artist portrait
|
1028
|
+
*
|
1029
|
+
* @param[in] artist Artist browse object
|
1030
|
+
*
|
1031
|
+
* @return A link object representing an image
|
1032
|
+
*
|
1033
|
+
* @note You need to release the link when you are done with it.
|
1034
|
+
* @see sp_link_release()
|
1035
|
+
* @see sp_artistbrowse_num_portraits()
|
1036
|
+
*/
|
1037
|
+
SP_LIBEXPORT(sp_link *) sp_link_create_from_artist_portrait(sp_artist *artist);
|
1038
|
+
|
1039
|
+
|
964
1040
|
/**
|
965
1041
|
* Creates a link object from an artist portrait
|
966
1042
|
*
|
@@ -972,8 +1048,13 @@ SP_LIBEXPORT(sp_link *) sp_link_create_from_artist(sp_artist *artist);
|
|
972
1048
|
* @note You need to release the link when you are done with it.
|
973
1049
|
* @see sp_link_release()
|
974
1050
|
* @see sp_artistbrowse_num_portraits()
|
1051
|
+
*
|
1052
|
+
* @note The difference from sp_link_create_from_artist_portrait() is
|
1053
|
+
* that the artist browse object may contain multiple portraits.
|
1054
|
+
*
|
975
1055
|
*/
|
976
|
-
SP_LIBEXPORT(sp_link *)
|
1056
|
+
SP_LIBEXPORT(sp_link *) sp_link_create_from_artistbrowse_portrait(sp_artistbrowse *arb, int index);
|
1057
|
+
|
977
1058
|
|
978
1059
|
/**
|
979
1060
|
* Generate a link object representing the current search
|
@@ -1065,7 +1146,7 @@ SP_LIBEXPORT(sp_track *) sp_link_as_track(sp_link *link);
|
|
1065
1146
|
* The track and offset into track representation for the given link
|
1066
1147
|
*
|
1067
1148
|
* @param[in] link The Spotify link whose track you are interested in
|
1068
|
-
* @param[out] offset Pointer to offset into track (in
|
1149
|
+
* @param[out] offset Pointer to offset into track (in milliseconds). If the link
|
1069
1150
|
* does not contain an offset this will be set to 0.
|
1070
1151
|
*
|
1071
1152
|
* @return The track representation of the given track link
|
@@ -1135,7 +1216,7 @@ SP_LIBEXPORT(void) sp_link_release(sp_link *link);
|
|
1135
1216
|
*
|
1136
1217
|
* @return True if track is loaded
|
1137
1218
|
*
|
1138
|
-
* @note This is
|
1219
|
+
* @note This is equivalent to checking if sp_track_error() not returns SP_ERROR_IS_LOADING.
|
1139
1220
|
*/
|
1140
1221
|
SP_LIBEXPORT(bool) sp_track_is_loaded(sp_track *track);
|
1141
1222
|
|
@@ -1214,7 +1295,7 @@ SP_LIBEXPORT(bool) sp_track_is_starred(sp_session *session, sp_track *track);
|
|
1214
1295
|
* @note This will fail silently if playlists are disabled.
|
1215
1296
|
* @see sp_set_playlists_enabled()
|
1216
1297
|
*/
|
1217
|
-
SP_LIBEXPORT(void) sp_track_set_starred(sp_session *session,
|
1298
|
+
SP_LIBEXPORT(void) sp_track_set_starred(sp_session *session, sp_track *const*tracks, int num_tracks, bool star);
|
1218
1299
|
|
1219
1300
|
/**
|
1220
1301
|
* The number of artists performing on the specified track
|
@@ -1274,7 +1355,7 @@ SP_LIBEXPORT(int) sp_track_duration(sp_track *track);
|
|
1274
1355
|
*
|
1275
1356
|
* @param[in] track A track object
|
1276
1357
|
*
|
1277
|
-
* @return Popularity in range 0 to 100, 0 if undefined
|
1358
|
+
* @return Popularity in range 0 to 100, 0 if undefined.
|
1278
1359
|
* If no metadata is available for the track yet, this function returns 0.
|
1279
1360
|
*/
|
1280
1361
|
SP_LIBEXPORT(int) sp_track_popularity(sp_track *track);
|
@@ -1960,7 +2041,7 @@ SP_LIBEXPORT(void) sp_image_release(sp_image *image);
|
|
1960
2041
|
|
1961
2042
|
|
1962
2043
|
/**
|
1963
|
-
* @defgroup search Search
|
2044
|
+
* @defgroup search Search subsystem
|
1964
2045
|
* @{
|
1965
2046
|
*/
|
1966
2047
|
|
@@ -2501,7 +2582,7 @@ SP_LIBEXPORT(bool) sp_playlist_is_collaborative(sp_playlist *playlist);
|
|
2501
2582
|
/**
|
2502
2583
|
* Set collaborative status for a playlist.
|
2503
2584
|
*
|
2504
|
-
* A playlist in collaborative state can be
|
2585
|
+
* A playlist in collaborative state can be modified by all users, not only the user owning the list
|
2505
2586
|
*
|
2506
2587
|
* @param[in] playlist Playlist object
|
2507
2588
|
* @param[in] collaborative True or false
|
@@ -2570,7 +2651,7 @@ SP_LIBEXPORT(bool) sp_playlist_has_pending_changes(sp_playlist *playlist);
|
|
2570
2651
|
* SP_ERROR_INVALID_INDATA - position is > current playlist length
|
2571
2652
|
* SP_ERROR_PERMISSION_DENIED
|
2572
2653
|
*/
|
2573
|
-
SP_LIBEXPORT(sp_error) sp_playlist_add_tracks(sp_playlist *playlist,
|
2654
|
+
SP_LIBEXPORT(sp_error) sp_playlist_add_tracks(sp_playlist *playlist, sp_track *const*tracks, int num_tracks, int position, sp_session *session);
|
2574
2655
|
|
2575
2656
|
/**
|
2576
2657
|
* Remove tracks from a playlist
|
@@ -2667,7 +2748,7 @@ SP_LIBEXPORT(void) sp_playlist_update_subscribers(sp_session *session, sp_playli
|
|
2667
2748
|
* There is one caveat tough: If libspotify has never seen the
|
2668
2749
|
* playlist before this metadata will also be unset.
|
2669
2750
|
* In order for libspotify to get the metadata the playlist
|
2670
|
-
* needs to be loaded
|
2751
|
+
* needs to be loaded at least once.
|
2671
2752
|
* In order words, if libspotify starts with an empty playlist
|
2672
2753
|
* cache and the application has set 'initially_unload_playlists'
|
2673
2754
|
* config parameter to True all playlists will be empty.
|
@@ -2705,7 +2786,8 @@ SP_LIBEXPORT(void) sp_playlist_set_in_ram(sp_session *session, sp_playlist *play
|
|
2705
2786
|
SP_LIBEXPORT(sp_playlist *) sp_playlist_create(sp_session *session, sp_link *link);
|
2706
2787
|
|
2707
2788
|
/**
|
2708
|
-
* Mark a playlist to be synchronized for offline playback
|
2789
|
+
* Mark a playlist to be synchronized for offline playback.
|
2790
|
+
* The playlist must be in the users playlistcontainer
|
2709
2791
|
*
|
2710
2792
|
* @param[in] session Session object
|
2711
2793
|
* @param[in] playlist Playlist object
|
@@ -2734,6 +2816,7 @@ SP_LIBEXPORT(sp_playlist_offline_status) sp_playlist_get_offline_status(sp_sessi
|
|
2734
2816
|
* @param[in] playlist Playlist object
|
2735
2817
|
*
|
2736
2818
|
* @return Value from 0 - 100 that indicates amount of playlist that is downloaded
|
2819
|
+
* or 0 if the playlist is not in the SP_PLAYLIST_OFFLINE_STATUS_DOWNLOADING mode.
|
2737
2820
|
*
|
2738
2821
|
* @see sp_playlist_offline_status()
|
2739
2822
|
*/
|
@@ -2812,7 +2895,7 @@ typedef struct sp_playlistcontainer_callbacks {
|
|
2812
2895
|
* @param[in] callbacks Callbacks, see sp_playlistcontainer_callbacks
|
2813
2896
|
* @param[in] userdata Opaque value passed to callbacks.
|
2814
2897
|
*
|
2815
|
-
* @note Every sp_playlistcontainer_add_callbacks() needs to be
|
2898
|
+
* @note Every sp_playlistcontainer_add_callbacks() needs to be paired with a corresponding
|
2816
2899
|
* sp_playlistcontainer_remove_callbacks() that is invoked before releasing the
|
2817
2900
|
* last reference you own for the container. In other words, you must make sure
|
2818
2901
|
* to have removed all the callbacks before the container gets destroyed.
|
@@ -2863,7 +2946,7 @@ SP_LIBEXPORT(bool) sp_playlistcontainer_is_loaded(sp_playlistcontainer *pc);
|
|
2863
2946
|
* @param[in] pc Playlist container
|
2864
2947
|
* @param[in] index Index in playlist container. Should be in the interval [0, sp_playlistcontainer_num_playlists() - 1]
|
2865
2948
|
*
|
2866
|
-
* @return
|
2949
|
+
* @return The playlist object
|
2867
2950
|
*
|
2868
2951
|
* @sa sp_session_playlistcontainer()
|
2869
2952
|
*/
|
@@ -2885,11 +2968,12 @@ SP_LIBEXPORT(sp_playlist_type) sp_playlistcontainer_playlist_type(sp_playlistcon
|
|
2885
2968
|
* Return the folder name at @a index
|
2886
2969
|
*
|
2887
2970
|
* @param[in] pc Playlist container
|
2888
|
-
* @param[in] index Index in playlist container. Should be in the interval [0, sp_playlistcontainer_num_playlists() - 1]
|
2971
|
+
* @param[in] index Index in playlist container. Should be in the interval [0, sp_playlistcontainer_num_playlists() - 1].
|
2972
|
+
* Index should point at a start-folder entry, otherwise the empty string is written to buffer.
|
2889
2973
|
* @param[in] buffer Pointer to char[] where to store folder name
|
2890
2974
|
* @param[in] buffer_size Size of array
|
2891
2975
|
*
|
2892
|
-
* @return
|
2976
|
+
* @return One of the following errors, from ::sp_error
|
2893
2977
|
* SP_ERROR_OK
|
2894
2978
|
* SP_ERROR_INDEX_OUT_OF_RANGE
|
2895
2979
|
*
|
@@ -2903,7 +2987,7 @@ SP_LIBEXPORT(sp_error) sp_playlistcontainer_playlist_folder_name(sp_playlistcont
|
|
2903
2987
|
* @param[in] pc Playlist container
|
2904
2988
|
* @param[in] index Index in playlist container. Should be in the interval [0, sp_playlistcontainer_num_playlists() - 1]
|
2905
2989
|
*
|
2906
|
-
* @return The group ID
|
2990
|
+
* @return The group ID of the folder. Returns 0 on index out of range, pc being NULL or indexed item not being a folder
|
2907
2991
|
*
|
2908
2992
|
* @sa sp_session_playlistcontainer()
|
2909
2993
|
*/
|
@@ -3122,7 +3206,7 @@ typedef enum {
|
|
3122
3206
|
* country codes (in uppercase) encoded in an integer. There are also some reserved
|
3123
3207
|
* codes used to denote non-country regions. See sp_toplistregion
|
3124
3208
|
*
|
3125
|
-
* Example: SP_TOPLIST_REGION('S', 'E')
|
3209
|
+
* Example: SP_TOPLIST_REGION('S', 'E') for Sweden
|
3126
3210
|
*/
|
3127
3211
|
#define SP_TOPLIST_REGION(a, b) ((a) << 8 | (b))
|
3128
3212
|
|
@@ -3270,7 +3354,7 @@ SP_LIBEXPORT(sp_track *) sp_toplistbrowse_track(sp_toplistbrowse *tlb, int index
|
|
3270
3354
|
/** @} */
|
3271
3355
|
|
3272
3356
|
/**
|
3273
|
-
* @defgroup inbox Inbox
|
3357
|
+
* @defgroup inbox Inbox subsystem
|
3274
3358
|
* @{
|
3275
3359
|
*/
|
3276
3360
|
|
@@ -3291,7 +3375,7 @@ typedef void SP_CALLCONV inboxpost_complete_cb(sp_inbox *result, void *userdata)
|
|
3291
3375
|
*
|
3292
3376
|
* @param[in] session Session object
|
3293
3377
|
* @param[in] user Canonical username of recipient
|
3294
|
-
* @param[in] tracks Array of
|
3378
|
+
* @param[in] tracks Array of tracks to post
|
3295
3379
|
* @param[in] num_tracks Number of tracks in \p tracks
|
3296
3380
|
* @param[in] message Message to attach to tracks. UTF-8
|
3297
3381
|
* @param[in] callback Callback to be invoked when the request has completed
|
@@ -3334,6 +3418,14 @@ SP_LIBEXPORT(void) sp_inbox_release(sp_inbox *inbox);
|
|
3334
3418
|
|
3335
3419
|
/** @} */
|
3336
3420
|
|
3421
|
+
/**
|
3422
|
+
* Return the libspotify build ID
|
3423
|
+
*
|
3424
|
+
* This might be useful to have available for display somewhere in your
|
3425
|
+
* user interface.
|
3426
|
+
*/
|
3427
|
+
SP_LIBEXPORT(const char *) sp_build_id(void);
|
3428
|
+
|
3337
3429
|
|
3338
3430
|
#ifdef __cplusplus
|
3339
3431
|
}
|
data/spec/spotify_spec.rb
CHANGED
@@ -69,6 +69,11 @@ describe Spotify do
|
|
69
69
|
subject[:dont_save_metadata_for_playlists].must_equal true
|
70
70
|
subject[:initially_unload_playlists].must_equal true
|
71
71
|
end
|
72
|
+
|
73
|
+
it "should be possible to set the callbacks" do
|
74
|
+
subject = Spotify::SessionConfig.new
|
75
|
+
subject[:callbacks] = Spotify::SessionCallbacks.new
|
76
|
+
end
|
72
77
|
end
|
73
78
|
|
74
79
|
describe Spotify::OfflineSyncStatus do
|
@@ -151,14 +156,6 @@ describe "enums" do
|
|
151
156
|
original_enum.each do |(name, value)|
|
152
157
|
a_name, a_value = attached_enum_map.find { |(n, v)| name.match n.to_s }
|
153
158
|
attached_enum_map.delete(a_name)
|
154
|
-
|
155
|
-
unless a_value.to_s == value.to_s
|
156
|
-
p enum["name"]
|
157
|
-
p [name, value]
|
158
|
-
p [a_name, a_value]
|
159
|
-
puts
|
160
|
-
end
|
161
|
-
|
162
159
|
a_value.to_s.must_equal value
|
163
160
|
end
|
164
161
|
end
|
data/spotify.gemspec
CHANGED
@@ -18,9 +18,10 @@ Gem::Specification.new do |gem|
|
|
18
18
|
gem.platform = Gem::Platform::RUBY
|
19
19
|
|
20
20
|
gem.requirements << 'libspotify, v0.0.8'
|
21
|
-
gem.add_dependency 'ffi', '~> 1.0
|
21
|
+
gem.add_dependency 'ffi', '~> 1.0'
|
22
22
|
gem.add_development_dependency 'yard'
|
23
23
|
gem.add_development_dependency 'rbgccxml'
|
24
|
-
gem.add_development_dependency '
|
25
|
-
gem.add_development_dependency '
|
24
|
+
gem.add_development_dependency 'gccxml_gem', '!= 0.9.3'
|
25
|
+
gem.add_development_dependency 'minitest', '~> 2.0'
|
26
|
+
gem.add_development_dependency 'bundler', '~> 1.0'
|
26
27
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spotify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 9.0.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,22 +9,22 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-
|
12
|
+
date: 2011-09-01 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ffi
|
16
|
-
requirement: &
|
16
|
+
requirement: &2153640520 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 1.0
|
21
|
+
version: '1.0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2153640520
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: yard
|
27
|
-
requirement: &
|
27
|
+
requirement: &2153640100 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2153640100
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rbgccxml
|
38
|
-
requirement: &
|
38
|
+
requirement: &2153639640 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,29 +43,40 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2153639640
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: gccxml_gem
|
49
|
+
requirement: &2153639140 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '!='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.9.3
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *2153639140
|
47
58
|
- !ruby/object:Gem::Dependency
|
48
59
|
name: minitest
|
49
|
-
requirement: &
|
60
|
+
requirement: &2153638640 !ruby/object:Gem::Requirement
|
50
61
|
none: false
|
51
62
|
requirements:
|
52
63
|
- - ~>
|
53
64
|
- !ruby/object:Gem::Version
|
54
|
-
version: 2.0
|
65
|
+
version: '2.0'
|
55
66
|
type: :development
|
56
67
|
prerelease: false
|
57
|
-
version_requirements: *
|
68
|
+
version_requirements: *2153638640
|
58
69
|
- !ruby/object:Gem::Dependency
|
59
70
|
name: bundler
|
60
|
-
requirement: &
|
71
|
+
requirement: &2153638180 !ruby/object:Gem::Requirement
|
61
72
|
none: false
|
62
73
|
requirements:
|
63
74
|
- - ~>
|
64
75
|
- !ruby/object:Gem::Version
|
65
|
-
version: 1.0
|
76
|
+
version: '1.0'
|
66
77
|
type: :development
|
67
78
|
prerelease: false
|
68
|
-
version_requirements: *
|
79
|
+
version_requirements: *2153638180
|
69
80
|
description:
|
70
81
|
email:
|
71
82
|
- kim@burgestrand.se
|
@@ -75,6 +86,7 @@ extra_rdoc_files: []
|
|
75
86
|
files:
|
76
87
|
- .gemtest
|
77
88
|
- .gitignore
|
89
|
+
- CHANGELOG.md
|
78
90
|
- Gemfile
|
79
91
|
- LICENSE
|
80
92
|
- README.markdown
|
@@ -106,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
118
|
requirements:
|
107
119
|
- libspotify, v0.0.8
|
108
120
|
rubyforge_project:
|
109
|
-
rubygems_version: 1.8.
|
121
|
+
rubygems_version: 1.8.6
|
110
122
|
signing_key:
|
111
123
|
specification_version: 3
|
112
124
|
summary: Bare-bones Ruby bindings for libspotify
|