enum play_mode mode;
int ret;
+ PARA_INFO_LOG("new playlist: %s\n", arg);
if (!arg) {
ret = change_current_mood(NULL); /* always successful */
mode = PLAY_MODE_MOOD;
ret = clear_score_table();
if (ret < 0) {
- para_printf(&pb, "%s\n", para_strerror(-ret));
- goto out;
+ para_printf(&pb, "could not clear score table: %s\n",
+ para_strerror(-ret));
+ return ret;
}
if (current_play_mode == PLAY_MODE_MOOD)
close_current_mood();
else
playlist_close();
ret = activate_mood_or_playlist(arg, &num_admissible);
- if (ret < 0) {
- para_printf(&pb, "%s\nswitching back to %s\n",
- para_strerror(-ret), current_mop?
- current_mop : "dummy");
- ret = activate_mood_or_playlist(current_mop, &num_admissible);
- if (ret < 0) {
- para_printf(&pb, "failed (%s), switching to dummy\n",
- para_strerror(-ret));
- activate_mood_or_playlist(NULL, &num_admissible);
- }
- } else
- para_printf(&pb, "activated %s (%d admissible files)\n",
- current_mop? current_mop : "dummy mood",
- num_admissible);
+ if (ret >= 0)
+ goto out;
+ para_printf(&pb, "could not activate %s: %s\n"
+ "switching back to %s\n",
+ arg, para_strerror(-ret), current_mop? current_mop : "dummy");
+ /* ignore subsequent errors (but log them) */
+ ret = activate_mood_or_playlist(current_mop, &num_admissible);
+ if (ret >= 0)
+ goto out;
+ para_printf(&pb, "could not activate %s: %s\nswitching to dummy\n",
+ current_mop, para_strerror(-ret));
+ activate_mood_or_playlist(NULL, &num_admissible);
out:
+ para_printf(&pb, "activated %s (%d admissible files)\n",
+ current_mop? current_mop : "dummy mood", num_admissible);
flush_and_free_pb(&pb);
- return 0;
+ return ret;
}
int com_select(struct command_context *cc)