diff options
author | Alexey Yakovenko <wakeroid@gmail.com> | 2010-01-02 15:16:07 +0100 |
---|---|---|
committer | Alexey Yakovenko <wakeroid@gmail.com> | 2010-01-02 15:16:07 +0100 |
commit | a63eff31169b700c1e3384f745eae5c26618ed45 (patch) | |
tree | c662e863e8261efb84d89ba9ac07341b11742246 | |
parent | 044a715c61f1b78cb569fd7711d794296b61b994 (diff) |
few tweaks to playqueue
-rw-r--r-- | main.c | 1 | ||||
-rw-r--r-- | playlist.c | 9 | ||||
-rw-r--r-- | playlist.h | 3 | ||||
-rw-r--r-- | streamer.c | 13 |
4 files changed, 25 insertions, 1 deletions
@@ -320,6 +320,7 @@ player_thread (uintptr_t ctx) { break; case M_PLAYSONGNUM: p_stop (); + pl_playqueue_clear (); streamer_set_nextsong (p1, 1); break; case M_STOPSONG: @@ -2038,6 +2038,7 @@ pl_playqueue_remove (playItem_t *it) { } } } + int pl_playqueue_test (playItem_t *it) { for (int i = 0; i < playqueue_count; i++) { @@ -2047,3 +2048,11 @@ pl_playqueue_test (playItem_t *it) { } return -1; } + +playItem_t * +pl_playqueue_getnext (void) { + if (playqueue_count > 0) { + return playqueue[0]; + } + return NULL; +} @@ -227,4 +227,7 @@ pl_playqueue_remove (playItem_t *it); int pl_playqueue_test (playItem_t *it); +playItem_t * +pl_playqueue_getnext (void); + #endif // __PLAYLIST_H @@ -943,7 +943,18 @@ streamer_play_current_track (void) { else if (playlist_current_row[PL_MAIN] != -1) { // play currently selected track p_stop (); - streamer_set_nextsong (playlist_current_row[PL_MAIN], 1); + // get next song in queue + int idx = -1; + playItem_t *next = pl_playqueue_getnext (); + if (next) { + idx = pl_get_idx_of (next); + pl_playqueue_pop (); + } + else { + idx = playlist_current_row[PL_MAIN]; + } + + streamer_set_nextsong (idx, 1); } else { // restart currently playing track |