spotify 10.3.0 → 11.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/lib/spotify.rb +47 -38
  2. data/lib/spotify/version.rb +1 -1
  3. data/spec/api.h +173 -64
  4. metadata +13 -13
data/lib/spotify.rb CHANGED
@@ -10,27 +10,43 @@ require 'spotify/version'
10
10
  # @see http://developer.spotify.com/en/libspotify/docs/
11
11
  module Spotify
12
12
  extend FFI::Library
13
- ffi_lib ['libspotify', '/Library/Frameworks/libspotify.framework/libspotify']
13
+
14
+ begin
15
+ ffi_lib ['libspotify', '/Library/Frameworks/libspotify.framework/libspotify']
16
+ rescue LoadError => e
17
+ puts "Failed to load the `libspotify` library. Please make sure you have it
18
+ installed, either globally on your system, in your LD_LIBRARY_PATH, or in
19
+ your current working directory (#{Dir.pwd}).
20
+
21
+ For installation instructions, please see:
22
+ https://github.com/Burgestrand/Hallon/wiki/How-to-install-libspotify".gsub(/^ */, '')
23
+ puts
24
+ raise
25
+ end
14
26
 
15
27
  module UTF8String
16
28
  extend FFI::DataConverter
17
29
  native_type FFI::Type::STRING
18
30
 
19
- # convert a Ruby string of any encoding to UTF-8 string
20
- def self.to_native(value, ctx)
21
- if value.respond_to?(:encode)
22
- value.encode('UTF-8')
23
- else
24
- value
31
+ if "".respond_to?(:encode)
32
+ # convert a Ruby string of any encoding to UTF-8 string
33
+ def self.to_native(value, ctx)
34
+ if value
35
+ value.encode('UTF-8')
36
+ else
37
+ super
38
+ end
25
39
  end
26
40
  end
27
41
 
28
- # converts encoding from native BINARY string to UTF-8
29
- def self.from_native(value, ctx)
30
- if value.respond_to?(:force_encoding)
31
- value.force_encoding('UTF-8')
32
- else
33
- super
42
+ if "".respond_to?(:force_encoding)
43
+ # converts encoding from native BINARY string to UTF-8
44
+ def self.from_native(value, ctx)
45
+ if value
46
+ value.force_encoding('UTF-8')
47
+ else
48
+ super
49
+ end
34
50
  end
35
51
  end
36
52
  end
@@ -204,7 +220,8 @@ module Spotify
204
220
  :stop_playback, callback([ :session ], :void),
205
221
  :get_audio_buffer_stats, callback([ :session, AudioBufferStats ], :void),
206
222
  :offline_status_updated, callback([ :session ], :void),
207
- :offline_error, callback([ :session, :error ], :void)
223
+ :offline_error, callback([ :session, :error ], :void),
224
+ :credentials_blob_updated, callback([ :session, :string ], :void)
208
225
  end
209
226
 
210
227
  # FFI::Struct for Session configuration.
@@ -273,7 +290,7 @@ module Spotify
273
290
  attach_function :session_release, :sp_session_release, [ :session ], :void
274
291
 
275
292
  attach_function :session_process_events, :sp_session_process_events, [ :session, :buffer_out ], :void
276
- attach_function :session_login, :sp_session_login, [ :session, :utf8_string, :string, :bool ], :void
293
+ attach_function :session_login, :sp_session_login, [ :session, :utf8_string, :string, :bool, :string ], :void
277
294
  attach_function :session_relogin, :sp_session_relogin, [ :session ], :error
278
295
  attach_function :session_forget_me, :sp_session_forget_me, [ :session ], :void
279
296
  attach_function :session_remembered_user, :sp_session_remembered_user, [ :session, :buffer_out, :size_t ], :int
@@ -309,6 +326,8 @@ module Spotify
309
326
  attach_function :session_set_volume_normalization, :sp_session_set_volume_normalization, [ :session, :bool ], :void
310
327
  attach_function :session_get_volume_normalization, :sp_session_get_volume_normalization, [ :session ], :bool
311
328
 
329
+ attach_function :session_flush_caches, :sp_session_flush_caches, [ :session ], :void
330
+
312
331
  #
313
332
  # Link
314
333
  #
@@ -367,6 +386,7 @@ module Spotify
367
386
  attach_function :track_disc, :sp_track_disc, [ :track ], :int
368
387
  attach_function :track_index, :sp_track_index, [ :track ], :int
369
388
  attach_function :track_is_placeholder, :sp_track_is_placeholder, [ :track ], :bool
389
+ attach_function :track_get_playable, :sp_track_get_playable, [ :session, :track ], :track
370
390
 
371
391
  attach_function :track_offline_get_status, :sp_track_offline_get_status, [ :track ], :track_offline_status
372
392
 
@@ -452,6 +472,8 @@ module Spotify
452
472
  attach_function :artistbrowse_similar_artist, :sp_artistbrowse_similar_artist, [ :artistbrowse, :int ], :artist
453
473
  attach_function :artistbrowse_biography, :sp_artistbrowse_biography, [ :artistbrowse ], :utf8_string
454
474
  attach_function :artistbrowse_backend_request_duration, :sp_artistbrowse_backend_request_duration, [ :artistbrowse ], :int
475
+ attach_function :artistbrowse_num_tophit_tracks, :sp_artistbrowse_num_tophit_tracks, [ :artistbrowse ], :int
476
+ attach_function :artistbrowse_tophit_track, :sp_artistbrowse_tophit_track, [ :artistbrowse, :int ], :track
455
477
 
456
478
  attach_function :artistbrowse_add_ref, :sp_artistbrowse_add_ref, [ :artistbrowse ], :void
457
479
  attach_function :artistbrowse_release, :sp_artistbrowse_release, [ :artistbrowse ], :void
@@ -483,31 +505,10 @@ module Spotify
483
505
  #
484
506
  # @see http://developer.spotify.com/en/libspotify/docs/group__search.html
485
507
 
486
- #
487
- enum :radio_genre, [
488
- :alt_pop_rock, 0x1,
489
- :blues , 0x2,
490
- :country , 0x4,
491
- :disco , 0x8,
492
- :funk , 0x10,
493
- :hard_rock , 0x20,
494
- :heavy_metal , 0x40,
495
- :rap , 0x80,
496
- :house , 0x100,
497
- :jazz , 0x200,
498
- :new_wave , 0x400,
499
- :rnb , 0x800,
500
- :pop , 0x1000,
501
- :punk , 0x2000,
502
- :reggae , 0x4000,
503
- :pop_rock , 0x8000,
504
- :soul , 0x10000,
505
- :techno , 0x20000
506
- ]
508
+ enum :search_type, [:standard, :suggest]
507
509
 
508
510
  callback :search_complete_cb, [:search, :userdata], :void
509
- attach_function :search_create, :sp_search_create, [ :session, :utf8_string, :int, :int, :int, :int, :int, :int, :search_complete_cb, :userdata ], :search
510
- attach_function :radio_search_create, :sp_radio_search_create, [ :session, :uint, :uint, :radio_genre, :search_complete_cb, :userdata ], :search
511
+ attach_function :search_create, :sp_search_create, [ :session, :utf8_string, :int, :int, :int, :int, :int, :int, :int, :int, :search_type, :search_complete_cb, :userdata ], :search
511
512
  attach_function :search_is_loaded, :sp_search_is_loaded, [ :search ], :bool
512
513
  attach_function :search_error, :sp_search_error, [ :search ], :error
513
514
  attach_function :search_num_tracks, :sp_search_num_tracks, [ :search ], :int
@@ -522,6 +523,11 @@ module Spotify
522
523
  attach_function :search_total_albums, :sp_search_total_albums, [ :search ], :int
523
524
  attach_function :search_total_artists, :sp_search_total_artists, [ :search ], :int
524
525
 
526
+ attach_function :search_num_playlists, :sp_search_num_playlists, [ :search ], :int
527
+ attach_function :search_playlist_name, :sp_search_playlist_name, [ :search, :int ], :utf8_string
528
+ attach_function :search_playlist_uri, :sp_search_playlist_uri, [ :search, :int ], :utf8_string
529
+ attach_function :search_playlist_image_uri, :sp_search_playlist_image_uri, [ :search, :int ], :utf8_string
530
+
525
531
  attach_function :search_add_ref, :sp_search_add_ref, [ :search ], :void
526
532
  attach_function :search_release, :sp_search_release, [ :search ], :void
527
533
 
@@ -658,6 +664,9 @@ module Spotify
658
664
  attach_function :playlistcontainer_owner, :sp_playlistcontainer_owner, [ :playlistcontainer ], :user
659
665
  attach_function :playlistcontainer_is_loaded, :sp_playlistcontainer_is_loaded, [ :playlistcontainer ], :bool
660
666
 
667
+ attach_function :playlistcontainer_get_unseen_tracks, :sp_playlistcontainer_get_unseen_tracks, [ :playlistcontainer, :playlist, :array, :int ], :int
668
+ attach_function :playlistcontainer_clear_unseen_tracks, :sp_playlistcontainer_clear_unseen_tracks, [ :playlistcontainer, :playlist ], :int
669
+
661
670
  attach_function :playlistcontainer_add_ref, :sp_playlistcontainer_add_ref, [ :playlistcontainer ], :void
662
671
  attach_function :playlistcontainer_release, :sp_playlistcontainer_release, [ :playlistcontainer ], :void
663
672
 
@@ -1,4 +1,4 @@
1
1
  module Spotify
2
2
  # See README for versioning policy.
3
- VERSION = [10, 3, 0].join('.')
3
+ VERSION = [11, 0, 0].join('.')
4
4
  end
data/spec/api.h CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2006-2010 Spotify Ltd
2
+ * Copyright (c) 2006-2012 Spotify Ltd
3
3
  *
4
4
  * The terms of use for this and related files can be read in
5
5
  * the associated LICENSE file, usually stored in share/doc/libspotify/LICENSE.
@@ -43,7 +43,6 @@ extern "C" {
43
43
  /* Includes */
44
44
  #include <stddef.h>
45
45
 
46
- //endif
47
46
 
48
47
  #ifdef _WIN32
49
48
  typedef unsigned __int64 sp_uint64;
@@ -122,7 +121,6 @@ typedef enum sp_error {
122
121
  SP_ERROR_INVALID_DEVICE_ID = 25, ///< Invalid device ID
123
122
  SP_ERROR_CANT_OPEN_TRACE_FILE = 26, ///< Unable to open trace file
124
123
  SP_ERROR_APPLICATION_BANNED = 27, ///< This application is no longer allowed to use the Spotify service
125
- //endif
126
124
  SP_ERROR_OFFLINE_TOO_MANY_TRACKS = 31, ///< Reached the device limit for number of tracks to download
127
125
  SP_ERROR_OFFLINE_DISK_CACHE = 32, ///< Disk cache is full so no more tracks can be downloaded to offline mode
128
126
  SP_ERROR_OFFLINE_EXPIRED = 33, ///< Offline key has expired, the user needs to go online again
@@ -132,7 +130,8 @@ typedef enum sp_error {
132
130
  } sp_error;
133
131
 
134
132
  /**
135
- * Convert a numeric libspotify error code to a text string
133
+ * Convert a numeric libspotify error code to a text string. The error message is in
134
+ * English. This function is useful for logging purposes.
136
135
  *
137
136
  * @param[in] error The error code to lookup
138
137
  */
@@ -141,6 +140,7 @@ SP_LIBEXPORT(const char*) sp_error_message(sp_error error);
141
140
  /** @} */
142
141
 
143
142
 
143
+
144
144
  /**
145
145
  * @defgroup session Session handling
146
146
  *
@@ -160,7 +160,7 @@ SP_LIBEXPORT(const char*) sp_error_message(sp_error error);
160
160
  * returned from sp_session_create(). Future versions of the library will provide you with some kind of mechanism
161
161
  * to request an updated version of the library.
162
162
  */
163
- #define SPOTIFY_API_VERSION 10
163
+ #define SPOTIFY_API_VERSION 11
164
164
 
165
165
  /**
166
166
  * Describes the current state of the connection
@@ -194,9 +194,9 @@ typedef struct sp_audioformat {
194
194
  * Bitrate definitions for music streaming
195
195
  */
196
196
  typedef enum sp_bitrate {
197
- SP_BITRATE_160k = 0,
198
- SP_BITRATE_320k = 1,
199
- SP_BITRATE_96k = 2,
197
+ SP_BITRATE_160k = 0, ///< Bitrate 160kbps
198
+ SP_BITRATE_320k = 1, ///< Bitrate 320kbps
199
+ SP_BITRATE_96k = 2, ///< Bitrate 96kbps
200
200
  } sp_bitrate;
201
201
 
202
202
  /**
@@ -209,6 +209,16 @@ typedef enum sp_playlist_type {
209
209
  SP_PLAYLIST_TYPE_PLACEHOLDER = 3, ///< Unknown entry.
210
210
  } sp_playlist_type;
211
211
 
212
+
213
+
214
+ /**
215
+ * Search types
216
+ */
217
+ typedef enum sp_search_type {
218
+ SP_SEARCH_STANDARD = 0,
219
+ SP_SEARCH_SUGGEST = 1,
220
+ } sp_search_type;
221
+
212
222
  /**
213
223
  * Playlist offline status
214
224
  */
@@ -290,7 +300,8 @@ typedef enum sp_connection_rules {
290
300
  * Controls the type of data that will be included in artist browse queries
291
301
  */
292
302
  typedef enum sp_artistbrowse_type {
293
- SP_ARTISTBROWSE_FULL, /**< All information */
303
+ SP_ARTISTBROWSE_FULL, /**< All information except tophit tracks
304
+ This mode is deprecated and will removed in a future release */
294
305
  SP_ARTISTBROWSE_NO_TRACKS, /**< Only albums and data about them, no tracks.
295
306
  In other words, sp_artistbrowse_num_tracks() will return 0
296
307
  */
@@ -380,7 +391,6 @@ typedef struct sp_session_callbacks {
380
391
  * @param[in] session Session
381
392
  */
382
393
  void (SP_CALLCONV *logged_out)(sp_session *session);
383
-
384
394
  /**
385
395
  * Called whenever metadata has been updated
386
396
  *
@@ -456,7 +466,18 @@ typedef struct sp_session_callbacks {
456
466
  int (SP_CALLCONV *music_delivery)(sp_session *session, const sp_audioformat *format, const void *frames, int num_frames);
457
467
 
458
468
  /**
459
- * Music has been paused because only one account may play music at the same time.
469
+ * Music has been paused because an account only allows music
470
+ * to be played from one location simultaneously.
471
+ *
472
+ * @note When this callback is invoked the application should
473
+ * behave just as if the user pressed the pause
474
+ * button. The application should also display a message
475
+ * to the user indicating the playback has been paused
476
+ * because another application is playing using the same
477
+ * account.
478
+ *
479
+ * @note IT MUST NOT automatically resume playback but must
480
+ * instead wait for the user to press play.
460
481
  *
461
482
  * @param[in] session Session
462
483
  */
@@ -474,8 +495,7 @@ typedef struct sp_session_callbacks {
474
495
  * End of track.
475
496
  * Called when the currently played track has reached its end.
476
497
  *
477
- * @note This function is invoked from the same internal thread
478
- * as the music delivery callback
498
+ * @note This function is invoked from the main thread
479
499
  *
480
500
  * @param[in] session Session
481
501
  */
@@ -483,7 +503,7 @@ typedef struct sp_session_callbacks {
483
503
 
484
504
  /**
485
505
  * Streaming error.
486
- * Called when streaming cannot start or continue
506
+ * Called when streaming cannot start or continue.
487
507
  *
488
508
  * @note This function is invoked from the main thread
489
509
  *
@@ -557,7 +577,17 @@ typedef struct sp_session_callbacks {
557
577
  */
558
578
  void (SP_CALLCONV *offline_error)(sp_session *session, sp_error error);
559
579
 
560
- //endif
580
+ /**
581
+ * Called when storable credentials have been updated, usually called when
582
+ * we have connected to the AP.
583
+ *
584
+ * @param[in] session Session
585
+ * @param[in] blob Blob is a null-terminated string which contains
586
+ * an encrypted token that can be stored safely on disk
587
+ * instead of storing plaintext passwords.
588
+ */
589
+ void (SP_CALLCONV *credentials_blob_updated)(sp_session *session, const char *blob);
590
+
561
591
  } sp_session_callbacks;
562
592
 
563
593
  /**
@@ -603,10 +633,13 @@ typedef struct sp_session_config {
603
633
  bool initially_unload_playlists;
604
634
 
605
635
  /**
606
- * Device ID for offline synchronization
636
+ * Device ID for offline synchronization and logging purposes. The Device Id must be unique to the particular device instance,
637
+ * i.e. no two units must supply the same Device ID. The Device ID must not change between sessions or power cycles.
638
+ * Good examples is the device's MAC address or unique serial number.
607
639
  */
608
640
  const char *device_id;
609
641
 
642
+
610
643
  /**
611
644
  * Path to API trace file
612
645
  */
@@ -661,8 +694,10 @@ SP_LIBEXPORT(void) sp_session_release(sp_session *sess);
661
694
  * @param[in] username The username to log in
662
695
  * @param[in] password The password for the specified username
663
696
  * @param[in] remember_me If set, the username / password will be remembered by libspotify
697
+ * @param[in] blob If you have received a blob in the #credentials_blob_updated
698
+ * you can pas this here instead of password
664
699
  */
665
- SP_LIBEXPORT(void) sp_session_login(sp_session *session, const char *username, const char *password, bool remember_me);
700
+ SP_LIBEXPORT(void) sp_session_login(sp_session *session, const char *username, const char *password, bool remember_me, const char *blob);
666
701
 
667
702
 
668
703
  /**
@@ -722,6 +757,19 @@ SP_LIBEXPORT(sp_user *) sp_session_user(sp_session *session);
722
757
  */
723
758
  SP_LIBEXPORT(void) sp_session_logout(sp_session *session);
724
759
 
760
+
761
+ /**
762
+ * Flush the caches
763
+ *
764
+ * This will make libspotify write all data that is meant to be stored
765
+ * on disk to the disk immediately. libspotify does this periodically
766
+ * by itself and also on logout. So under normal conditions this
767
+ * should never need to be used.
768
+ *
769
+ * @param[in] session Your session object
770
+ */
771
+ SP_LIBEXPORT(void) sp_session_flush_caches(sp_session *session);
772
+
725
773
  /**
726
774
  * The connection state of the specified session.
727
775
  *
@@ -923,7 +971,6 @@ SP_LIBEXPORT(bool) sp_session_get_volume_normalization(sp_session *session);
923
971
  */
924
972
  SP_LIBEXPORT(void) sp_session_set_volume_normalization(sp_session *session, bool on);
925
973
 
926
- //endif
927
974
 
928
975
  /**
929
976
  * Set to true if the connection is currently routed over a roamed connectivity
@@ -934,6 +981,7 @@ SP_LIBEXPORT(void) sp_session_set_volume_normalization(sp_session *session, bool
934
981
  * @note Used in conjunction with sp_session_set_connection_rules() to control
935
982
  * how libspotify should behave in respect to network activity and offline
936
983
  * synchronization.
984
+ * @see sp_connection_type
937
985
  */
938
986
  SP_LIBEXPORT(void) sp_session_set_connection_type(sp_session *session, sp_connection_type type);
939
987
 
@@ -947,6 +995,7 @@ SP_LIBEXPORT(void) sp_session_set_connection_type(sp_session *session, sp_connec
947
995
  * @note Used in conjunction with sp_session_set_connection_type() to control
948
996
  * how libspotify should behave in respect to network activity and offline
949
997
  * synchronization.
998
+ * @see sp_connection_rules
950
999
  */
951
1000
  SP_LIBEXPORT(void) sp_session_set_connection_rules(sp_session *session, sp_connection_rules rules);
952
1001
 
@@ -1355,6 +1404,18 @@ SP_LIBEXPORT(bool) sp_track_is_local(sp_session *session, sp_track *track);
1355
1404
  */
1356
1405
  SP_LIBEXPORT(bool) sp_track_is_autolinked(sp_session *session, sp_track *track);
1357
1406
 
1407
+
1408
+ /**
1409
+ * Return the actual track that will be played if the given track is played
1410
+ *
1411
+ * @param[in] session Session
1412
+ * @param[in] track The track
1413
+ *
1414
+ * @return A track
1415
+ *
1416
+ */
1417
+ SP_LIBEXPORT(sp_track *) sp_track_get_playable(sp_session *session, sp_track *track);
1418
+
1358
1419
  /**
1359
1420
  * Return true if the track is a placeholder. Placeholder tracks are used
1360
1421
  * to store other objects than tracks in the playlist. Currently this is
@@ -1652,7 +1713,7 @@ SP_LIBEXPORT(bool) sp_artist_is_loaded(sp_artist *artist);
1652
1713
  * @param[in] artist The artist object
1653
1714
  *
1654
1715
  * @return ID byte sequence that can be passed to sp_image_create()
1655
- * If the album has no image or the metadata for the album is not
1716
+ * If the artist has no image or the metadata for the album is not
1656
1717
  * loaded yet, this function returns NULL.
1657
1718
  *
1658
1719
  */
@@ -1948,6 +2009,30 @@ SP_LIBEXPORT(int) sp_artistbrowse_num_tracks(sp_artistbrowse *arb);
1948
2009
  */
1949
2010
  SP_LIBEXPORT(sp_track *) sp_artistbrowse_track(sp_artistbrowse *arb, int index);
1950
2011
 
2012
+
2013
+ /**
2014
+ * Given an artist browse object, return number of tophit tracks
2015
+ * This is a set of tracks for the artist with highest popularity
2016
+ *
2017
+ * @param[in] arb Artist browse object
2018
+ *
2019
+ * @return Number of tophit tracks for given artist
2020
+ */
2021
+ SP_LIBEXPORT(int) sp_artistbrowse_num_tophit_tracks(sp_artistbrowse *arb);
2022
+
2023
+ /**
2024
+ * Given an artist browse object, return one of its tophit tracks
2025
+ * This is a set of tracks for the artist with highest popularity
2026
+ *
2027
+ * @param[in] arb Album browse object
2028
+ * @param[in] index The index for the track. Should be in the interval [0, sp_artistbrowse_num_tophit_tracks() - 1]
2029
+ *
2030
+ * @return A track object, or NULL if the index is out of range.
2031
+ *
2032
+ * @see track
2033
+ */
2034
+ SP_LIBEXPORT(sp_track *) sp_artistbrowse_tophit_track(sp_artistbrowse *arb, int index);
2035
+
1951
2036
  /**
1952
2037
  * Given an artist browse object, return number of albums
1953
2038
  *
@@ -2173,36 +2258,11 @@ SP_LIBEXPORT(void) sp_image_release(sp_image *image);
2173
2258
 
2174
2259
 
2175
2260
 
2176
-
2177
2261
  /**
2178
2262
  * @defgroup search Search subsystem
2179
2263
  * @{
2180
2264
  */
2181
2265
 
2182
- /**
2183
- * List of genres for radio query. Multiple genres can be combined by OR:ing the genres together
2184
- */
2185
- typedef enum sp_radio_genre {
2186
- SP_RADIO_GENRE_ALT_POP_ROCK = 0x1,
2187
- SP_RADIO_GENRE_BLUES = 0x2,
2188
- SP_RADIO_GENRE_COUNTRY = 0x4,
2189
- SP_RADIO_GENRE_DISCO = 0x8,
2190
- SP_RADIO_GENRE_FUNK = 0x10,
2191
- SP_RADIO_GENRE_HARD_ROCK = 0x20,
2192
- SP_RADIO_GENRE_HEAVY_METAL = 0x40,
2193
- SP_RADIO_GENRE_RAP = 0x80,
2194
- SP_RADIO_GENRE_HOUSE = 0x100,
2195
- SP_RADIO_GENRE_JAZZ = 0x200,
2196
- SP_RADIO_GENRE_NEW_WAVE = 0x400,
2197
- SP_RADIO_GENRE_RNB = 0x800,
2198
- SP_RADIO_GENRE_POP = 0x1000,
2199
- SP_RADIO_GENRE_PUNK = 0x2000,
2200
- SP_RADIO_GENRE_REGGAE = 0x4000,
2201
- SP_RADIO_GENRE_POP_ROCK = 0x8000,
2202
- SP_RADIO_GENRE_SOUL = 0x10000,
2203
- SP_RADIO_GENRE_TECHNO = 0x20000,
2204
- } sp_radio_genre;
2205
-
2206
2266
  /**
2207
2267
  * The type of a callback used in sp_search_create()
2208
2268
  *
@@ -2225,28 +2285,16 @@ typedef void SP_CALLCONV search_complete_cb(sp_search *result, void *userdata);
2225
2285
  * @param[in] album_offset The offset among the albums of the result
2226
2286
  * @param[in] album_count The number of albums to ask for
2227
2287
  * @param[in] artist_offset The offset among the artists of the result
2228
- * @param[in] artist_count The number of artists to ask for
2288
+ * @param[in] artist_count The number of artists to ask for
2289
+ * @param[in] playlist_offset The offset among the playlists of the result
2290
+ * @param[in] playlist_count The number of playlists to ask for
2291
+ * @param[in] search_type Type of search, can be used for suggest searches
2229
2292
  * @param[in] callback Callback that will be called once the search operation is complete. Pass NULL if you are not interested in this event.
2230
2293
  * @param[in] userdata Opaque pointer passed to \p callback
2231
2294
  *
2232
2295
  * @return Pointer to a search object. To free the object, use sp_search_release()
2233
2296
  */
2234
- SP_LIBEXPORT(sp_search *) sp_search_create(sp_session *session, const char *query, int track_offset, int track_count, int album_offset, int album_count, int artist_offset, int artist_count, search_complete_cb *callback, void *userdata);
2235
-
2236
- /**
2237
- * Create a search object from the radio channel
2238
- *
2239
- * @param[in] session Session
2240
- * @param[in] from_year Include tracks starting from this year
2241
- * @param[in] to_year Include tracks up to this year
2242
- * @param[in] genres Bitmask of genres to include
2243
- * @param[in] callback Callback that will be called once the search operation is complete. Pass NULL if you are not interested in this event.
2244
- * @param[in] userdata Opaque pointer passed to \p callback
2245
- *
2246
- * @return Pointer to a search object. To free the object, use sp_search_release()
2247
- */
2248
- SP_LIBEXPORT(sp_search *) sp_radio_search_create(sp_session *session, unsigned int from_year, unsigned int to_year, sp_radio_genre genres, search_complete_cb *callback, void *userdata);
2249
-
2297
+ SP_LIBEXPORT(sp_search *) sp_search_create(sp_session *session, const char *query, int track_offset, int track_count, int album_offset, int album_count, int artist_offset, int artist_count, int playlist_offset, int playlist_count, sp_search_type search_type, search_complete_cb *callback, void *userdata);
2250
2298
 
2251
2299
  /**
2252
2300
  * Get load status for the specified search. Before it is loaded, it will behave as an empty search result.
@@ -2308,6 +2356,45 @@ SP_LIBEXPORT(int) sp_search_num_albums(sp_search *search);
2308
2356
  */
2309
2357
  SP_LIBEXPORT(sp_album *) sp_search_album(sp_search *search, int index);
2310
2358
 
2359
+ /**
2360
+ * Get the number of playlists for the specified search
2361
+ *
2362
+ * @param[in] search Search object
2363
+ *
2364
+ * @return The number of playlists for the specified search
2365
+ */
2366
+ SP_LIBEXPORT(int) sp_search_num_playlists(sp_search *search);
2367
+
2368
+ /**
2369
+ * Return the playlist at the given index in the given search object
2370
+ *
2371
+ * @param[in] search Search object
2372
+ * @param[in] index Index of the wanted playlist. Should be in the interval [0, sp_search_num_playlists() - 1]
2373
+ *
2374
+ * @return The playlist name at the given index in the given search object
2375
+ */
2376
+ SP_LIBEXPORT(const char *) sp_search_playlist_name(sp_search *search, int index);
2377
+
2378
+ /**
2379
+ * Return the uri of a playlist at the given index in the given search object
2380
+ *
2381
+ * @param[in] search Search object
2382
+ * @param[in] index Index of the wanted playlist. Should be in the interval [0, sp_search_num_playlists() - 1]
2383
+ *
2384
+ * @return The playlist uri at the given index in the given search object
2385
+ */
2386
+ SP_LIBEXPORT(const char *) sp_search_playlist_uri(sp_search *search, int index);
2387
+
2388
+ /**
2389
+ * Return the image_uri of a playlist at the given index in the given search object
2390
+ *
2391
+ * @param[in] search Search object
2392
+ * @param[in] index Index of the wanted playlist. Should be in the interval [0, sp_search_num_playlists() - 1]
2393
+ *
2394
+ * @return The playlist image_uri at the given index in the given search object
2395
+ */
2396
+ SP_LIBEXPORT(const char *) sp_search_playlist_image_uri(sp_search *search, int index);
2397
+
2311
2398
  /**
2312
2399
  * Get the number of artists for the specified search
2313
2400
  *
@@ -2396,6 +2483,7 @@ SP_LIBEXPORT(void) sp_search_release(sp_search *search);
2396
2483
 
2397
2484
 
2398
2485
 
2486
+
2399
2487
  /**
2400
2488
  * @defgroup playlist Playlist subsystem
2401
2489
  *
@@ -3223,6 +3311,30 @@ SP_LIBEXPORT(void) sp_playlistcontainer_add_ref(sp_playlistcontainer *pc);
3223
3311
  */
3224
3312
  SP_LIBEXPORT(void) sp_playlistcontainer_release(sp_playlistcontainer *pc);
3225
3313
 
3314
+ /**
3315
+ * Get the number of new tracks in a playlist since the corresponding
3316
+ * function sp_playlistcontainer_clear_unseen_tracks() was called. The
3317
+ * function always returns the number of new tracks, and fills the
3318
+ * \p tracks array with the new tracks, but not more than specified in
3319
+ * \p num_tracks. The function will return a negative value on failure.
3320
+ *
3321
+ * @param[in] pc Playlist container.
3322
+ * @param[in] playlist Playlist object.
3323
+ * @param[out] tracks Array of pointer to new tracks (maybe NULL)
3324
+ * @param[in] num_tracks Size of tracks array
3325
+ * @return Returns the number of unseen tracks
3326
+ */
3327
+ SP_LIBEXPORT(int) sp_playlistcontainer_get_unseen_tracks(sp_playlistcontainer *pc, sp_playlist *playlist, sp_track **tracks, int num_tracks);
3328
+
3329
+ /**
3330
+ * Clears a playlist from unseen tracks, so that next call to sp_playlistcontainer_get_unseen_tracks() will return 0 until a new track is added to the \p playslist.
3331
+ *
3332
+ * @param[in] pc Playlist container.
3333
+ * @param[in] playlist Playlist object.
3334
+ * @return Returns 0 on success and -1 on failure.
3335
+ */
3336
+ SP_LIBEXPORT(int) sp_playlistcontainer_clear_unseen_tracks(sp_playlistcontainer *pc, sp_playlist *playlist);
3337
+
3226
3338
  /** @} */
3227
3339
 
3228
3340
 
@@ -3275,7 +3387,6 @@ SP_LIBEXPORT(const char *) sp_user_display_name(sp_user *user);
3275
3387
  */
3276
3388
  SP_LIBEXPORT(bool) sp_user_is_loaded(sp_user *user);
3277
3389
 
3278
- //endif
3279
3390
 
3280
3391
  /**
3281
3392
  * Increase the reference count of an user
@@ -3544,8 +3655,6 @@ SP_LIBEXPORT(void) sp_inbox_release(sp_inbox *inbox);
3544
3655
  */
3545
3656
  SP_LIBEXPORT(const char *) sp_build_id(void);
3546
3657
 
3547
- //endif
3548
-
3549
3658
  #ifdef __cplusplus
3550
3659
  }
3551
3660
  #endif
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: 10.3.0
4
+ version: 11.0.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-12-25 00:00:00.000000000 Z
12
+ date: 2012-03-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ffi
16
- requirement: &70144148345660 !ruby/object:Gem::Requirement
16
+ requirement: &70294145167840 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -24,10 +24,10 @@ dependencies:
24
24
  version: 1.0.11
25
25
  type: :runtime
26
26
  prerelease: false
27
- version_requirements: *70144148345660
27
+ version_requirements: *70294145167840
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rake
30
- requirement: &70144148344940 !ruby/object:Gem::Requirement
30
+ requirement: &70294145167120 !ruby/object:Gem::Requirement
31
31
  none: false
32
32
  requirements:
33
33
  - - ! '>='
@@ -35,10 +35,10 @@ dependencies:
35
35
  version: '0'
36
36
  type: :development
37
37
  prerelease: false
38
- version_requirements: *70144148344940
38
+ version_requirements: *70294145167120
39
39
  - !ruby/object:Gem::Dependency
40
40
  name: yard
41
- requirement: &70144148344440 !ruby/object:Gem::Requirement
41
+ requirement: &70294145182800 !ruby/object:Gem::Requirement
42
42
  none: false
43
43
  requirements:
44
44
  - - ! '>='
@@ -46,10 +46,10 @@ dependencies:
46
46
  version: '0'
47
47
  type: :development
48
48
  prerelease: false
49
- version_requirements: *70144148344440
49
+ version_requirements: *70294145182800
50
50
  - !ruby/object:Gem::Dependency
51
51
  name: rbgccxml
52
- requirement: &70144148343820 !ruby/object:Gem::Requirement
52
+ requirement: &70294145182080 !ruby/object:Gem::Requirement
53
53
  none: false
54
54
  requirements:
55
55
  - - ! '>='
@@ -57,10 +57,10 @@ dependencies:
57
57
  version: '0'
58
58
  type: :development
59
59
  prerelease: false
60
- version_requirements: *70144148343820
60
+ version_requirements: *70294145182080
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: minitest
63
- requirement: &70144148343120 !ruby/object:Gem::Requirement
63
+ requirement: &70294145181320 !ruby/object:Gem::Requirement
64
64
  none: false
65
65
  requirements:
66
66
  - - ~>
@@ -68,7 +68,7 @@ dependencies:
68
68
  version: '2.0'
69
69
  type: :development
70
70
  prerelease: false
71
- version_requirements: *70144148343120
71
+ version_requirements: *70294145181320
72
72
  description: ! " Spotify for Ruby is a primitive wrapper around libspotify using
73
73
  Ruby FFI.\n If all you want is libspotify for Ruby, you should probably use at
74
74
  Hallon\n instead: https://rubygems.org/gems/hallon\n"
@@ -112,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
112
112
  version: '0'
113
113
  requirements: []
114
114
  rubyforge_project:
115
- rubygems_version: 1.8.12
115
+ rubygems_version: 1.8.17
116
116
  signing_key:
117
117
  specification_version: 3
118
118
  summary: Bare-bones Ruby bindings for libspotify