summaryrefslogtreecommitdiff
path: root/src/ui_act.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui_act.c')
-rw-r--r--src/ui_act.c47
1 files changed, 41 insertions, 6 deletions
diff --git a/src/ui_act.c b/src/ui_act.c
index 298180c..70fbc9a 100644
--- a/src/ui_act.c
+++ b/src/ui_act.c
@@ -147,14 +147,45 @@ BarUiActCallback(BarUiActBanSong) {
BarUiActCallback(BarUiActCreateStation) {
PianoReturn_t pRet;
WaitressReturn_t wRet;
- char *id = NULL;
+ PianoRequestDataCreateStation_t reqData;
- id = BarUiSelectMusicId (app, NULL,
+ reqData.type = PIANO_MUSICTYPE_INVALID;
+ reqData.token = BarUiSelectMusicId (app, NULL,
"Create station from artist or title: ");
- if (id != NULL) {
+ if (reqData.token != NULL) {
BarUiMsg (&app->settings, MSG_INFO, "Creating station... ");
- BarUiActDefaultPianoCall (PIANO_REQUEST_CREATE_STATION, id);
- free (id);
+ BarUiActDefaultPianoCall (PIANO_REQUEST_CREATE_STATION, &reqData);
+ free (reqData.token);
+ BarUiActDefaultEventcmd ("stationcreate");
+ }
+}
+
+/* create new station
+ */
+BarUiActCallback(BarUiActCreateStationFromSong) {
+ PianoReturn_t pRet;
+ WaitressReturn_t wRet;
+ PianoRequestDataCreateStation_t reqData;
+ char selectBuf[2];
+
+ reqData.token = selSong->trackToken;
+ reqData.type = PIANO_MUSICTYPE_INVALID;
+
+ BarUiMsg (&app->settings, MSG_QUESTION, "Create station from [s]ong or [a]rtist? ");
+ BarReadline (selectBuf, sizeof (selectBuf), "sa", &app->input,
+ BAR_RL_FULLRETURN, -1);
+ switch (selectBuf[0]) {
+ case 's':
+ reqData.type = PIANO_MUSICTYPE_SONG;
+ break;
+
+ case 'a':
+ reqData.type = PIANO_MUSICTYPE_ARTIST;
+ break;
+ }
+ if (reqData.type != PIANO_MUSICTYPE_INVALID) {
+ BarUiMsg (&app->settings, MSG_INFO, "Creating station... ");
+ BarUiActDefaultPianoCall (PIANO_REQUEST_CREATE_STATION, &reqData);
BarUiActDefaultEventcmd ("stationcreate");
}
}
@@ -165,12 +196,16 @@ BarUiActCallback(BarUiActAddSharedStation) {
PianoReturn_t pRet;
WaitressReturn_t wRet;
char stationId[50];
+ PianoRequestDataCreateStation_t reqData;
+
+ reqData.token = stationId;
+ reqData.type = PIANO_MUSICTYPE_INVALID;
BarUiMsg (&app->settings, MSG_QUESTION, "Station id: ");
if (BarReadline (stationId, sizeof (stationId), "0123456789", &app->input,
BAR_RL_DEFAULT, -1) > 0) {
BarUiMsg (&app->settings, MSG_INFO, "Adding shared station... ");
- BarUiActDefaultPianoCall (PIANO_REQUEST_CREATE_STATION, stationId);
+ BarUiActDefaultPianoCall (PIANO_REQUEST_CREATE_STATION, &reqData);
BarUiActDefaultEventcmd ("stationaddshared");
}
}