All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ v2 1/2] tools/bluetooth-player: Merge cmd_play{,_item}()
@ 2018-03-12  1:56 ERAMOTO Masaya
  2018-03-12  1:56 ` [PATCH BlueZ v2 2/2] tools/bluetooth-player: Add item-generator for change-folder ERAMOTO Masaya
  2018-03-12  8:13 ` [PATCH BlueZ v2 1/2] tools/bluetooth-player: Merge cmd_play{,_item}() Luiz Augusto von Dentz
  0 siblings, 2 replies; 3+ messages in thread
From: ERAMOTO Masaya @ 2018-03-12  1:56 UTC (permalink / raw)
  To: linux-bluetooth

---
Changes since v1
 - separate into two patch which are 1/2 and 2/2.

 tools/bluetooth-player.c | 35 ++++++++++++-----------------------
 1 file changed, 12 insertions(+), 23 deletions(-)

diff --git a/tools/bluetooth-player.c b/tools/bluetooth-player.c
index 75650a722..13b70349e 100644
--- a/tools/bluetooth-player.c
+++ b/tools/bluetooth-player.c
@@ -115,15 +115,21 @@ static void play_reply(DBusMessage *message, void *user_data)
 	return bt_shell_noninteractive_quit(EXIT_FAILURE);
 }
 
