lib/spotify.rb in spotify-7.0.4 vs lib/spotify.rb in spotify-8.0.0

- old
+ new

@@ -40,11 +40,11 @@ # # @see http://developer.spotify.com/en/libspotify/docs/group__session.html # enum :sampletype, [:int16_native_endian] - enum :bitrate, %w(160k 320k) + enum :bitrate, %w(160k 320k 96k).map(&:to_sym) # FFI::Struct for Audio Format. # # @attr [:sampletype] sample_type # @attr [Fixnum] sample_rate @@ -69,13 +69,23 @@ # # @see http://developer.spotify.com/en/libspotify/docs/group__session.html # enum :connectionstate, [:logged_out, :logged_in, :disconnected, :undefined] + + # + enum :connection_type, [:unknown, :none, :mobile, :mobile_roaming, :wifi, :wired] + + # + enum :connection_rules, [:network , 0x1, + :network_if_roaming , 0x2, + :allow_sync_over_mobile, 0x4, + :allow_sync_over_wifi , 0x8] attach_function :session_create, :sp_session_create, [ :pointer, :pointer ], :error attach_function :session_release, :sp_session_release, [ :pointer ], :void + attach_function :session_login, :sp_session_login, [ :pointer, :string, :string ], :void attach_function :session_user, :sp_session_user, [ :pointer ], :pointer attach_function :session_logout, :sp_session_logout, [ :pointer ], :void attach_function :session_connectionstate, :sp_session_connectionstate, [ :pointer ], :connectionstate attach_function :session_userdata, :sp_session_userdata, [ :pointer ], :pointer @@ -92,10 +102,19 @@ attach_function :session_starred_for_user_create, :sp_session_starred_for_user_create, [ :pointer, :string ], :pointer attach_function :session_publishedcontainer_for_user_create, :sp_session_publishedcontainer_for_user_create, [ :pointer, :string ], :pointer attach_function :session_preferred_bitrate, :sp_session_preferred_bitrate, [ :pointer, :bitrate ], :void attach_function :session_num_friends, :sp_session_num_friends, [ :pointer ], :int attach_function :session_friend, :sp_session_friend, [ :pointer, :int ], :pointer + + attach_function :session_set_connection_type, :sp_session_set_connection_type, [ :pointer, :pointer ], :void + attach_function :session_set_connection_rules, :sp_session_set_connection_rules, [ :pointer, :pointer ], :void + attach_function :offline_tracks_to_sync, :sp_offline_tracks_to_sync, [ :pointer ], :int + attach_function :offline_num_playlists, :sp_offline_num_playlists, [ :pointer ], :int + attach_function :offline_sync_get_status, :sp_offline_sync_get_status, [ :pointer, :pointer ], :void + attach_function :session_user_country, :sp_session_user_country, [ :pointer ], :int + attach_function :session_preferred_offline_bitrate, :sp_session_preferred_offline_bitrate, [ :pointer, :bitrate, :bool ], :void + # FFI::Struct for Session callbacks. # # @attr [callback(:pointer, :error):void] logged_in # @attr [callback(:pointer):void] logged_out @@ -110,10 +129,11 @@ # @attr [callback(:pointer, :error):void] streaming_error # @attr [callback(:pointer):void] userinfo_updated # @attr [callback(:pointer):void] start_playback # @attr [callback(:pointer):void] stop_playback # @attr [callback(:pointer, :pointer):void] get_audio_buffer_stats + # @attr [callback(:pointer)::void] offline_status_updated class SessionCallbacks < FFI::Struct layout :logged_in, callback([ :pointer, :error ], :void), :logged_out, callback([ :pointer ], :void), :metadata_updated, callback([ :pointer ], :void), :connection_error, callback([ :pointer, :error ], :void), @@ -125,11 +145,12 @@ :end_of_track, callback([ :pointer ], :void), :streaming_error, callback([ :pointer, :error ], :void), :userinfo_updated, callback([ :pointer ], :void), :start_playback, callback([ :pointer ], :void), :stop_playback, callback([ :pointer ], :void), - :get_audio_buffer_stats, callback([ :pointer, :pointer ], :void) + :get_audio_buffer_stats, callback([ :pointer, :pointer ], :void), + :offline_status_updated, callback([ :pointer ], :void) end # FFI::Struct for Session configuration. # # @attr [Fixnum] api_version @@ -152,34 +173,61 @@ :userdata, :pointer, :compress_playlists, :int, :dont_save_metadata_for_playlists, :int, :initially_unload_playlists, :int end + + # FFI::Struct for Offline Sync Status + # + # @attr [Fixnum] queued_tracks + # @attr [Fixnum] queued_bytes + # @attr [Fixnum] done_tracks + # @attr [Fixnum] done_bytes + # @attr [Fixnum] copied_tracks + # @attr [Fixnum] copied_bytes + # @attr [Fixnum] willnotcopy_tracks + # @attr [Fixnum] error_tracks + # @attr [Fixnum] syncing + class OfflineSyncStatus < FFI::Struct + layout :queued_tracks, :int, + :queued_bytes, :uint64, + :done_tracks, :int, + :done_bytes, :uint64, + :copied_tracks, :int, + :copied_bytes, :uint64, + :willnotcopy_tracks, :int, + :error_tracks, :int, + :syncing, :int + end # # Link # # @see http://developer.spotify.com/en/libspotify/docs/group__link.html # enum :linktype, [:invalid, :track, :album, :artist, :search, - :playlist, :profile, :starred, :localtrack] + :playlist, :profile, :starred, :localtrack, :image] attach_function :link_create_from_string, :sp_link_create_from_string, [ :string ], :pointer attach_function :link_create_from_track, :sp_link_create_from_track, [ :pointer, :int ], :pointer attach_function :link_create_from_album, :sp_link_create_from_album, [ :pointer ], :pointer attach_function :link_create_from_artist, :sp_link_create_from_artist, [ :pointer ], :pointer attach_function :link_create_from_search, :sp_link_create_from_search, [ :pointer ], :pointer attach_function :link_create_from_playlist, :sp_link_create_from_playlist, [ :pointer ], :pointer + attach_function :link_create_from_artist_portrait, :sp_link_create_from_artist_portrait, [ :pointer, :int ], :pointer + attach_function :link_create_from_album_cover, :sp_link_create_from_album_cover, [ :pointer ], :pointer + attach_function :link_create_from_image, :sp_link_create_from_image, [ :pointer ], :pointer attach_function :link_create_from_user, :sp_link_create_from_user, [ :pointer ], :pointer attach_function :link_as_string, :sp_link_as_string, [ :pointer, :buffer_out, :int ], :int attach_function :link_type, :sp_link_type, [ :pointer ], :linktype attach_function :link_as_track, :sp_link_as_track, [ :pointer ], :pointer attach_function :link_as_track_and_offset, :sp_link_as_track_and_offset, [ :pointer, :pointer ], :pointer attach_function :link_as_album, :sp_link_as_album, [ :pointer ], :pointer attach_function :link_as_artist, :sp_link_as_artist, [ :pointer ], :pointer attach_function :link_as_user, :sp_link_as_user, [ :pointer ], :pointer + attach_function :link_add_ref, :sp_link_add_ref, [ :pointer ], :void attach_function :link_release, :sp_link_release, [ :pointer ], :void # # Tracks @@ -201,10 +249,11 @@ attach_function :track_duration, :sp_track_duration, [ :pointer ], :int attach_function :track_popularity, :sp_track_popularity, [ :pointer ], :int attach_function :track_disc, :sp_track_disc, [ :pointer ], :int attach_function :track_index, :sp_track_index, [ :pointer ], :int attach_function :localtrack_create, :sp_localtrack_create, [ :string, :string, :string, :int ], :pointer + attach_function :track_add_ref, :sp_track_add_ref, [ :pointer ], :void attach_function :track_release, :sp_track_release, [ :pointer ], :void # # Albums @@ -219,10 +268,11 @@ attach_function :album_artist, :sp_album_artist, [ :pointer ], :pointer attach_function :album_cover, :sp_album_cover, [ :pointer ], :pointer attach_function :album_name, :sp_album_name, [ :pointer ], :string attach_function :album_year, :sp_album_year, [ :pointer ], :int attach_function :album_type, :sp_album_type, [ :pointer ], :albumtype + attach_function :album_add_ref, :sp_album_add_ref, [ :pointer ], :void attach_function :album_release, :sp_album_release, [ :pointer ], :void # # Album Browser @@ -238,10 +288,11 @@ attach_function :albumbrowse_num_copyrights, :sp_albumbrowse_num_copyrights, [ :pointer ], :int attach_function :albumbrowse_copyright, :sp_albumbrowse_copyright, [ :pointer, :int ], :string attach_function :albumbrowse_num_tracks, :sp_albumbrowse_num_tracks, [ :pointer ], :int attach_function :albumbrowse_track, :sp_albumbrowse_track, [ :pointer, :int ], :pointer attach_function :albumbrowse_review, :sp_albumbrowse_review, [ :pointer ], :string + attach_function :albumbrowse_add_ref, :sp_albumbrowse_add_ref, [ :pointer ], :void attach_function :albumbrowse_release, :sp_albumbrowse_release, [ :pointer ], :void # # Artists @@ -249,10 +300,11 @@ # @see http://developer.spotify.com/en/libspotify/docs/group__artist.html # attach_function :artist_name, :sp_artist_name, [ :pointer ], :string attach_function :artist_is_loaded, :sp_artist_is_loaded, [ :pointer ], :bool + attach_function :artist_add_ref, :sp_artist_add_ref, [ :pointer ], :void attach_function :artist_release, :sp_artist_release, [ :pointer ], :void # # Artist Browsing @@ -271,10 +323,11 @@ attach_function :artistbrowse_num_albums, :sp_artistbrowse_num_albums, [ :pointer ], :int attach_function :artistbrowse_album, :sp_artistbrowse_album, [ :pointer, :int ], :pointer attach_function :artistbrowse_num_similar_artists, :sp_artistbrowse_num_similar_artists, [ :pointer ], :int attach_function :artistbrowse_similar_artist, :sp_artistbrowse_similar_artist, [ :pointer, :int ], :pointer attach_function :artistbrowse_biography, :sp_artistbrowse_biography, [ :pointer ], :string + attach_function :artistbrowse_add_ref, :sp_artistbrowse_add_ref, [ :pointer ], :void attach_function :artistbrowse_release, :sp_artistbrowse_release, [ :pointer ], :void # # Images @@ -291,10 +344,12 @@ attach_function :image_is_loaded, :sp_image_is_loaded, [ :pointer ], :bool attach_function :image_error, :sp_image_error, [ :pointer ], :error attach_function :image_format, :sp_image_format, [ :pointer ], :imageformat attach_function :image_data, :sp_image_data, [ :pointer, :pointer ], :pointer attach_function :image_image_id, :sp_image_image_id, [ :pointer ], :pointer + attach_function :image_create_from_link, :sp_image_create_from_link, [ :pointer, :pointer ], :pointer + attach_function :image_add_ref, :sp_image_add_ref, [ :pointer ], :void attach_function :image_release, :sp_image_release, [ :pointer ], :void # # Searching @@ -336,20 +391,24 @@ attach_function :search_query, :sp_search_query, [ :pointer ], :string attach_function :search_did_you_mean, :sp_search_did_you_mean, [ :pointer ], :string attach_function :search_total_tracks, :sp_search_total_tracks, [ :pointer ], :int attach_function :search_total_albums, :sp_search_total_albums, [ :pointer ], :int attach_function :search_total_artists, :sp_search_total_artists, [ :pointer ], :int + attach_function :search_add_ref, :sp_search_add_ref, [ :pointer ], :void attach_function :search_release, :sp_search_release, [ :pointer ], :void # # Playlists # # @see http://developer.spotify.com/en/libspotify/docs/group__playlist.html # enum :playlist_type, [:playlist, :start_folder, :end_folder, :placeholder] + + # + enum :playlist_offline_status, [:no, :yes, :downloading, :waiting] attach_function :playlist_is_loaded, :sp_playlist_is_loaded, [ :pointer ], :bool attach_function :playlist_add_callbacks, :sp_playlist_add_callbacks, [ :pointer, :pointer, :pointer ], :void attach_function :playlist_remove_callbacks, :sp_playlist_remove_callbacks, [ :pointer, :pointer, :pointer ], :void attach_function :playlist_num_tracks, :sp_playlist_num_tracks, [ :pointer ], :int @@ -376,10 +435,14 @@ attach_function :playlist_subscribers_free, :sp_playlist_subscribers_free, [ :pointer ], :void attach_function :playlist_update_subscribers, :sp_playlist_update_subscribers, [ :pointer, :pointer ], :void attach_function :playlist_is_in_ram, :sp_playlist_is_in_ram, [ :pointer, :pointer ], :bool attach_function :playlist_set_in_ram, :sp_playlist_set_in_ram, [ :pointer, :pointer, :bool ], :void attach_function :playlist_create, :sp_playlist_create, [ :pointer, :pointer ], :pointer + attach_function :playlist_get_offline_status, :sp_playlist_get_offline_status, [ :pointer, :pointer ], :playlist_offline_status + attach_function :playlist_get_offline_download_completed, :sp_playlist_get_offline_download_completed, [ :pointer, :pointer ], :playlist_offline_status + attach_function :playlist_set_offline_mode, :sp_playlist_set_offline_mode, [ :pointer, :pointer, :bool ], :void + attach_function :playlist_add_ref, :sp_playlist_add_ref, [ :pointer ], :void attach_function :playlist_release, :sp_playlist_release, [ :pointer ], :void # FFI::Struct for Playlist callbacks. # @@ -437,10 +500,12 @@ attach_function :playlistcontainer_add_playlist, :sp_playlistcontainer_add_playlist, [ :pointer, :pointer ], :pointer attach_function :playlistcontainer_remove_playlist, :sp_playlistcontainer_remove_playlist, [ :pointer, :int ], :error attach_function :playlistcontainer_move_playlist, :sp_playlistcontainer_move_playlist, [ :pointer, :int, :int, :bool ], :error attach_function :playlistcontainer_add_folder, :sp_playlistcontainer_add_folder, [ :pointer, :int, :string ], :error attach_function :playlistcontainer_owner, :sp_playlistcontainer_owner, [ :pointer ], :pointer + attach_function :playlistcontainer_is_loaded, :sp_playlistcontainer_is_loaded, [ :pointer ], :bool + attach_function :playlistcontainer_add_ref, :sp_playlistcontainer_add_ref, [ :pointer ], :void attach_function :playlistcontainer_release, :sp_playlistcontainer_release, [ :pointer ], :void # FFI::Struct for the PlaylistContainer. # @@ -467,10 +532,11 @@ attach_function :user_display_name, :sp_user_display_name, [ :pointer ], :string attach_function :user_is_loaded, :sp_user_is_loaded, [ :pointer ], :bool attach_function :user_full_name, :sp_user_full_name, [ :pointer ], :string attach_function :user_picture, :sp_user_picture, [ :pointer ], :string attach_function :user_relation_type, :sp_user_relation_type, [ :pointer, :pointer ], :relation_type + attach_function :user_add_ref, :sp_user_add_ref, [ :pointer ], :void attach_function :user_release, :sp_user_release, [ :pointer ], :void # # Toplists @@ -482,25 +548,27 @@ enum :toplistregion, [:everywhere, :user] attach_function :toplistbrowse_create, :sp_toplistbrowse_create, [ :pointer, :toplisttype, :toplistregion, :string, callback([:pointer, :pointer], :void), :pointer ], :pointer attach_function :toplistbrowse_is_loaded, :sp_toplistbrowse_is_loaded, [ :pointer ], :bool attach_function :toplistbrowse_error, :sp_toplistbrowse_error, [ :pointer ], :error - attach_function :toplistbrowse_add_ref, :sp_toplistbrowse_add_ref, [ :pointer ], :void - attach_function :toplistbrowse_release, :sp_toplistbrowse_release, [ :pointer ], :void attach_function :toplistbrowse_num_artists, :sp_toplistbrowse_num_artists, [ :pointer ], :int attach_function :toplistbrowse_artist, :sp_toplistbrowse_artist, [ :pointer, :int ], :pointer attach_function :toplistbrowse_num_albums, :sp_toplistbrowse_num_albums, [ :pointer ], :int attach_function :toplistbrowse_album, :sp_toplistbrowse_album, [ :pointer, :int ], :pointer attach_function :toplistbrowse_num_tracks, :sp_toplistbrowse_num_tracks, [ :pointer ], :int attach_function :toplistbrowse_track, :sp_toplistbrowse_track, [ :pointer, :int ], :pointer + + attach_function :toplistbrowse_add_ref, :sp_toplistbrowse_add_ref, [ :pointer ], :void + attach_function :toplistbrowse_release, :sp_toplistbrowse_release, [ :pointer ], :void # # Inbox # # @see http://developer.spotify.com/en/libspotify/docs/group__inbox.html # attach_function :inbox_post_tracks, :sp_inbox_post_tracks, [ :pointer, :string, :pointer, :int, :string, callback([:pointer, :pointer], :void), :pointer ], :pointer attach_function :inbox_error, :sp_inbox_error, [ :pointer ], :error + attach_function :inbox_add_ref, :sp_inbox_add_ref, [ :pointer ], :void attach_function :inbox_release, :sp_inbox_release, [ :pointer ], :void end \ No newline at end of file