commit 64e616f54d5ad9edb6881154318856fd0e784330
parent ece43480fc8db7656d49b3aacf11213f805fb2fb
Author: Jacob R. Edwards <jacobouno@protonmail.com>
Date: Thu, 15 Jul 2021 23:12:19 -0700
Fix queue_remove bug
The player would be restarted on every call if not STOPPED, even
without a bug in the player code causing a multitude of instances
of the player process to live at once it was a waste of resources.
Now the player program is stopped but not started again, that's
handled in the main loop.
Diffstat:
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/aps/queue.c b/aps/queue.c
@@ -28,9 +28,11 @@ int
queue_set(struct aps *aps, struct item *item)
{
aps->queue = item;
- if ((aps->player->state != STOPPED && aps->queue) &&
- (pstop(aps->player) || pplay(aps->player, aps->queue->path)))
- return 1;
+ if (aps->player->state && aps->player->state != STOPPED) {
+ if (pstop(aps->player))
+ return 1;
+ aps->player->state = 0;
+ }
return 0;
}