~ubuntu-branches/ubuntu/saucy/xmms2/saucy-proposed

« back to all changes in this revision

Viewing changes to src/clients/cli/cmd_other.c

  • Committer: Bazaar Package Importer
  • Author(s): Florian Ragwitz
  • Date: 2009-05-02 08:31:32 UTC
  • mto: (1.1.6 upstream) (6.1.3 sid)
  • mto: This revision was merged to the branch mainline in revision 23.
  • Revision ID: james.westby@ubuntu.com-20090502083132-y0ulwiqbk4lxfd4z
ImportĀ upstreamĀ versionĀ 0.6DrMattDestruction

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*  XMMS2 - X Music Multiplexer System
2
 
 *  Copyright (C) 2003-2008 XMMS2 Team
 
2
 *  Copyright (C) 2003-2009 XMMS2 Team
3
3
 *
4
4
 *  PLUGINS ARE NOT CONSIDERED TO BE DERIVED WORK !!!
5
5
 *
20
20
cmd_stats (xmmsc_connection_t *conn, gint argc, gchar **argv)
21
21
{
22
22
        xmmsc_result_t *res;
 
23
        xmmsv_t *val;
23
24
 
24
25
        res = xmmsc_main_stats (conn);
25
26
        xmmsc_result_wait (res);
 
27
        val = xmmsc_result_get_value (res);
26
28
 
27
 
        if (xmmsc_result_iserror (res)) {
28
 
                print_error ("%s", xmmsc_result_get_error (res));
 
29
        if (xmmsv_is_error (val)) {
 
30
                print_error ("%s", xmmsv_get_error_old (val));
29
31
        }
30
32
 
31
 
        xmmsc_result_dict_foreach (res, print_hash, NULL);
 
33
        xmmsv_dict_foreach (val, print_hash, NULL);
32
34
        xmmsc_result_unref (res);
33
35
}
34
36
 
37
39
cmd_plugin_list (xmmsc_connection_t *conn, gint argc, gchar **argv)
38
40
{
39
41
        xmmsc_result_t *res;
 
42
        xmmsv_t *val;
 
43
        xmmsv_list_iter_t *it;
40
44
        xmms_plugin_type_t type = XMMS_PLUGIN_TYPE_ALL;
41
45
 
42
46
        if (argc > 2) {
51
55
 
52
56
        res = xmmsc_plugin_list (conn, type);
53
57
        xmmsc_result_wait (res);
 
58
        val = xmmsc_result_get_value (res);
54
59
 
55
 
        if (xmmsc_result_iserror (res)) {
56
 
                print_error ("%s", xmmsc_result_get_error (res));
 
60
        if (xmmsv_is_error (val)) {
 
61
                print_error ("%s", xmmsv_get_error_old (val));
57
62
        }
58
63
 
59
 
        while (xmmsc_result_list_valid (res)) {
 
64
        xmmsv_get_list_iter (val, &it);
 
65
        while (xmmsv_list_iter_valid (it)) {
 
66
                xmmsv_t *dict;
60
67
                const gchar *shortname, *desc;
61
68
 
62
 
                if (xmmsc_result_get_dict_entry_string (res, "shortname", &shortname) &&
63
 
                    xmmsc_result_get_dict_entry_string (res, "description", &desc)) {
 
69
                if (xmmsv_list_iter_entry (it, &dict) &&
 
70
                    xmmsv_dict_entry_get_string (dict, "shortname", &shortname) &&
 
71
                    xmmsv_dict_entry_get_string (dict, "description", &desc)) {
64
72
                        print_info ("%s - %s", shortname, desc);
65
73
                }
66
74
 
67
 
                xmmsc_result_list_next (res);
 
75
                xmmsv_list_iter_next (it);
68
76
        }
69
77
        xmmsc_result_unref (res);
70
78
}
88
96
cmd_browse (xmmsc_connection_t *conn, gint argc, gchar **argv)
89
97
{
90
98
        xmmsc_result_t *res;
 
99
        xmmsv_list_iter_t *it;
 
100
        xmmsv_t *val;
91
101
 
92
102
        if (argc < 3) {
93
103
                print_error ("Need to specify a URL to browse");
95
105
 
96
106
        res = xmmsc_xform_media_browse (conn, argv[2]);
97
107
        xmmsc_result_wait (res);
 
108
        val = xmmsc_result_get_value (res);
98
109
 
99
 
        if (xmmsc_result_iserror (res)) {
100
 
                print_error ("%s", xmmsc_result_get_error (res));
 
110
        if (xmmsv_is_error (val)) {
 
111
                print_error ("%s", xmmsv_get_error_old (val));
101
112
        }
102
113
 
103
 
        for (;xmmsc_result_list_valid (res); xmmsc_result_list_next (res)) {
104
 
                xmmsc_result_value_type_t type;
 
114
        xmmsv_get_list_iter (val, &it);
 
115
        while (xmmsv_list_iter_valid (it)) {
 
116
                xmmsv_t *dict;
 
117
                xmmsv_type_t type;
105
118
                const gchar *r;
106
119
                gint d;
107
120
 
108
 
                type = xmmsc_result_get_dict_entry_type (res, "realpath");
109
 
                if (type != XMMSC_RESULT_VALUE_TYPE_NONE) {
110
 
                        xmmsc_result_get_dict_entry_string (res, "realpath", &r);
 
121
                xmmsv_list_iter_entry (it, &dict);
 
122
                type = xmmsv_dict_entry_get_type (dict, "realpath");
 
123
                if (type != XMMSV_TYPE_NONE) {
 
124
                        xmmsv_dict_entry_get_string (dict, "realpath", &r);
111
125
                } else {
112
 
                        xmmsc_result_get_dict_entry_string (res, "path", &r);
 
126
                        xmmsv_dict_entry_get_string (dict, "path", &r);
113
127
                }
114
128
 
115
 
                xmmsc_result_get_dict_entry_int (res, "isdir", &d);
 
129
                xmmsv_dict_entry_get_int (dict, "isdir", &d);
116
130
                print_info ("%s%c", r, d ? '/' : ' ');
 
131
                xmmsv_list_iter_next (it);
117
132
        }
118
133
 
119
134
        xmmsc_result_unref (res);