X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;f=play.c;h=7369c33fe7f3ee2d30505de21e692ce48f33428a;hb=fd671d3289feca3d64c51fa2f34b1c09361da063;hp=86edc4d4e4f47bc1bd38197ed5982e97df9f72cf;hpb=e2e1adca824585eeecd091f54955e51212927533;p=paraslash.git diff --git a/play.c b/play.c index 86edc4d4..7369c33f 100644 --- a/play.c +++ b/play.c @@ -219,7 +219,6 @@ static long unsigned get_play_time(void) return result; } - static void wipe_receiver_node(void) { PARA_NOTICE_LOG("cleaning up receiver node\n"); @@ -434,6 +433,15 @@ static int next_valid_file(void) int i, j = pt->current_file; unsigned num_inputs = lls_num_inputs(play_lpr); + if (j == num_inputs - 1) { + switch (OPT_UINT32_VAL(END_OF_PLAYLIST)) { + case EOP_LOOP: break; + case EOP_STOP: + pt->playing = false; + return 0; + case EOP_QUIT: return -E_EOP; + } + } for (i = 0; i < num_inputs; i++) { j = (j + 1) % num_inputs; if (!pt->invalid[j]) @@ -1043,9 +1051,16 @@ static void session_open(void) history_file = para_strdup(OPT_STRING_VAL(HISTORY_FILE)); else { char *home = para_homedir(); - history_file = make_message("%s/.paraslash/play.history", - home); + char *dot_para = make_message("%s/.paraslash", home); + free(home); + ret = para_mkdir(dot_para, 0777); + /* warn, but otherwise ignore mkdir error */ + if (ret < 0 && ret != -ERRNO_TO_PARA_ERROR(EEXIST)) + PARA_WARNING_LOG("Can not create %s: %s\n", dot_para, + para_strerror(-ret)); + history_file = make_message("%s/play.history", dot_para); + free(dot_para); } ici.history_file = history_file; ici.loglevel = loglevel; @@ -1245,7 +1260,6 @@ int main(int argc, char *argv[]) init_shuffle_map(); pt->invalid = para_calloc(sizeof(*pt->invalid) * num_inputs); pt->rq = CRT_FILE_CHANGE; - pt->current_file = num_inputs - 1; pt->playing = true; pt->task = task_register(&(struct task_info){ .name = "play",