summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2011-03-21 12:46:56 +0100
committerLars-Dominik Braun <lars@6xq.net>2011-03-21 12:46:56 +0100
commit3ce6e179a94e6000d8dc08650a3614a13a8f29f4 (patch)
tree8f428fefc44087fd96e9e751f1f7fcea0b74eb7f
parentbbd317d85069dee9c9cffff609d1d1fd086cbcb7 (diff)
downloadpianobar-windows-3ce6e179a94e6000d8dc08650a3614a13a8f29f4.tar.gz
pianobar-windows-3ce6e179a94e6000d8dc08650a3614a13a8f29f4.tar.bz2
pianobar-windows-3ce6e179a94e6000d8dc08650a3614a13a8f29f4.zip
Initial station manager
Not functional yet.
-rw-r--r--src/settings.h3
-rw-r--r--src/ui_act.c42
-rw-r--r--src/ui_act.h1
-rw-r--r--src/ui_dispatch.h2
4 files changed, 47 insertions, 1 deletions
diff --git a/src/settings.h b/src/settings.h
index 58ff3d1..90691db 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -53,8 +53,9 @@ typedef enum {
BAR_KS_BOOKMARK = 21,
BAR_KS_VOLDOWN = 22,
BAR_KS_VOLUP = 23,
+ BAR_KS_MANAGESTATION = 24,
/* insert new shortcuts _before_ this element and increase its value */
- BAR_KS_COUNT = 24,
+ BAR_KS_COUNT = 25,
} BarKeyShortcutId_t;
#define BAR_KS_DISABLED '\x00'
diff --git a/src/ui_act.c b/src/ui_act.c
index 096daa1..fc45775 100644
--- a/src/ui_act.c
+++ b/src/ui_act.c
@@ -528,3 +528,45 @@ BarUiActCallback(BarUiActVolUp) {
app->player.scale = BarPlayerCalcScale (app->player.gain + app->settings.volume);
}
+/* manage station (remove seeds or feedback)
+ */
+BarUiActCallback(BarUiActManageStation) {
+ PianoReturn_t pRet;
+ WaitressReturn_t wRet;
+ PianoRequestDataGetStationInfo_t reqData;
+ char selectBuf[2];
+
+ memset (&reqData, 0, sizeof (reqData));
+ reqData.station = selStation;
+
+ BarUiMsg (MSG_INFO, "Fetching station info... ");
+ BarUiActDefaultPianoCall (PIANO_REQUEST_GET_STATION_INFO, &reqData);
+ BarUiActDefaultEventcmd ("stationfetchinfo");
+
+ BarUiMsg (MSG_QUESTION, "Delete [a]rtist/[s]ong seeds or [f]eedback? ");
+ if (BarReadline (selectBuf, sizeof (selectBuf), "asf", &app->input,
+ BAR_RL_FULLRETURN, -1)) {
+ if (selectBuf[0] == 'a') {
+ PianoArtist_t *artist = BarUiSelectArtist (reqData.info.artistSeeds,
+ &app->input);
+ if (artist != NULL) {
+ BarUiMsg (MSG_INFO, "Deleting artist %s\n", artist->name);
+ }
+ } else if (selectBuf[0] == 's') {
+ PianoSong_t *song = BarUiSelectSong (&app->settings,
+ reqData.info.songSeeds, &app->input);
+ if (song != NULL) {
+ BarUiMsg (MSG_INFO, "Deleting seed %s\n", song->title);
+ }
+ } else if (selectBuf[0] == 'f') {
+ PianoSong_t *song = BarUiSelectSong (&app->settings,
+ reqData.info.feedback, &app->input);
+ if (song != NULL) {
+ BarUiMsg (MSG_INFO, "Deleting feedback for %s\n", song->title);
+ }
+ }
+ }
+
+ PianoDestroyStationInfo (&reqData.info);
+}
+
diff --git a/src/ui_act.h b/src/ui_act.h
index ca67c63..4173b75 100644
--- a/src/ui_act.h
+++ b/src/ui_act.h
@@ -57,5 +57,6 @@ BarUiActCallback(BarUiActHistory);
BarUiActCallback(BarUiActBookmark);
BarUiActCallback(BarUiActVolDown);
BarUiActCallback(BarUiActVolUp);
+BarUiActCallback(BarUiActManageStation);
#endif /* _UI_ACT_H */
diff --git a/src/ui_dispatch.h b/src/ui_dispatch.h
index c5aecc5..b2b5a36 100644
--- a/src/ui_dispatch.h
+++ b/src/ui_dispatch.h
@@ -92,6 +92,8 @@ static const BarUiDispatchAction_t dispatchActions[BAR_KS_COUNT] = {
"act_voldown"},
{BAR_DC_GLOBAL, BarUiActVolUp, "increase volume", ')',
"act_volup"},
+ {BAR_DC_STATION, BarUiActManageStation, "delete seeds/feedback", '=',
+ "act_managestation"},
};
#include <piano.h>