From: Andre Noll Date: Sat, 16 May 2020 10:14:23 +0000 (+0200) Subject: Merge branch 'refs/heads/t/para_play' X-Git-Tag: v0.6.3~18 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=b3c68fd8519a426d6b6285dcb5a865670285e99a;hp=e5e7cf0b78313ca5e696a56e8339c7090bf0cca0 Merge branch 'refs/heads/t/para_play' A single patch which adds --end-of-playlist to control the behaviour of para_play when the end of the playlist is reached. Cooking for three weeks. * refs/heads/t/para_play: play: New option: --end-of-playlist. --- diff --git a/NEWS.md b/NEWS.md index 34aad072..de0aa1b4 100644 --- a/NEWS.md +++ b/NEWS.md @@ -28,6 +28,7 @@ NEWS - Robustness improvements for para_mixer. - A fix for an old bug that could cause the server to crash or report garbage in its status output. +- New para_play option: --end-of-playlist -------------------------------------- 0.6.2 (2018-06-30) "elastic diversity" diff --git a/error.h b/error.h index 8ef9e37d..fe44ff5c 100644 --- a/error.h +++ b/error.h @@ -83,6 +83,7 @@ PARA_ERROR(EMPTY, "file is empty"), \ PARA_ERROR(ENCRYPT, "encrypt error"), \ PARA_ERROR(EOF, "end of file"), \ + PARA_ERROR(EOP, "end of playlist"), \ PARA_ERROR(FEC_BAD_IDX, "invalid index vector"), \ PARA_ERROR(FECDEC_EOF, "received eof packet"), \ PARA_ERROR(FECDEC_OVERRUN, "fecdec output buffer overrun"), \ diff --git a/m4/lls/play.suite.m4 b/m4/lls/play.suite.m4 index 57a9377e..f2220f14 100644 --- a/m4/lls/play.suite.m4 +++ b/m4/lls/play.suite.m4 @@ -26,6 +26,16 @@ version-string = GIT_VERSION() [option randomize] short_opt = z summary = randomize playlist at startup + [option end-of-playlist] + summary = what to do after the last file has been played + arg_info = required_arg + arg_type = string + typestr = behaviour + values = { + EOP_LOOP = "loop", + EOP_STOP = "stop", + EOP_QUIT = "quit" + } [option key-map] short_opt = k summary = map a key to a command diff --git a/play.c b/play.c index 86edc4d4..2346c6b0 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]) @@ -1245,7 +1253,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",