Skip to content

Commit

Permalink
piano: Remove move song
Browse files Browse the repository at this point in the history
Doesn’t work with JSON API. See #280.
  • Loading branch information
PromyLOPh committed Jun 26, 2012
1 parent f2d6dc3 commit 845cf4c
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 114 deletions.
8 changes: 0 additions & 8 deletions src/libpiano/piano.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ typedef enum {
PIANO_REQUEST_GET_PLAYLIST = 3,
PIANO_REQUEST_RATE_SONG = 4,
PIANO_REQUEST_ADD_FEEDBACK = 5,
PIANO_REQUEST_MOVE_SONG = 6,
PIANO_REQUEST_RENAME_STATION = 7,
PIANO_REQUEST_DELETE_STATION = 8,
PIANO_REQUEST_SEARCH = 9,
Expand Down Expand Up @@ -198,13 +197,6 @@ typedef struct {
PianoSongRating_t rating;
} PianoRequestDataAddFeedback_t;

typedef struct {
PianoSong_t *song;
PianoStation_t *from;
PianoStation_t *to;
unsigned short step;
} PianoRequestDataMoveSong_t;

typedef struct {
PianoStation_t *station;
char *newName;
Expand Down
36 changes: 0 additions & 36 deletions src/libpiano/request.c
Original file line number Diff line number Diff line change
Expand Up @@ -403,42 +403,6 @@ PianoReturn_t PianoRequest (PianoHandle_t *ph, PianoRequest_t *req,
goto cleanup;
break;
}

case PIANO_REQUEST_MOVE_SONG: {
/* move song to a different station, needs two requests */
PianoRequestDataMoveSong_t *reqData = req->data;
PianoRequestDataAddFeedback_t transformedReqData;

assert (reqData != NULL);
assert (reqData->song != NULL);
assert (reqData->from != NULL);
assert (reqData->to != NULL);
assert (reqData->step < 2);

transformedReqData.trackToken = reqData->song->trackToken;
req->data = &transformedReqData;

switch (reqData->step) {
case 0:
transformedReqData.stationId = reqData->from->id;
transformedReqData.rating = PIANO_RATE_BAN;
break;

case 1:
transformedReqData.stationId = reqData->to->id;
transformedReqData.rating = PIANO_RATE_LOVE;
break;
}

/* create request data (url, post data) */
ret = PianoRequest (ph, req, PIANO_REQUEST_ADD_FEEDBACK);
/* and reset request type/data */
req->type = PIANO_REQUEST_MOVE_SONG;
req->data = reqData;

goto cleanup;
break;
}
}

/* standard parameter */
Expand Down
15 changes: 0 additions & 15 deletions src/libpiano/response.c
Original file line number Diff line number Diff line change
Expand Up @@ -334,21 +334,6 @@ PianoReturn_t PianoResponse (PianoHandle_t *ph, PianoRequest_t *req) {
break;
}

case PIANO_REQUEST_MOVE_SONG: {
/* move song to different station */
PianoRequestDataMoveSong_t *reqData = req->data;

assert (req->responseData != NULL);
assert (reqData != NULL);
assert (reqData->step < 2);

if (reqData->step == 0) {
ret = PIANO_RET_CONTINUE_REQUEST;
++reqData->step;
}
break;
}

case PIANO_REQUEST_DELETE_STATION: {
/* delete station from server and station list */
PianoStation_t *station = req->data;
Expand Down
29 changes: 14 additions & 15 deletions src/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,21 @@ typedef enum {
BAR_KS_HISTORY = 8,
BAR_KS_INFO = 9,
BAR_KS_ADDSHARED = 10,
BAR_KS_MOVESONG = 11,
BAR_KS_SKIP = 12,
BAR_KS_PLAYPAUSE = 13,
BAR_KS_QUIT = 14,
BAR_KS_RENAMESTATION = 15,
BAR_KS_SELECTSTATION = 16,
BAR_KS_TIRED = 17,
BAR_KS_UPCOMING = 18,
BAR_KS_SELECTQUICKMIX = 19,
BAR_KS_DEBUG = 20,
BAR_KS_BOOKMARK = 21,
BAR_KS_VOLDOWN = 22,
BAR_KS_VOLUP = 23,
BAR_KS_MANAGESTATION = 24,
BAR_KS_SKIP = 11,
BAR_KS_PLAYPAUSE = 12,
BAR_KS_QUIT = 13,
BAR_KS_RENAMESTATION = 14,
BAR_KS_SELECTSTATION = 15,
BAR_KS_TIRED = 16,
BAR_KS_UPCOMING = 17,
BAR_KS_SELECTQUICKMIX = 18,
BAR_KS_DEBUG = 19,
BAR_KS_BOOKMARK = 20,
BAR_KS_VOLDOWN = 21,
BAR_KS_VOLUP = 22,
BAR_KS_MANAGESTATION = 23,
/* insert new shortcuts _before_ this element and increase its value */
BAR_KS_COUNT = 25,
BAR_KS_COUNT = 24,
} BarKeyShortcutId_t;

#define BAR_KS_DISABLED '\x00'
Expand Down
37 changes: 0 additions & 37 deletions src/ui_act.c
Original file line number Diff line number Diff line change
Expand Up @@ -300,43 +300,6 @@ BarUiActCallback(BarUiActSkipSong) {
BarUiDoSkipSong (&app->player);
}

/* move song to different station
*/
BarUiActCallback(BarUiActMoveSong) {
PianoReturn_t pRet;
WaitressReturn_t wRet;
PianoRequestDataMoveSong_t reqData;

assert (selSong != NULL);

reqData.step = 0;

reqData.to = BarUiSelectStation (app, app->ph.stations,
"Move song to station: ", NULL, false);
if (reqData.to != NULL) {
/* find original station (just is case we're playing a quickmix
* station) */
reqData.from = PianoFindStationById (app->ph.stations,
selSong->stationId);
if (reqData.from == NULL) {
BarUiMsg (&app->settings, MSG_ERR, "Station not found\n");
return;
}

if (!BarTransformIfShared (app, reqData.from) ||
!BarTransformIfShared (app, reqData.to)) {
return;
}
BarUiMsg (&app->settings, MSG_INFO, "Moving song to \"%s\"... ", reqData.to->name);
reqData.song = selSong;
if (BarUiActDefaultPianoCall (PIANO_REQUEST_MOVE_SONG, &reqData) &&
selSong == app->playlist) {
BarUiDoSkipSong (&app->player);
}
BarUiActDefaultEventcmd ("songmove");
}
}

/* pause
*/
BarUiActCallback(BarUiActPause) {
Expand Down
1 change: 0 additions & 1 deletion src/ui_act.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ BarUiActCallback(BarUiActStationFromGenre);
BarUiActCallback(BarUiActSongInfo);
BarUiActCallback(BarUiActLoveSong);
BarUiActCallback(BarUiActSkipSong);
BarUiActCallback(BarUiActMoveSong);
BarUiActCallback(BarUiActPause);
BarUiActCallback(BarUiActRenameStation);
BarUiActCallback(BarUiActSelectStation);
Expand Down
2 changes: 0 additions & 2 deletions src/ui_dispatch.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ static const BarUiDispatchAction_t dispatchActions[BAR_KS_COUNT] = {
"print information about song/station", "act_songinfo"},
{'j', BAR_DC_GLOBAL, BarUiActAddSharedStation, "add shared station",
"act_addshared"},
{'m', BAR_DC_SONG, BarUiActMoveSong, "move song to different station",
"act_songmove"},
{'n', BAR_DC_GLOBAL | BAR_DC_STATION, BarUiActSkipSong, "next song",
"act_songnext"},
{'p', BAR_DC_GLOBAL | BAR_DC_STATION, BarUiActPause, "pause/continue",
Expand Down

0 comments on commit 845cf4c

Please sign in to comment.