1 /* audio-cmd.c: Sends commands to music player.
3 Copyright (C) 2019 Michael Zucchi
5 This program is free software: you can redistribute it and/or
6 modify it under the terms of the GNU General Public License as
7 published by the Free Software Foundation, either version 3 of the
8 License, or (at your option) any later version.
10 This program is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see
17 <http://www.gnu.org/licenses/>.
28 int main(int argc, char **argv) {
31 notify_t player = notify_writer_new(NOTIFY_PLAYER);
33 if (strcmp(cmd, "pause") == 0)
34 notify_msg_send(player, NOTIFY_PLAY_PAUSE, 1, NULL);
35 else if (strcmp(cmd, "play") == 0)
36 notify_msg_send(player, NOTIFY_PLAY_PLAY, 0, NULL);
37 else if (strcmp(cmd, "seek") == 0 || strcmp(cmd, "skip") == 0) {
39 struct notify_play_seek msg;
41 msg.mode = strcmp(cmd, "skip") == 0;
42 msg.stamp = strtod(argv[2], NULL);
44 notify_msg_send(player, NOTIFY_PLAY_SEEK, 0, &msg);
46 } else if (strcmp(cmd, "next") == 0) {
47 notify_msg_send(player, NOTIFY_PLAY_NEXT, 0, NULL);
48 } else if (strcmp(cmd, "prev") == 0) {
49 notify_msg_send(player, NOTIFY_PLAY_PREV, 0, NULL);
50 } else if (strcmp(cmd, "goto") == 0) {
52 struct notify_goto msg = {
53 .info.listid = atoi(argv[2]),
54 .info.fileid = atoi(argv[3])
56 notify_msg_send(player, NOTIFY_PLAY_GOTO, 0, &msg);
58 } else if (strcmp(cmd, "playnow") == 0) {
60 struct notify_goto msg = {
61 .info.fileid = atoi(argv[2])
63 notify_msg_send(player, NOTIFY_PLAY_NOW, 0, &msg);
65 } else if (strcmp(cmd, "enqueue") == 0) {
67 struct notify_goto msg = {
68 .info.fileid = atoi(argv[2])
70 notify_msg_send(player, NOTIFY_PLAY_ENQUEUE, 0, &msg);
72 } else if (strcmp(cmd, "vol+") == 0) {
73 notify_msg_send(player, NOTIFY_VOLUME_UP, 0, NULL);
74 } else if (strcmp(cmd, "vol-") == 0) {
75 notify_msg_send(player, NOTIFY_VOLUME_DOWN, 0, NULL);
76 } else if (strcmp(cmd, "mute") == 0) {
77 notify_msg_send(player, NOTIFY_VOLUME_MUTE, 0, NULL);
78 } else if (strcmp(cmd, "quit") == 0) {
79 notify_msg_send(player, NOTIFY_QUIT, 0, NULL);
80 } else if (strcmp(cmd, "debug") == 0) {
82 struct notify_debug msg;
84 msg.func = atoi(argv[2]);
86 notify_msg_send(player, NOTIFY_DEBUG, 0, &msg);