diff options
author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2013-06-01 23:21:02 +0700 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2013-06-10 11:06:45 +0300 |
commit | 7c804e29bb2823da9c3fa193134ce1fd92be6503 (patch) | |
tree | e518ffcad82626decb06446dabae1c7322b62fe3 /tools/bluetooth-player.c | |
parent | 45cf57c3e84e2f2071afb54519eb2ff42b8ac921 (diff) | |
download | bluez-7c804e29bb2823da9c3fa193134ce1fd92be6503.tar.gz |
tools/bluetooth-player: Print playlist name in command show
This makes command show to print playlist name if available
Diffstat (limited to 'tools/bluetooth-player.c')
-rw-r--r-- | tools/bluetooth-player.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tools/bluetooth-player.c b/tools/bluetooth-player.c index e6d97e2e6..7e115585e 100644 --- a/tools/bluetooth-player.c +++ b/tools/bluetooth-player.c @@ -431,10 +431,27 @@ static GDBusProxy *find_folder(const char *path) return NULL; } +static GDBusProxy *find_item(const char *path) +{ + GSList *l; + + for (l = items; l; l = g_slist_next(l)) { + GDBusProxy *proxy = l->data; + + if (strcmp(path, g_dbus_proxy_get_path(proxy)) == 0) + return proxy; + } + + return NULL; +} + static void cmd_show(int argc, char *argv[]) { GDBusProxy *proxy; GDBusProxy *folder; + GDBusProxy *item; + DBusMessageIter iter; + const char *path; if (argc < 2) { if (check_default_player() == FALSE) @@ -468,6 +485,19 @@ static void cmd_show(int argc, char *argv[]) print_property(folder, "Name"); print_property(folder, "NumberOfItems"); + + if (!g_dbus_proxy_get_property(proxy, "Playlist", &iter)) + return; + + dbus_message_iter_get_basic(&iter, &path); + + item = find_item(path); + if (item == NULL) + return; + + rl_printf("Playlist %s\n", path); + + print_property(item, "Name"); } static void cmd_select(int argc, char *argv[]) |