1#include "fns.h"
2#include "mpc.h"
3
4static mpc_parser_t *
5mpd_next(void)
6{
7 return mpd_cmd_noarg("next");
8}
9
10mpdf_fold(pause, mpd_opt_arg(MPD_ARG_BOOL))
11
12static mpc_parser_t *
13mpd_pause(void)
14{
15 /* TODO: usage without argument is deprecated */
16 return mpc_and(2, mpdf_pause, mpc_string("pause"),
17 mpc_maybe(mpd_argument(mpd_binary())), free);
18}
19
20mpdf_fold(play, mpd_opt_arg(MPD_ARG_UINT))
21
22static mpc_parser_t *
23mpd_play(void)
24{
25 return mpc_and(2, mpdf_play, mpc_string("play"),
26 mpc_maybe(mpd_argument(mpd_uint())), free);
27}
28
29mpdf_fold(playid, mpd_opt_arg(MPD_ARG_UINT))
30
31static mpc_parser_t *
32mpd_playid(void)
33{
34 return mpc_and(2, mpdf_playid, mpc_string("playid"),
35 mpc_maybe(mpd_argument(mpd_uint())), free);
36}
37
38static mpc_parser_t *
39mpd_previous(void)
40{
41 return mpd_cmd_noarg("previous");
42}
43
44mpdf_fold(seek, MPD_ARG_UINT MPD_ARG_FLOAT)
45
46static mpc_parser_t *
47mpd_seek(void)
48{
49 return mpc_and(3, mpdf_seek, mpc_string("seek"),
50 mpd_argument(mpd_uint()), mpd_argument(mpd_float()),
51 free, free);
52}
53
54mpdf_fold(seekid, MPD_ARG_UINT MPD_ARG_FLOAT)
55
56static mpc_parser_t *
57mpd_seekid(void)
58{
59 return mpc_and(3, mpdf_seekid, mpc_string("seekid"),
60 mpd_argument(mpd_uint()), mpd_argument(mpd_float()),
61 free, free);
62}
63
64/* TODO: Implement seekcur, requires distinguishing +n and n */
65
66static mpc_parser_t *
67mpd_stop(void)
68{
69 return mpd_cmd_noarg("stop");
70}
71
72mpc_parser_t *
73mpd_control_cmds(void)
74{
75 return mpc_or(8, mpd_next(), mpd_pause(), mpd_play(), mpd_playid(),
76 mpd_previous(), mpd_seek(), mpd_seekid(), mpd_stop());
77}