summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars-Dominik Braun <PromyLOPh@gmail.com>2008-06-12 16:39:16 +0200
committerLars-Dominik Braun <PromyLOPh@gmail.com>2008-06-12 16:39:16 +0200
commit682cd6f7d4dbd3b2d18a7b8c9e375f4143559fcd (patch)
tree578c2980e6f33002af52109b75f0d53a5fd6e636
parent8fe2fdd58acebf96c9fdacb4d13d63ff50a1f898 (diff)
downloadpianobar-windows-682cd6f7d4dbd3b2d18a7b8c9e375f4143559fcd.tar.gz
pianobar-windows-682cd6f7d4dbd3b2d18a7b8c9e375f4143559fcd.tar.bz2
pianobar-windows-682cd6f7d4dbd3b2d18a7b8c9e375f4143559fcd.zip
client: Station deleting added
-rw-r--r--src/main.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c
index 8b06ed6..a032be3 100644
--- a/src/main.c
+++ b/src/main.c
@@ -274,7 +274,7 @@ int main (int argc, char **argv) {
/* in the meantime: wait for user actions */
while (!player.finishedPlayback) {
struct pollfd polls = {fileno (stdin), POLLIN, POLLIN};
- char buf;
+ char buf, yesnoBuf;
char *lineBuf;
if (poll (&polls, 1, 1000) > 0) {
@@ -296,6 +296,23 @@ int main (int argc, char **argv) {
PianoDestroyPlaylist (&ph);
break;
+ case 'd':
+ printf ("Really delete \"%s\"? [yn]\n",
+ curStation->name);
+ read (fileno (stdin), &yesnoBuf, sizeof (yesnoBuf));
+ if (yesnoBuf == 'y') {
+ if (PianoDeleteStation (&ph, curStation) ==
+ PIANO_RET_OK) {
+ player.doQuit = 1;
+ printf ("Deleted.\n");
+ PianoDestroyPlaylist (&ph);
+ curStation = selectStation (&ph);
+ } else {
+ printf ("Error while deleting station.\n");
+ }
+ }
+ break;
+
case 'l':
if (curSong->rating == PIANO_RATE_LOVE) {
printf ("Already loved. No need to do this twice.\n");