-static void cmd_play_item(int argc, char *argv[])
+static void cmd_play(int argc, char *argv[])
 {
 	GDBusProxy *proxy;
 
-	proxy = g_dbus_proxy_lookup(items, NULL, argv[1],
+	if (argc > 1) {
+		proxy = g_dbus_proxy_lookup(items, NULL, argv[1],
 						BLUEZ_MEDIA_ITEM_INTERFACE);
-	if (proxy == NULL) {
-		bt_shell_printf("Item %s not available\n", argv[1]);
-		return bt_shell_noninteractive_quit(EXIT_FAILURE);
+		if (proxy == NULL) {
+			bt_shell_printf("Item %s not available\n", argv[1]);
+			return bt_shell_noninteractive_quit(EXIT_FAILURE);
+		}
+	} else {
+		if (!check_default_player())
+			return bt_shell_noninteractive_quit(EXIT_FAILURE);
+		proxy = default_player;
 	}
 
 	if (g_dbus_proxy_method_call(proxy, "Play", NULL, play_reply,
@@ -132,24 +138,7 @@ static void cmd_play_item(int argc, char *argv[])
 		return bt_shell_noninteractive_quit(EXIT_FAILURE);
 	}
 
-	bt_shell_printf("Attempting to play %s\n", argv[1]);
-}
-
-static void cmd_play(int argc, char *argv[])
-{
-	if (argc > 1)
-		return cmd_play_item(argc, argv);
-
-	if (!check_default_player())
-		return bt_shell_noninteractive_quit(EXIT_FAILURE);
-
-	if (g_dbus_proxy_method_call(default_player, "Play", NULL, play_reply,
-							NULL, NULL) == FALSE) {
-		bt_shell_printf("Failed to play\n");
-		return bt_shell_noninteractive_quit(EXIT_FAILURE);
-	}
-
-	bt_shell_printf("Attempting to play\n");
+	bt_shell_printf("Attempting to play %s\n", argv[1] ? : "");
 }
 
 static void pause_reply(DBusMessage *message, void *user_data)
-- 
2.14.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH BlueZ v2 2/2] tools/bluetooth-player: Add item-generator for change-folder
  2018-03-12  1:56 [PATCH BlueZ v2 1/2] tools/bluetooth-player: Merge cmd_play{,_item}() ERAMOTO Masaya
@ 2018-03-12  1:56 ` ERAMOTO Masaya
  2018-03-12  8:13 ` [PATCH BlueZ v2 1/2] tools/bluetooth-player: Merge cmd_play{,_item}() Luiz Augusto von Dentz
  1 sibling, 0 replies; 3+ messages in thread
From: ERAMOTO Masaya @ 2018-03-12  1:56 UTC (permalink / raw)
  To: linux-bluetooth

---
Changes since v1
 - separate into two patch which are 1/2 and 2/2.

 tools/bluetooth-player.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/bluetooth-player.c b/tools/bluetooth-player.c
index 13b70349e..441a934cc 100644
--- a/tools/bluetooth-player.c
+++ b/tools/bluetooth-player.c
@@ -952,7 +952,8 @@ static const struct bt_shell_menu main_menu = {
 	{ "scan",         "<alltracks/group/off>", cmd_scan,
 						"Set scan mode"},
 	{ "change-folder", "<item>",  cmd_change_folder,
-						"Change current folder" },
+						"Change current folder",
+							item_generator},
 	{ "list-items", "[start] [end]",  cmd_list_items,
 					"List items of current folder" },
 	{ "search",     "<string>",   cmd_search,
-- 
2.14.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH BlueZ v2 1/2] tools/bluetooth-player: Merge cmd_play{,_item}()
  2018-03-12  1:56 [PATCH BlueZ v2 1/2] tools/bluetooth-player: Merge cmd_play{,_item}() ERAMOTO Masaya
  2018-03-12  1:56 ` [PATCH BlueZ v2 2/2] tools/bluetooth-player: Add item-generator for change-folder ERAMOTO Masaya
@ 2018-03-12  8:13 ` Luiz Augusto von Dentz
  1 sibling, 0 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2018-03-12  8:13 UTC (permalink / raw)
  To: ERAMOTO Masaya; +Cc: linux-bluetooth

Hi Eramoto,

On Mon, Mar 12, 2018 at 3:56 AM, ERAMOTO Masaya
<eramoto.masaya@jp.fujitsu.com> wrote:
> ---
> Changes since v1
>  - separate into two patch which are 1/2 and 2/2.
>
>  tools/bluetooth-player.c | 35 ++++++++++++-----------------------
>  1 file changed, 12 insertions(+), 23 deletions(-)
>
> diff --git a/tools/bluetooth-player.c b/tools/bluetooth-player.c
> index 75650a722..13b70349e 100644
> --- a/tools/bluetooth-player.c
> +++ b/tools/bluetooth-player.c
> @@ -115,15 +115,21 @@ static void play_reply(DBusMessage *message, void *user_data)
>         return bt_shell_noninteractive_quit(EXIT_FAILURE);
>  }
>
> -static void cmd_play_item(int argc, char *argv[])
> +static void cmd_play(int argc, char *argv[])
>  {
>         GDBusProxy *proxy;
>
> -       proxy = g_dbus_proxy_lookup(items, NULL, argv[1],
> +       if (argc > 1) {
> +               proxy = g_dbus_proxy_lookup(items, NULL, argv[1],
>                                                 BLUEZ_MEDIA_ITEM_INTERFACE);
> -       if (proxy == NULL) {
> -               bt_shell_printf("Item %s not available\n", argv[1]);
> -               return bt_shell_noninteractive_quit(EXIT_FAILURE);
> +               if (proxy == NULL) {
> +                       bt_shell_printf("Item %s not available\n", argv[1]);
> +                       return bt_shell_noninteractive_quit(EXIT_FAILURE);
> +               }
> +       } else {
> +               if (!check_default_player())
> +                       return bt_shell_noninteractive_quit(EXIT_FAILURE);
> +               proxy = default_player;
>         }
>
>         if (g_dbus_proxy_method_call(proxy, "Play", NULL, play_reply,
> @@ -132,24 +138,7 @@ static void cmd_play_item(int argc, char *argv[])
>                 return bt_shell_noninteractive_quit(EXIT_FAILURE);
>         }
>
> -       bt_shell_printf("Attempting to play %s\n", argv[1]);
> -}
> -
> -static void cmd_play(int argc, char *argv[])
> -{
> -       if (argc > 1)
> -               return cmd_play_item(argc, argv);
> -
> -       if (!check_default_player())
> -               return bt_shell_noninteractive_quit(EXIT_FAILURE);
> -
> -       if (g_dbus_proxy_method_call(default_player, "Play", NULL, play_reply,
> -                                                       NULL, NULL) == FALSE) {
> -               bt_shell_printf("Failed to play\n");
> -               return bt_shell_noninteractive_quit(EXIT_FAILURE);
> -       }
> -
> -       bt_shell_printf("Attempting to play\n");
> +       bt_shell_printf("Attempting to play %s\n", argv[1] ? : "");
>  }
>
>  static void pause_reply(DBusMessage *message, void *user_data)
> --
> 2.14.1

Applied, thanks.

-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-03-12  8:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-12  1:56 [PATCH BlueZ v2 1/2] tools/bluetooth-player: Merge cmd_play{,_item}() ERAMOTO Masaya
2018-03-12  1:56 ` [PATCH BlueZ v2 2/2] tools/bluetooth-player: Add item-generator for change-folder ERAMOTO Masaya
2018-03-12  8:13 ` [PATCH BlueZ v2 1/2] tools/bluetooth-player: Merge cmd_play{,_item}() Luiz Augusto von Dentz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.