Module: Echowrap::API::Playlist
Constant Summary
Constants included from Utils
Utils::API_KEY_CANNOT_CALL_THIS_METHOD, Utils::INVALID_PARAMETER, Utils::MISSING_OR_INVALID_KEY, Utils::MISSING_PARAMETER, Utils::RATE_LIMIT_EXCEEDED, Utils::SUCCESS
Instance Method Summary collapse
-
#playlist_basic(options = {}) ⇒ Array, Array<Echowrap::Song>
Returns a basic playlist.
-
#playlist_dynamic_create(options = {}) ⇒ Echowrap::Playlist
Creates a new dynamic playlist session.
-
#playlist_dynamic_delete(options = {}) ⇒ Boolean
Deletes a previously created session.
-
#playlist_dynamic_feedback(options = {}) ⇒ Boolean
Give feedback on the given items (artists or songs) or the last played song.
-
#playlist_dynamic_info(options = {}) ⇒ Echowrap::Playlist
Returns information about a dynamic playlist session.
-
#playlist_dynamic_next(options = {}) ⇒ Echowrap::Playlist
Returns the next songs in the playlist.
-
#playlist_dynamic_restart(options = {}) ⇒ Echowrap::Playlist
Restarts a playlist session.
-
#playlist_dynamic_steer(options = {}) ⇒ Boolean
Steers the playlist based upon the given constraints.
-
#playlist_static(options = {}) ⇒ Array, Array<Echowrap::Song>
Returns a static playlist.
Instance Method Details
#playlist_basic(options = {}) ⇒ Array, Array<Echowrap::Song>
Returns a basic playlist. A basic playlist is generated once from an initial set of parameters, and returned as an ordered list of songs. Basic playlist functionality is supported, see the static and dynamic playlist APIs for advanced contextual and personalized playlisting. Some properties of a basic playlist:
Songs are never repeated
Artists may be repeated
A number of different algorithms can be used to select songs for the playlist. These are specified with the type parameter.
31 32 33 |
# File 'lib/echowrap/api/playlist.rb', line 31 def playlist_basic(={}) objects_from_response(Echowrap::Song, :get, '/api/v4/playlist/basic', :songs, ) end |
#playlist_dynamic_create(options = {}) ⇒ Echowrap::Playlist
Creates a new dynamic playlist session. A dynamic playlist is created with an initial set of parameters that define rules for generating the playlist. A session identifier is returned that can be used with other dynamic methods to get new songs, provide feedback or to steer the playlist. Songs in the playlist can be fetched, one at a time, using the dynamic/next method. The playlist is dynamic in that it is adapted dynamically based on the listener’s feedback and steering. The dynamic playlist will adapt the playlist session based upon a number of factors:
Played songs
Skipped songs
Rated songs/artists
Favorited songs/artists
Banned songs/artists
Playlist steering
The dynamic/create method accepts the same set of parameters as the playlist/static method with the exception of the results parameter.
122 123 124 |
# File 'lib/echowrap/api/playlist.rb', line 122 def playlist_dynamic_create(={}) object_from_response(Echowrap::Playlist, :get, '/api/v4/playlist/dynamic/create', nil, ) end |
#playlist_dynamic_delete(options = {}) ⇒ Boolean
Deletes a previously created session. A non-commercial API can have, at most 1,000 active playlist sessions.
243 244 245 |
# File 'lib/echowrap/api/playlist.rb', line 243 def playlist_dynamic_delete(={}) boolean_from_response(:get, '/api/v4/playlist/dynamic/delete', ) end |
#playlist_dynamic_feedback(options = {}) ⇒ Boolean
Give feedback on the given items (artists or songs) or the last played song. This method allows you to give user feedback such as rating, favoriting, banning of a song or artist. Feedback is applied to the item specified by the given song_id or track_id. If no song_id or track_id is specified, then the feedback is applied to the most recent song returned by dynamic/next. Multiple feedbacks can be given at any time. Specified songs need not be in the session history. This allows the pre-seeding of a session with played tracks, skipped tracks, favorites, ratings and bans.
182 183 184 |
# File 'lib/echowrap/api/playlist.rb', line 182 def playlist_dynamic_feedback(={}) boolean_from_response(:get, '/api/v4/playlist/dynamic/feedback', ) end |
#playlist_dynamic_info(options = {}) ⇒ Echowrap::Playlist
Returns information about a dynamic playlist session
227 228 229 |
# File 'lib/echowrap/api/playlist.rb', line 227 def playlist_dynamic_info(={}) object_from_response(Echowrap::Playlist, :get, '/api/v4/playlist/dynamic/info', nil, ) end |
#playlist_dynamic_next(options = {}) ⇒ Echowrap::Playlist
Returns the next songs in the playlist. Results includes two lists of songs - one list (called next) contains the next songs to play, the other (called lookahead) contains the lookahead songs (controlled via the lookahead parameter). The next songs returned by this method will be considered to be played starting at the time the call returns. Use the dynamic/feedback method to indicate that the song was skipped or not played.
156 157 158 |
# File 'lib/echowrap/api/playlist.rb', line 156 def playlist_dynamic_next(={}) object_from_response(Echowrap::Playlist, :get, '/api/v4/playlist/dynamic/next', nil, ) end |
#playlist_dynamic_restart(options = {}) ⇒ Echowrap::Playlist
Restarts a playlist session. Given the session ID and a new set of playlist parameters, this method restarts the playlist session based upon the new parameters. The session history is maintained. Everything else is reset. This method takes all the same parameters as dynamic/create, plus the session ID. Returns the given session ID.
138 139 140 |
# File 'lib/echowrap/api/playlist.rb', line 138 def playlist_dynamic_restart(={}) object_from_response(Echowrap::Playlist, :get, '/api/v4/playlist/dynamic/restart', nil, ) end |
#playlist_dynamic_steer(options = {}) ⇒ Boolean
Steers the playlist based upon the given constraints. Steerings are additive and can be reset with the reset parameter.
211 212 213 |
# File 'lib/echowrap/api/playlist.rb', line 211 def playlist_dynamic_steer(={}) boolean_from_response(:get, '/api/v4/playlist/dynamic/steer', ) end |
#playlist_static(options = {}) ⇒ Array, Array<Echowrap::Song>
Returns a static playlist. A static playlist is generated once from an initial set of parameters, and returned as an ordered list of songs. Some properties of a static playlist:
Songs are never repeated
Artist may be repeated
A number of different algorithms can be used to select songs for the playlist. These are specified with the type parameter.
98 99 100 |
# File 'lib/echowrap/api/playlist.rb', line 98 def playlist_static(={}) objects_from_response(Echowrap::Song, :get, '/api/v4/playlist/static', :songs, ) end |