summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLars-Dominik Braun <PromyLOPh@gmail.com>2008-06-11 16:32:23 +0200
committerLars-Dominik Braun <PromyLOPh@gmail.com>2008-06-11 16:32:23 +0200
commit31ff2f7dfd0b6eb98cb90d44d87044321def0f7a (patch)
tree1ccf62813e8cde170be4f2f2bc64eeed01ed24e7 /src
parentb5f287577d924b9d5898602a11a2fd265bb9a84f (diff)
downloadpianobar-windows-31ff2f7dfd0b6eb98cb90d44d87044321def0f7a.tar.gz
pianobar-windows-31ff2f7dfd0b6eb98cb90d44d87044321def0f7a.tar.bz2
pianobar-windows-31ff2f7dfd0b6eb98cb90d44d87044321def0f7a.zip
client: Station renaming implemented
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am2
-rw-r--r--src/main.c17
2 files changed, 18 insertions, 1 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 8f88440..fbd184c 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -2,5 +2,5 @@ bin_PROGRAMS = pianobar
pianobar_SOURCES = main.c
pianobar_CPPFLAGS = ${LIBCURL_CFLAGS} ${LIBAO_CFLAGS} -I../libpiano
-pianobar_LDADD = ${LIBCURL_LIBS} ${LIBAO_LIBS} ${LIBFAAD_LIBS} -lpthread ../libpiano/libpiano.la
+pianobar_LDADD = ${LIBCURL_LIBS} ${LIBAO_LIBS} ${LIBFAAD_LIBS} ${LIBREADLINE_LIBS} -lpthread ../libpiano/libpiano.la
diff --git a/src/main.c b/src/main.c
index 84457df..8b06ed6 100644
--- a/src/main.c
+++ b/src/main.c
@@ -31,6 +31,7 @@ THE SOFTWARE.
#include <unistd.h>
#include <termios.h>
#include <poll.h>
+#include <readline/readline.h>
struct aacPlayer {
/* buffer */
@@ -274,6 +275,7 @@ int main (int argc, char **argv) {
while (!player.finishedPlayback) {
struct pollfd polls = {fileno (stdin), POLLIN, POLLIN};
char buf;
+ char *lineBuf;
if (poll (&polls, 1, 1000) > 0) {
read (fileno (stdin), &buf, sizeof (buf));
@@ -316,6 +318,21 @@ int main (int argc, char **argv) {
player.doQuit = 1;
break;
+ case 'r':
+ lineBuf = readline ("New name?\n");
+ if (lineBuf != NULL && strlen (lineBuf) > 0) {
+ if (PianoRenameStation (&ph, curStation, lineBuf) ==
+ PIANO_RET_OK) {
+ printf ("Renamed.\n");
+ } else {
+ printf ("Error while renaming station.\n");
+ }
+ }
+ if (lineBuf != NULL) {
+ free (lineBuf);
+ }
+ break;
+
case 's':
player.doQuit = 1;
PianoDestroyPlaylist (&ph);