summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2011-02-04 16:06:58 +0100
committerLars-Dominik Braun <lars@6xq.net>2011-02-07 15:45:40 +0100
commit19a5bfdf0eea1e840cd93c99e52b1af5f2647be0 (patch)
tree1247b6aa03e4134669f6233aad5e35b4a378b930
parentf8ee41a287e077e95085a4b26ceee3b92fa2bfd8 (diff)
downloadpianobar-windows-19a5bfdf0eea1e840cd93c99e52b1af5f2647be0.tar.gz
pianobar-windows-19a5bfdf0eea1e840cd93c99e52b1af5f2647be0.tar.bz2
pianobar-windows-19a5bfdf0eea1e840cd93c99e52b1af5f2647be0.zip
Add eventcmd events for login/fetch stations
See issue #83
-rw-r--r--contrib/pianobar.13
-rw-r--r--src/main.c20
2 files changed, 13 insertions, 10 deletions
diff --git a/contrib/pianobar.1 b/contrib/pianobar.1
index 3c192fd..7424e44 100644
--- a/contrib/pianobar.1
+++ b/contrib/pianobar.1
@@ -234,7 +234,8 @@ song length in milliseconds, rating, album art url) is supplied through stdin.
Currently supported events are: artistbookmark, songban, songbookmark,
songexplain, songfinish, songlove, songmove, songshelf, songstart,
stationaddmusic, stationaddshared, stationcreate, stationdelete,
-stationfetchplaylist, stationquickmixtoggle, stationrename
+stationfetchplaylist, stationquickmixtoggle, stationrename, userlogin,
+usergetstations
An example script can be found in the contrib/ directory of
.B pianobar's
diff --git a/src/main.c b/src/main.c
index 54d6006..412faed 100644
--- a/src/main.c
+++ b/src/main.c
@@ -81,15 +81,17 @@ static bool BarMainLoginUser (BarApp_t *app) {
PianoReturn_t pRet;
WaitressReturn_t wRet;
PianoRequestDataLogin_t reqData;
+ bool ret;
+
reqData.user = app->settings.username;
reqData.password = app->settings.password;
reqData.step = 0;
BarUiMsg (MSG_INFO, "Login... ");
- if (!BarUiPianoCall (app, PIANO_REQUEST_LOGIN, &reqData, &pRet, &wRet)) {
- return false;
- }
- return true;
+ ret = BarUiPianoCall (app, PIANO_REQUEST_LOGIN, &reqData, &pRet, &wRet);
+ BarUiStartEventCmd (&app->settings, "userlogin", NULL, NULL, &app->player,
+ NULL, pRet, wRet);
+ return ret;
}
/* ask for username/password if none were provided in settings
@@ -116,13 +118,13 @@ static void BarMainGetLoginCredentials (BarSettings_t *settings,
static bool BarMainGetStations (BarApp_t *app) {
PianoReturn_t pRet;
WaitressReturn_t wRet;
+ bool ret;
BarUiMsg (MSG_INFO, "Get stations... ");
- if (!BarUiPianoCall (app, PIANO_REQUEST_GET_STATIONS, NULL, &pRet,
- &wRet)) {
- return false;
- }
- return true;
+ ret = BarUiPianoCall (app, PIANO_REQUEST_GET_STATIONS, NULL, &pRet, &wRet);
+ BarUiStartEventCmd (&app->settings, "usergetstations", NULL, NULL, &app->player,
+ app->ph.stations, pRet, wRet);
+ return ret;
}
/* get initial station from autostart setting or user input