summaryrefslogtreecommitdiff
path: root/src/ui_act.c
diff options
context:
space:
mode:
authorLars-Dominik Braun <PromyLOPh@lavabit.com>2009-12-15 17:08:19 +0100
committerLars-Dominik Braun <PromyLOPh@lavabit.com>2009-12-15 17:08:19 +0100
commit6a62ae4231c2ce10b6623e32198f40f0a2a8e777 (patch)
tree524e9322520bdbee06cdc20f1b8d636147d7aa9f /src/ui_act.c
parent927a878f171580c1fdeb4d01caf0a2c9c32f8b42 (diff)
downloadpianobar-windows-6a62ae4231c2ce10b6623e32198f40f0a2a8e777.tar.gz
pianobar-windows-6a62ae4231c2ce10b6623e32198f40f0a2a8e777.tar.bz2
pianobar-windows-6a62ae4231c2ce10b6623e32198f40f0a2a8e777.zip
New history feature
Default key is 'h', playlists are no longer part of PianoHandle_t now (=> libpiano's api changed)
Diffstat (limited to 'src/ui_act.c')
-rw-r--r--src/ui_act.c61
1 files changed, 59 insertions, 2 deletions
diff --git a/src/ui_act.c b/src/ui_act.c
index a3d33ed..5510b2f 100644
--- a/src/ui_act.c
+++ b/src/ui_act.c
@@ -163,7 +163,7 @@ void BarUiActDeleteStation (BAR_KS_ARGS) {
if ((pRet = BarUiPrintPianoStatus (PianoDeleteStation (ph,
*curStation))) == PIANO_RET_OK) {
BarUiDoSkipSong (player);
- PianoDestroyPlaylist (ph);
+ PianoDestroyPlaylist (*curSong);
*curSong = NULL;
*curStation = NULL;
}
@@ -315,7 +315,7 @@ void BarUiActRenameStation (BAR_KS_ARGS) {
*/
void BarUiActSelectStation (BAR_KS_ARGS) {
BarUiDoSkipSong (player);
- PianoDestroyPlaylist (ph);
+ PianoDestroyPlaylist (*curSong);
*curSong = NULL;
*curStation = BarUiSelectStation (ph, "Select station: ", curFd);
if (*curStation != NULL) {
@@ -386,3 +386,60 @@ void BarUiActQuit (BAR_KS_ARGS) {
*doQuit = 1;
BarUiDoSkipSong (player);
}
+
+/* song history
+ */
+void BarUiActHistory (BAR_KS_ARGS) {
+ char selectBuf[2];
+ PianoSong_t *selectedSong;
+
+ if (*songHistory != NULL) {
+ selectedSong = BarUiSelectSong (*songHistory, curFd);
+ if (selectedSong != NULL) {
+ BarUiMsg (MSG_QUESTION, "%s - %s: [l]ove or [b]an? ",
+ selectedSong->artist, selectedSong->title);
+ BarReadline (selectBuf, sizeof (selectBuf), "lbs", 1, 0, curFd);
+ if (selectBuf[0] == 'l' || selectBuf[0] == 'b') {
+ PianoReturn_t pRet = PIANO_RET_ERR;
+ /* make sure we're transforming the _original_ station (not
+ * curStation) */
+ PianoStation_t *songStation =
+ PianoFindStationById (ph->stations,
+ selectedSong->stationId);
+
+ if (songStation == NULL) {
+ BarUiMsg (MSG_ERR, "Station does not exist any more.\n");
+ return;
+ }
+
+ if (!BarTransformIfShared (ph, songStation)) {
+ return;
+ }
+
+ switch (selectBuf[0]) {
+ case 'l':
+ /* love */
+ /* FIXME: copy&waste */
+ BarUiMsg (MSG_INFO, "Loving song... ");
+ pRet = BarUiPrintPianoStatus (PianoRateTrack (ph,
+ selectedSong, PIANO_RATE_LOVE));
+ BarUiStartEventCmd (settings, "songlove", songStation,
+ selectedSong, pRet);
+ break;
+
+ case 'b':
+ /* ban */
+ BarUiMsg (MSG_INFO, "Banning song... ");
+ pRet = BarUiPrintPianoStatus (PianoRateTrack (ph,
+ selectedSong, PIANO_RATE_BAN));
+ BarUiStartEventCmd (settings, "songban", songStation,
+ selectedSong, pRet);
+ break;
+ } /* end switch */
+ } /* end if selectBuf[0] */
+ } /* end if selectedSong != NULL */
+ } else {
+ BarUiMsg (MSG_INFO, (settings->history == 0) ? "History disabled.\n" :
+ "No history yet.\n");
+ }
+}