Skip to content

Commit

Permalink
clients/spotify/libtizspotify: recommendations by track name and arti…
Browse files Browse the repository at this point in the history
…st name (#710 and #727)
  • Loading branch information
juanrubio committed May 1, 2020
1 parent dcb7a0a commit dd000b5
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 0 deletions.
16 changes: 16 additions & 0 deletions clients/spotify/libtizspotify/src/tizspotify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,22 @@ int tizspotify::play_recommendations_by_artist_id (const std::string &artist_id)
return rc;
}

int tizspotify::play_recommendations_by_track (const std::string &track)
{
int rc = 0;
try_catch_wrapper (py_spotify_proxy_.attr (
"enqueue_recommendations_by_track") (bp::object (track)));
return rc;
}

int tizspotify::play_recommendations_by_artist (const std::string &artist)
{
int rc = 0;
try_catch_wrapper (py_spotify_proxy_.attr (
"enqueue_recommendations_by_artist") (bp::object (artist)));
return rc;
}

int tizspotify::play_recommendations_by_genre (const std::string &genre)
{
int rc = 0;
Expand Down
2 changes: 2 additions & 0 deletions clients/spotify/libtizspotify/src/tizspotify.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ class tizspotify
int play_new_releases (const std::string &album);
int play_recommendations_by_track_id (const std::string &track_id);
int play_recommendations_by_artist_id (const std::string &artist_id);
int play_recommendations_by_track (const std::string &track);
int play_recommendations_by_artist (const std::string &artist);
int play_recommendations_by_genre (const std::string &genre);
int play_current_user_liked_tracks ();
int play_current_user_recent_tracks ();
Expand Down
16 changes: 16 additions & 0 deletions clients/spotify/libtizspotify/src/tizspotify_c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,22 @@ extern "C" int tiz_spotify_play_recommendations_by_artist_id (
return ap_spotify->p_proxy_->play_recommendations_by_artist_id (ap_artist_id);
}

extern "C" int tiz_spotify_play_recommendations_by_track (
tiz_spotify_t *ap_spotify, const char *ap_track)
{
assert (ap_spotify);
assert (ap_spotify->p_proxy_);
return ap_spotify->p_proxy_->play_recommendations_by_track (ap_track);
}

extern "C" int tiz_spotify_play_recommendations_by_artist (
tiz_spotify_t *ap_spotify, const char *ap_artist)
{
assert (ap_spotify);
assert (ap_spotify->p_proxy_);
return ap_spotify->p_proxy_->play_recommendations_by_artist (ap_artist);
}

extern "C" int tiz_spotify_play_recommendations_by_genre (
tiz_spotify_t *ap_spotify, const char *ap_genre)
{
Expand Down
32 changes: 32 additions & 0 deletions clients/spotify/libtizspotify/src/tizspotify_c.h
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,38 @@ extern "C"
int tiz_spotify_play_recommendations_by_artist_id (tiz_spotify_t *ap_spotify,
const char *ap_artist_id);

/**
* Find Spotify recommendations by track name the playback queue.
*
* After calling this method, the various tiz_spotify_get* methods can be
* used to interact with the playback queue.
*
* @ingroup libtizspotify
*
* @param ap_spotify The tiz_spotify handle.
* @param ap_track_id A Spotify track ID, URI, or URL.
*
* @return 0 on success
*/
int tiz_spotify_play_recommendations_by_track (tiz_spotify_t *ap_spotify,
const char *ap_track_id);

/**
* Find Spotify recommendations by artist name to the playback queue.
*
* After calling this method, the various tiz_spotify_get* methods can be
* used to interact with the playback queue.
*
* @ingroup libtizspotify
*
* @param ap_spotify The tiz_spotify handle.
* @param ap_artist_id A Spotify artist ID, URI, or URL.
*
* @return 0 on success
*/
int tiz_spotify_play_recommendations_by_artist (tiz_spotify_t *ap_spotify,
const char *ap_artist_id);

/**
* Find Spotify recommendations by genre and add artists to the playback
* queue.
Expand Down

0 comments on commit dd000b5

Please sign in to comment.