From bfda4e40cce3aa986e4fe8d3881a689cd6ef411f Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Tue, 12 Aug 2008 22:36:48 +0200 Subject: Initial "narrative" implementation "Why did you play this song?" --- src/main.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index 67e9319..a2a169d 100644 --- a/src/main.c +++ b/src/main.c @@ -511,7 +511,7 @@ int main (int argc, char **argv) { /* in the meantime: wait for user actions */ struct pollfd polls = {fileno (stdin), POLLIN, POLLIN}; char buf, yesnoBuf; - char *lineBuf, *musicId; + char *lineBuf, *musicId, *explanation; PianoStation_t *moveStation; if (poll (&polls, 1, 1000) > 0) { @@ -522,6 +522,7 @@ int main (int argc, char **argv) { "b\tban current song\n" "c\tcreate new station\n" "d\tdelete current station\n" + "e\texplain why this song is played\n" "g\tadd genre station\n" "l\tlove current song\n" "n\tnext song\n" @@ -597,6 +598,19 @@ int main (int argc, char **argv) { } break; + case 'e': + if (curSong == NULL) { + BarUiMsg ("No song playing.\n"); + break; + } + BarUiMsg ("Receiving explanation... "); + if (BarUiPrintPianoStatus (PianoExplain (&ph, curSong, + &explanation)) == PIANO_RET_OK) { + printf ("%s\n", explanation); + free (explanation); + } + break; + case 'g': /* use genre station */ BarStationFromGenre (&ph); -- cgit v1.2.3