aboutsummaryrefslogtreecommitdiffstats
path: root/src/playlist.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/playlist.c43
1 files changed, 20 insertions, 23 deletions
diff --git a/src/playlist.c b/src/playlist.c
index fd46d0fa9..3f18f6b81 100644
--- a/src/playlist.c
+++ b/src/playlist.c
@@ -391,37 +391,34 @@ static void swapSongs(unsigned song1, unsigned song2)
queue_swap(&playlist.queue, song1, song2);
}
-static void queueNextSongInPlaylist(void)
+static void
+playlist_queue_song_order(unsigned order)
{
- if (playlist.current + 1 < (int)queue_length(&playlist.queue)) {
- struct song *song;
- char *uri;
+ struct song *song;
+ char *uri;
- playlist.queued = playlist.current + 1;
+ assert(queue_valid_order(&playlist.queue, order));
- song = queue_get_order(&playlist.queue, playlist.queued);
- uri = song_get_uri(song);
- g_debug("playlist: queue song %i:\"%s\"",
- playlist.queued, uri);
- g_free(uri);
+ playlist.queued = order;
- queueSong(song);
- } else if (!queue_is_empty(&playlist.queue) && playlist.queue.repeat) {
- struct song *song;
- char *uri;
+ song = queue_get_order(&playlist.queue, order);
+ uri = song_get_uri(song);
+ g_debug("playlist: queue song %i:\"%s\"",
+ playlist.queued, uri);
+ g_free(uri);
+ queueSong(song);
+}
+
+static void queueNextSongInPlaylist(void)
+{
+ if (playlist.current + 1 < (int)queue_length(&playlist.queue)) {
+ playlist_queue_song_order(playlist.current + 1);
+ } else if (!queue_is_empty(&playlist.queue) && playlist.queue.repeat) {
if (queue_length(&playlist.queue) > 1 && playlist.queue.random)
randomizeOrder(0, queue_length(&playlist.queue) - 1);
- playlist.queued = 0;
-
- song = queue_get_order(&playlist.queue, playlist.queued);
- uri = song_get_uri(song);
- g_debug("playlist: queue song %i:\"%s\"",
- playlist.queued, uri);
- g_free(uri);
-
- queueSong(song);
+ playlist_queue_song_order(0);
}
}