[rhythmbox] rb-client: add --select-source, --activate-source, and --play-source arguments



commit 83b5f1865cee9a5af9a90c427f54cee302d5131e
Author: Jonathan Matthew <jonathan d14n org>
Date:   Tue Aug 10 23:23:06 2010 +1000

    rb-client: add --select-source, --activate-source, and --play-source arguments
    
    --select-source: selects the source corresponding to the given URI
    --activate-source: selects a source and starts playing from it if not playing
    --play-source: selects and starts playing from a source

 data/rhythmbox-client.1 |    9 +++++++++
 remote/dbus/rb-client.c |   18 ++++++++++++++++++
 2 files changed, 27 insertions(+), 0 deletions(-)
---
diff --git a/data/rhythmbox-client.1 b/data/rhythmbox-client.1
index e477916..b6386f5 100644
--- a/data/rhythmbox-client.1
+++ b/data/rhythmbox-client.1
@@ -101,6 +101,15 @@ Mute playback
 .TP
 .B \-\-unmute
 Unmute playback
+.TP
+.BI "\-\-select-source="URI
+Select the source corresponding to a URI (device or mount point)
+.TP
+.BI "\-\-activate-source="URI
+Select the source corresponding to a URI (device or mount point) and start playing from it if not already playing.
+.TP
+.BI "\-\-play-source="URI
+Select the source corresponding to a URI (device or mount point) and start playing from it.
 .SH FORMAT OPTIONS
 .TP
 %at
diff --git a/remote/dbus/rb-client.c b/remote/dbus/rb-client.c
index bbf914a..f2fca52 100644
--- a/remote/dbus/rb-client.c
+++ b/remote/dbus/rb-client.c
@@ -62,6 +62,9 @@ static gboolean enqueue = FALSE;
 
 static gboolean clear_queue = FALSE;
 
+static gchar *select_source = NULL;
+static gchar *activate_source = NULL;
+static gchar *play_source = NULL;
 static gchar *play_uri = NULL;
 static gboolean print_playing = FALSE;
 static gchar *print_playing_format = NULL;
@@ -101,6 +104,9 @@ static GOptionEntry args[] = {
 
 	{ "print-playing", 0, 0, G_OPTION_ARG_NONE, &print_playing, N_("Print the title and artist of the playing song"), NULL },
 	{ "print-playing-format", 0, 0, G_OPTION_ARG_STRING, &print_playing_format, N_("Print formatted details of the song"), NULL },
+	{ "select-source", 0, 0, G_OPTION_ARG_STRING, &select_source, N_("Select the source matching the specified URI"), N_("Source to select")},
+	{ "activate-source", 0, 0, G_OPTION_ARG_STRING, &activate_source, N_("Activate the source matching the specified URI"), N_("Source to activate")},
+	{ "play-source", 0, 0, G_OPTION_ARG_STRING, &play_source, N_("Play from the source matching the specified URI"), N_("Source to play from")},
 
 	{ "set-volume", 0, 0, G_OPTION_ARG_DOUBLE, &set_volume, N_("Set the playback volume"), NULL },
 	{ "volume-up", 0, 0, G_OPTION_ARG_NONE, &volume_up, N_("Increase the playback volume"), NULL },
@@ -717,6 +723,18 @@ main (int argc, char **argv)
 		}
 	}
 
+	/* select/activate/play source */
+	if (select_source) {
+		org_gnome_Rhythmbox_Shell_activate_source (shell_proxy, select_source, 0, &error);
+		annoy (&error);
+	} else if (activate_source) {
+		org_gnome_Rhythmbox_Shell_activate_source (shell_proxy, activate_source, 1, &error);
+		annoy (&error);
+	} else if (play_source) {
+		org_gnome_Rhythmbox_Shell_activate_source (shell_proxy, play_source, 2, &error);
+		annoy (&error);
+	}
+
 	/* play uri */
 	if (play_uri) {
 		GFile *file;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]