diff --git a/CHANGELOG.md b/CHANGELOG.md index cc0067ae8..9abf5a237 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,8 @@ This is a small bug fix release. ### Changelog - Upd: Translations +- Fix: Add correct number of songs to sticker based smart playlist #1369 +- Fix: Do not crop playlists on shuffle #1369 - Fix: Remove duplicate depends in Debian Control file *** diff --git a/src/mpd_client/playlists.c b/src/mpd_client/playlists.c index e79b9a1ff..6a71956d9 100644 --- a/src/mpd_client/playlists.c +++ b/src/mpd_client/playlists.c @@ -274,14 +274,12 @@ bool mpd_client_playlist_shuffle(struct t_partition_state *partition_state, cons //add shuffled songs to tmp playlist //uses command list to add MPD_COMMANDS_MAX songs at once - unsigned i = 0; bool rc = true; - while (i < plist.length) { + while (plist.length > 0) { if (mpd_command_list_begin(partition_state->conn, false) == true) { unsigned j = 0; struct t_list_node *current; while ((current = list_shift_first(&plist)) != NULL) { - i++; j++; rc = mpd_send_playlist_add(partition_state->conn, playlist_tmp, current->key); list_node_free(current); diff --git a/src/mpd_worker/smartpls.c b/src/mpd_worker/smartpls.c index e02030e5f..87e2bd14c 100644 --- a/src/mpd_worker/smartpls.c +++ b/src/mpd_worker/smartpls.c @@ -432,17 +432,18 @@ static bool mpd_worker_smartpls_update_sticker(struct t_mpd_worker_state *mpd_wo unsigned i = 0; struct t_list_node *current; bool rc = true; - while (i < add_list->length) { + while (add_list->length > 0) { if (mpd_command_list_begin(mpd_worker_state->partition_state->conn, false)) { unsigned j = 0; while ((current = list_shift_first(add_list)) != NULL) { i++; j++; - if (mpd_send_playlist_add(mpd_worker_state->partition_state->conn, playlist, current->key) == false) { + rc = mpd_send_playlist_add(mpd_worker_state->partition_state->conn, playlist, current->key); + list_node_free(current); + if (rc == false) { mympd_set_mpd_failure(mpd_worker_state->partition_state, "Error adding command to command list mpd_send_playlist_add"); break; } - list_node_free(current); if (j == MPD_COMMANDS_MAX) { break; }