1
0
mirror of https://github.com/SuperBFG7/ympd synced 2025-06-25 22:52:50 +00:00

Fix: repeat jukebox add, if add fails

This commit is contained in:
jcorporation 2018-10-29 23:33:20 +00:00
parent a8979299ce
commit bc3ef6ddfe

View File

@ -1150,6 +1150,7 @@ void mympd_jukebox() {
list_shuffle(&add_list); list_shuffle(&add_list);
nkeep = 0;
struct node *current = add_list.list; struct node *current = add_list.list;
while (current != NULL) { while (current != NULL) {
if (mympd_state.jukeboxMode == 1) { if (mympd_state.jukeboxMode == 1) {
@ -1157,6 +1158,8 @@ void mympd_jukebox() {
if (!mpd_run_add(mpd.conn, current->data)) { if (!mpd_run_add(mpd.conn, current->data)) {
LOG_ERROR_AND_RECOVER("mpd_run_add"); LOG_ERROR_AND_RECOVER("mpd_run_add");
} }
else
nkeep++;
} }
else { else {
printf("Jukebox adding album: %s\n", current->data); printf("Jukebox adding album: %s\n", current->data);
@ -1164,12 +1167,19 @@ void mympd_jukebox() {
LOG_ERROR_AND_RECOVER("mpd_send_command"); LOG_ERROR_AND_RECOVER("mpd_send_command");
return; return;
} }
else
nkeep++;
mpd_response_finish(mpd.conn); mpd_response_finish(mpd.conn);
} }
current = current->next; current = current->next;
} }
list_free(&add_list); list_free(&add_list);
mpd_run_play(mpd.conn); if (nkeep > 0)
mpd_run_play(mpd.conn);
else {
printf("Error adding song(s), trying again...\n");
mympd_jukebox();
}
} }
int randrange(int n) { int randrange(int n) {