1
0
mirror of https://github.com/SuperBFG7/ympd synced 2024-09-28 14:18:40 +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);
nkeep = 0;
struct node *current = add_list.list;
while (current != NULL) {
if (mympd_state.jukeboxMode == 1) {
@ -1157,6 +1158,8 @@ void mympd_jukebox() {
if (!mpd_run_add(mpd.conn, current->data)) {
LOG_ERROR_AND_RECOVER("mpd_run_add");
}
else
nkeep++;
}
else {
printf("Jukebox adding album: %s\n", current->data);
@ -1164,12 +1167,19 @@ void mympd_jukebox() {
LOG_ERROR_AND_RECOVER("mpd_send_command");
return;
}
else
nkeep++;
mpd_response_finish(mpd.conn);
}
current = current->next;
}
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) {