From 02af089e33fd4422185bfeb01b05ed76f7f05713 Mon Sep 17 00:00:00 2001 From: waker Date: Mon, 2 May 2011 22:15:52 +0200 Subject: added --play-pause cmdline option --- main.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'main.c') diff --git a/main.c b/main.c index 554c7459..709790b0 100644 --- a/main.c +++ b/main.c @@ -96,6 +96,7 @@ client_exec_command_line (const char *cmdline, int len) { fprintf (stdout, _(" --stop Stop playback\n")); fprintf (stdout, _(" --pause Pause playback\n")); fprintf (stdout, _(" --toggle-pause Toggle pause\n")); + fprintf (stdout, _(" --play-pause Start playback if stopped, toggle pause otherwise\n")); fprintf (stdout, _(" --next Next song in playlist\n")); fprintf (stdout, _(" --prev Previous song in playlist\n")); fprintf (stdout, _(" --random Random song in playlist\n")); @@ -105,6 +106,7 @@ client_exec_command_line (const char *cmdline, int len) { " [l]ength, track[n]umber, [y]ear, [c]omment,\n" " copy[r]ight, [e]lapsed\n")); fprintf (stdout, _(" e.g.: --nowplaying \"%%a - %%t\" should print \"artist - title\"\n")); + fprintf (stdout, _(" for more info, see http://sourceforge.net/apps/mediawiki/deadbeef/index.php?title=Title_Formatting\n")); return 1; } else if (!strcmp (parg, "--version")) { @@ -202,6 +204,16 @@ server_exec_command_line (const char *cmdline, int len, char *sendback, int sbsi messagepump_push (DB_EV_TOGGLE_PAUSE, 0, 0, 0); return 0; } + else if (!strcmp (parg, "--play-pause")) { + int state = deadbeef->get_output ()->state (); + if (state == OUTPUT_STATE_PLAYING) { + deadbeef->sendmessage (DB_EV_PAUSE, 0, 0, 0); + } + else { + deadbeef->sendmessage (DB_EV_PLAY_CURRENT, 0, 0, 0); + } + return 0; + } else if (!strcmp (parg, "--random")) { messagepump_push (DB_EV_PLAY_RANDOM, 0, 0, 0); return 0; -- cgit v1.2.3