ap

An audio player suited to my tastes
Log | Files | Refs | README | LICENSE

commit 422f753bfbb3606bdd7edf10a1d87f4d5433c294
parent 0df06fe0559d57fedada8667bd722a11f756f638
Author: Jacob R. Edwards <jacobouno@protonmail.com>
Date:   Thu, 26 Aug 2021 12:09:28 -0700

Add command to set the player

Diffstat:
Maps/command.c | 25+++++++++++++++++++++++++
Maps/command.h | 1+
Maps/main.c | 1+
3 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/aps/command.c b/aps/command.c @@ -236,3 +236,28 @@ aps_loglevel(struct aps *aps, int s, int argc, char **argv) aps->loglevel = level; return NULL; } + +char * +aps_player(struct aps *aps, int s, int argc, char **argv) +{ + char **ap; + struct player *new; + + if (argc) { + new = pnew(argv); + if (new == NULL) + return errstr; + if (aps->player->state == STOPPED) + new->state = STOPPED; + + pfree(aps->player); + aps->player = new; + return NULL; + } + + for (ap = aps->player->argv; *ap; ++ap) + if (respadd(aps, s, *ap)) + return errstr; + return NULL; +} + diff --git a/aps/command.h b/aps/command.h @@ -16,3 +16,4 @@ char *aps_next(struct aps *, int, int, char **); char *aps_previous(struct aps *, int, int, char **); char *aps_status(struct aps *, int, int, char **); char *aps_loglevel(struct aps *, int, int, char **); +char *aps_player(struct aps *, int, int, char **); diff --git a/aps/main.c b/aps/main.c @@ -43,6 +43,7 @@ static struct command commands[] = { { "next", aps_next }, { "pause", aps_pause }, { "play", aps_play }, + { "player", aps_player }, { "previous", aps_previous }, { "remove", aps_remove }, { "seek", aps_seek },