diff mbox series

mpris-proxy: add --target to target a specific player

Message ID 20240106202926.8106-2-contact@willowbarraco.fr
State New
Headers show
Series mpris-proxy: add --target to target a specific player | expand

Commit Message

Willow Barraco Jan. 6, 2024, 8:28 p.m. UTC
fixes: https://github.com/bluez/bluez/issues/709

Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
---
 tools/mpris-proxy.c | 8 ++++++++
 1 file changed, 8 insertions(+)
diff mbox series

Patch

diff --git a/tools/mpris-proxy.c b/tools/mpris-proxy.c
index e5fc91fdb..c7a22c121 100644
--- a/tools/mpris-proxy.c
+++ b/tools/mpris-proxy.c
@@ -53,6 +53,7 @@  static GSList *transports = NULL;
 
 static gboolean option_version = FALSE;
 static gboolean option_export = FALSE;
+static gchar *option_target = NULL;
 
 struct tracklist {
 	GDBusProxy *proxy;
@@ -428,6 +429,11 @@  static void add_player(DBusConnection *conn, const char *name,
 	if (!adapter)
 		return;
 
+	if (option_target && strcmp(name, option_target)) {
+		printf("Not the target player, skipped\n");
+		return;
+	}
+
 	player = find_player_by_bus_name(name);
 	if (player == NULL) {
 		reply = get_all(conn, name);
@@ -733,6 +739,8 @@  static GOptionEntry options[] = {
 				"Show version information and exit" },
 	{ "export", 'e', 0, G_OPTION_ARG_NONE, &option_export,
 				"Export remote players" },
+	{ "target", 't', 0, G_OPTION_ARG_STRING, &option_target,
+				"Target a specific player" },
 	{ NULL },
 };