summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libpiano/main.c2
-rw-r--r--src/main.c10
2 files changed, 8 insertions, 4 deletions
diff --git a/libpiano/main.c b/libpiano/main.c
index 185d94c..0a14311 100644
--- a/libpiano/main.c
+++ b/libpiano/main.c
@@ -68,6 +68,7 @@ void PianoDestroyStations (PianoHandle_t *ph) {
memset (lastStation, 0, sizeof (*lastStation));
free (lastStation);
}
+ ph->stations = NULL;
}
/* FIXME: copy & waste */
@@ -94,6 +95,7 @@ void PianoDestroyPlaylist (PianoHandle_t *ph) {
memset (lastSong, 0, sizeof (*lastSong));
free (lastSong);
}
+ ph->playlist = NULL;
}
/* frees the whole piano handle structure
diff --git a/src/main.c b/src/main.c
index d125122..12aa8a3 100644
--- a/src/main.c
+++ b/src/main.c
@@ -285,12 +285,15 @@ int main (int argc, char **argv) {
player.doQuit = 1;
PianoRateTrack (&ph, curStation, curSong,
PIANO_RATE_BAN);
+ printf ("Banned.\n");
+ /* pandora does this too, I think */
PianoDestroyPlaylist (&ph);
break;
case 'l':
PianoRateTrack (&ph, curStation, curSong,
PIANO_RATE_LOVE);
+ printf ("Loved.\n");
break;
case 'n':
@@ -303,13 +306,11 @@ int main (int argc, char **argv) {
break;
case 's':
- /* FIXME: does not work, segfault... */
player.doQuit = 1;
PianoDestroyPlaylist (&ph);
curStation = selectStation (&ph);
printf ("changed station to %s\n", curStation->name);
break;
-
}
}
}
@@ -321,10 +322,11 @@ int main (int argc, char **argv) {
curSong = lastSong->next;
if (curSong == NULL && !doQuit) {
printf ("receiving new playlist\n");
+ PianoDestroyPlaylist (&ph);
PianoGetPlaylist (&ph, curStation->id);
- curSong = lastSong->next;
+ curSong = ph.playlist;
if (curSong == NULL) {
- /* no tracks left */
+ printf ("no tracks left\n");
doQuit = 1;
}
}