From 22e725f545548e6b9583644987e82cb1e3b7ae1f Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Wed, 2 May 2012 17:33:12 +0200 Subject: Really delete seed suggestions There does not seem to be an API call for that. --- src/libpiano/piano.h | 8 -------- src/libpiano/request.c | 30 ------------------------------ src/libpiano/response.c | 14 -------------- src/ui.c | 39 +++++++++++---------------------------- src/ui.h | 2 +- src/ui_act.c | 4 ++-- 6 files changed, 14 insertions(+), 83 deletions(-) diff --git a/src/libpiano/piano.h b/src/libpiano/piano.h index 86dcce0..c8c01db 100644 --- a/src/libpiano/piano.h +++ b/src/libpiano/piano.h @@ -152,7 +152,6 @@ typedef enum { PIANO_REQUEST_GET_GENRE_STATIONS = 14, PIANO_REQUEST_TRANSFORM_STATION = 15, PIANO_REQUEST_EXPLAIN = 16, - PIANO_REQUEST_GET_SEED_SUGGESTIONS = 17, PIANO_REQUEST_BOOKMARK_SONG = 18, PIANO_REQUEST_BOOKMARK_ARTIST = 19, PIANO_REQUEST_GET_STATION_INFO = 20, @@ -225,13 +224,6 @@ typedef struct { char *retExplain; } PianoRequestDataExplain_t; -typedef struct { - PianoStation_t *station; - char *musicId; - unsigned short max; - PianoSearchResult_t searchResult; -} PianoRequestDataGetSeedSuggestions_t; - typedef struct { PianoStation_t *station; PianoStationInfo_t info; diff --git a/src/libpiano/request.c b/src/libpiano/request.c index fcc13d4..427cc2d 100644 --- a/src/libpiano/request.c +++ b/src/libpiano/request.c @@ -325,36 +325,6 @@ PianoReturn_t PianoRequest (PianoHandle_t *ph, PianoRequest_t *req, break; } - case PIANO_REQUEST_GET_SEED_SUGGESTIONS: { -#if 0 - /* find similar artists */ - PianoRequestDataGetSeedSuggestions_t *reqData = req->data; - - assert (reqData != NULL); - assert (reqData->musicId != NULL); - assert (reqData->max != 0); - - snprintf (xmlSendBuf, sizeof (xmlSendBuf), "" - "music.getSeedSuggestions" - "%lu" - /* auth token */ - "%s" - /* station id */ - "%s" - /* seed music id */ - "%s" - /* max */ - "%u" - "", (unsigned long) timestamp, - ph->user.authToken, reqData->station->id, reqData->musicId, - reqData->max); - snprintf (req->urlPath, sizeof (req->urlPath), PIANO_RPC_PATH - "rid=%s&lid=%s&method=getSeedSuggestions&arg1=%s&arg2=%u", - ph->routeId, ph->user.listenerId, reqData->musicId, reqData->max); -#endif - break; - } - case PIANO_REQUEST_BOOKMARK_SONG: { /* bookmark song */ PianoSong_t *song = req->data; diff --git a/src/libpiano/response.c b/src/libpiano/response.c index 16b17a3..7ae4f1e 100644 --- a/src/libpiano/response.c +++ b/src/libpiano/response.c @@ -524,20 +524,6 @@ PianoReturn_t PianoResponse (PianoHandle_t *ph, PianoRequest_t *req) { break; } - case PIANO_REQUEST_GET_SEED_SUGGESTIONS: { -#if 0 - /* find similar artists */ - PianoRequestDataGetSeedSuggestions_t *reqData = req->data; - - assert (req->responseData != NULL); - assert (reqData != NULL); - - ret = PianoXmlParseSeedSuggestions (req->responseData, - &reqData->searchResult); -#endif - break; - } - case PIANO_REQUEST_GET_STATION_INFO: { /* get station information (seeds and feedback) */ PianoRequestDataGetStationInfo_t *reqData = req->data; diff --git a/src/ui.c b/src/ui.c index f13bed5..7728a3f 100644 --- a/src/ui.c +++ b/src/ui.c @@ -485,7 +485,7 @@ PianoArtist_t *BarUiSelectArtist (BarApp_t *app, PianoArtist_t *startArtist) { * @return musicId or NULL on abort/error */ char *BarUiSelectMusicId (BarApp_t *app, PianoStation_t *station, - PianoSong_t *similarSong, const char *msg) { + const char *msg) { char *musicId = NULL; char lineBuf[100], selectBuf[2]; PianoSearchResult_t searchResult; @@ -495,36 +495,19 @@ char *BarUiSelectMusicId (BarApp_t *app, PianoStation_t *station, BarUiMsg (&app->settings, MSG_QUESTION, msg); if (BarReadlineStr (lineBuf, sizeof (lineBuf), &app->input, BAR_RL_DEFAULT) > 0) { - if (strcmp ("?", lineBuf) == 0 && station != NULL && - similarSong != NULL) { - PianoReturn_t pRet; - WaitressReturn_t wRet; - PianoRequestDataGetSeedSuggestions_t reqData; - - reqData.station = station; - reqData.musicId = similarSong->musicId; - reqData.max = 20; - - BarUiMsg (&app->settings, MSG_INFO, "Receiving suggestions... "); - if (!BarUiPianoCall (app, PIANO_REQUEST_GET_SEED_SUGGESTIONS, - &reqData, &pRet, &wRet)) { - return NULL; - } - memcpy (&searchResult, &reqData.searchResult, sizeof (searchResult)); - } else { - PianoReturn_t pRet; - WaitressReturn_t wRet; - PianoRequestDataSearch_t reqData; + PianoReturn_t pRet; + WaitressReturn_t wRet; + PianoRequestDataSearch_t reqData; - reqData.searchStr = lineBuf; + reqData.searchStr = lineBuf; - BarUiMsg (&app->settings, MSG_INFO, "Searching... "); - if (!BarUiPianoCall (app, PIANO_REQUEST_SEARCH, &reqData, &pRet, - &wRet)) { - return NULL; - } - memcpy (&searchResult, &reqData.searchResult, sizeof (searchResult)); + BarUiMsg (&app->settings, MSG_INFO, "Searching... "); + if (!BarUiPianoCall (app, PIANO_REQUEST_SEARCH, &reqData, &pRet, + &wRet)) { + return NULL; } + memcpy (&searchResult, &reqData.searchResult, sizeof (searchResult)); + BarUiMsg (&app->settings, MSG_NONE, "\r"); if (searchResult.songs != NULL && searchResult.artists != NULL) { diff --git a/src/ui.h b/src/ui.h index 08dcca0..ddef633 100644 --- a/src/ui.h +++ b/src/ui.h @@ -43,7 +43,7 @@ PianoStation_t *BarUiSelectStation (BarApp_t *, PianoStation_t *, const char *, PianoSong_t *BarUiSelectSong (const BarSettings_t *, PianoSong_t *, BarReadlineFds_t *); PianoArtist_t *BarUiSelectArtist (BarApp_t *, PianoArtist_t *); -char *BarUiSelectMusicId (BarApp_t *, PianoStation_t *, PianoSong_t *, const char *); +char *BarUiSelectMusicId (BarApp_t *, PianoStation_t *, const char *); void BarStationFromGenre (BarApp_t *); void BarUiPrintStation (const BarSettings_t *, PianoStation_t *); void BarUiPrintSong (const BarSettings_t *, const PianoSong_t *, diff --git a/src/ui_act.c b/src/ui_act.c index 93ba623..0c9ed1b 100644 --- a/src/ui_act.c +++ b/src/ui_act.c @@ -101,7 +101,7 @@ BarUiActCallback(BarUiActAddMusic) { assert (selStation != NULL); reqData.musicId = BarUiSelectMusicId (app, selStation, - selSong, "Add artist or title to station: "); + "Add artist or title to station: "); if (reqData.musicId != NULL) { if (!BarTransformIfShared (app, selStation)) { return; @@ -149,7 +149,7 @@ BarUiActCallback(BarUiActCreateStation) { WaitressReturn_t wRet; PianoRequestDataCreateStation_t reqData; - reqData.id = BarUiSelectMusicId (app, NULL, NULL, + reqData.id = BarUiSelectMusicId (app, NULL, "Create station from artist or title: "); if (reqData.id != NULL) { reqData.type = "mi"; -- cgit v1.2.3