Mercurial > audlegacy
annotate src/audtool/audtool.c @ 2734:eda1f3186687 trunk
[svn] - BSDify code
- use mowgli.error_backtrace in parts of the code
author | nenolod |
---|---|
date | Fri, 11 May 2007 12:22:38 -0700 |
parents | f4a5f8fa3836 |
children | b189991f7417 |
rev | line source |
---|---|
2734 | 1 /* |
2 * Audtool2 | |
3 * Copyright (c) 2007 Audacious development team | |
2313 | 4 * |
2734 | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | |
7 * met: | |
8 * | |
9 * 1. Redistributions of source code must retain the above copyright notice, | |
10 * this list of conditions and the following disclaimer. | |
11 * | |
12 * 2. Redistributions in binary form must reproduce the above copyright | |
13 * notice, this list of conditions and the following disclaimer in the | |
14 * documentation and/or other materials provided with the distribution. | |
2313 | 15 * |
2734 | 16 * 3. The name of the author may not be used to endorse or promote products |
17 * derived from this software without specific prior written permission. | |
2313 | 18 * |
2734 | 19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |
22 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, | |
23 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |
25 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | |
27 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | |
28 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
29 * POSSIBILITY OF SUCH DAMAGE. | |
2313 | 30 */ |
31 | |
32 #include <stdlib.h> | |
2327
921b2d8d9b2e
[svn] Fixed: audtool.c:883: warning: implicit declaration of function 'strncmp'
js
parents:
2313
diff
changeset
|
33 #include <string.h> |
2313 | 34 #include <glib.h> |
2734 | 35 #include <mowgli.h> |
2313 | 36 #include <locale.h> |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
37 #include "libaudclient/audctrl.h" |
2313 | 38 #include "audtool.h" |
39 | |
40 struct commandhandler handlers[] = { | |
41 {"<sep>", NULL, "Vital information"}, | |
42 {"current-song", get_current_song, "returns current song title"}, | |
43 {"current-song-filename", get_current_song_filename, "returns current song filename"}, | |
44 {"current-song-length", get_current_song_length, "returns current song length"}, | |
45 {"current-song-length-seconds", get_current_song_length_seconds, "returns current song length in seconds"}, | |
46 {"current-song-length-frames", get_current_song_length_frames, "returns current song length in frames"}, | |
47 {"current-song-output-length", get_current_song_output_length, "returns current song output length"}, | |
48 {"current-song-output-length-seconds", get_current_song_output_length_seconds, "returns current song output length in seconds"}, | |
49 {"current-song-output-length-frames", get_current_song_output_length_frames, "returns current song output length in frames"}, | |
50 {"current-song-bitrate", get_current_song_bitrate, "returns current song bitrate in bits per second"}, | |
51 {"current-song-bitrate-kbps", get_current_song_bitrate_kbps, "returns current song bitrate in kilobits per second"}, | |
52 {"current-song-frequency", get_current_song_frequency, "returns current song frequency in hertz"}, | |
53 {"current-song-frequency-khz", get_current_song_frequency_khz, "returns current song frequency in kilohertz"}, | |
54 {"current-song-channels", get_current_song_channels, "returns current song channels"}, | |
2585
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
55 {"current-song-tuple-data", get_current_song_tuple_field_data, "returns the value of a tuple field for the current song"}, |
2313 | 56 {"<sep>", NULL, "Playlist manipulation"}, |
57 {"playlist-advance", playlist_advance, "go to the next song in the playlist"}, | |
58 {"playlist-reverse", playlist_reverse, "go to the previous song in the playlist"}, | |
59 {"playlist-addurl", playlist_add_url_string, "adds a url to the playlist"}, | |
60 {"playlist-delete", playlist_delete, "deletes a song from the playlist"}, | |
61 {"playlist-length", playlist_length, "returns the total length of the playlist"}, | |
62 {"playlist-song", playlist_song, "returns the title of a song in the playlist"}, | |
63 {"playlist-song-filename", playlist_song_filename, "returns the filename of a song in the playlist"}, | |
64 {"playlist-song-length", playlist_song_length, "returns the length of a song in the playlist"}, | |
65 {"playlist-song-length-seconds", playlist_song_length_seconds, "returns the length of a song in the playlist in seconds"}, | |
66 {"playlist-song-length-frames", playlist_song_length_frames, "returns the length of a song in the playlist in frames"}, | |
67 {"playlist-display", playlist_display, "returns the entire playlist"}, | |
68 {"playlist-position", playlist_position, "returns the position in the playlist"}, | |
69 {"playlist-jump", playlist_jump, "jumps to a position in the playlist"}, | |
70 {"playlist-clear", playlist_clear, "clears the playlist"}, | |
71 {"playlist-repeat-status", playlist_repeat_status, "returns the status of playlist repeat"}, | |
72 {"playlist-repeat-toggle", playlist_repeat_toggle, "toggles playlist repeat"}, | |
73 {"playlist-shuffle-status", playlist_shuffle_status, "returns the status of playlist shuffle"}, | |
74 {"playlist-shuffle-toggle", playlist_shuffle_toggle, "toggles playlist shuffle"}, | |
2585
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
75 {"playlist-tuple-data", playlist_tuple_field_data, "returns the value of a tuple field for a song in the playlist"}, |
2313 | 76 {"<sep>", NULL, "Playqueue manipulation"}, |
77 {"playqueue-add", playqueue_add, "adds a song to the playqueue"}, | |
78 {"playqueue-remove", playqueue_remove, "removes a song from the playqueue"}, | |
79 {"playqueue-is-queued", playqueue_is_queued, "returns OK if a song is queued"}, | |
80 {"playqueue-get-position", playqueue_get_position, "returns the queue position of a song in the playlist"}, | |
81 {"playqueue-get-qposition", playqueue_get_qposition, "returns the playlist position of a song in the queue"}, | |
82 {"playqueue-length", playqueue_length, "returns the length of the playqueue"}, | |
83 {"playqueue-display", playqueue_display, "returns a list of currently-queued songs"}, | |
84 {"playqueue-clear", playqueue_clear, "clears the playqueue"}, | |
85 {"<sep>", NULL, "Playback manipulation"}, | |
86 {"playback-play", playback_play, "starts/unpauses song playback"}, | |
87 {"playback-pause", playback_pause, "(un)pauses song playback"}, | |
88 {"playback-playpause", playback_playpause, "plays/(un)pauses song playback"}, | |
89 {"playback-stop", playback_stop, "stops song playback"}, | |
90 {"playback-playing", playback_playing, "returns OK if audacious is playing"}, | |
91 {"playback-paused", playback_paused, "returns OK if audacious is paused"}, | |
92 {"playback-stopped", playback_stopped, "returns OK if audacious is stopped"}, | |
93 {"playback-status", playback_status, "returns the playback status"}, | |
94 {"playback-seek", playback_seek, "performs an absolute seek"}, | |
95 {"playback-seek-relative", playback_seek_relative, "performs a seek relative to the current position"}, | |
96 {"<sep>", NULL, "Volume control"}, | |
97 {"get-volume", get_volume, "returns the current volume level in percent"}, | |
98 {"set-volume", set_volume, "sets the current volume level in percent"}, | |
99 {"<sep>", NULL, "Miscellaneous"}, | |
100 {"mainwin-show", mainwin_show, "shows/hides the main window"}, | |
101 {"playlist-show", playlist_show, "shows/hides the playlist window"}, | |
102 {"equalizer-show", equalizer_show, "shows/hides the equalizer window"}, | |
103 {"preferences", show_preferences_window, "shows/hides the preferences window"}, | |
104 {"jumptofile", show_jtf_window, "shows the jump to file window"}, | |
105 {"shutdown", shutdown_audacious_server, "shuts down audacious"}, | |
106 {"<sep>", NULL, "Help system"}, | |
107 {"list-handlers", get_handlers_list, "shows handlers list"}, | |
108 {"help", get_handlers_list, "shows handlers list"}, | |
109 {NULL, NULL, NULL} | |
110 }; | |
111 | |
2734 | 112 static mowgli_error_context_t *e = NULL; |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
113 static DBusGProxy *dbus_proxy = NULL; |
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
114 static DBusGConnection *connection = NULL; |
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
115 |
2734 | 116 static void audtool_connect(void) |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
117 { |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
118 GError *error = NULL; |
2734 | 119 |
120 mowgli_error_context_push(e, "While attempting to connect to the D-Bus session bus"); | |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
121 connection = dbus_g_bus_get(DBUS_BUS_SESSION, &error); |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
122 |
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
123 if (connection == NULL) |
2734 | 124 mowgli_error_context_display_with_error(e, "\n * ", g_strdup_printf("D-Bus Error: %s", error->message)); |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
125 |
2734 | 126 mowgli_error_context_pop(e); |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
127 |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
128 dbus_proxy = dbus_g_proxy_new_for_name(connection, AUDACIOUS_DBUS_SERVICE, |
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
129 AUDACIOUS_DBUS_PATH, |
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
130 AUDACIOUS_DBUS_INTERFACE); |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
131 } |
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
132 |
2313 | 133 gint main(gint argc, gchar **argv) |
134 { | |
135 gint i; | |
136 | |
137 setlocale(LC_CTYPE, ""); | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
138 g_type_init(); |
2734 | 139 mowgli_init(); |
140 | |
141 e = mowgli_error_context_create(); | |
142 mowgli_error_context_push(e, "In program %s", argv[0]); | |
143 | |
144 audtool_connect(); | |
145 | |
146 mowgli_error_context_push(e, "While processing the commandline"); | |
2313 | 147 |
148 if (argc < 2) | |
2734 | 149 mowgli_error_context_display_with_error(e, "\n * ", "not enough parameters, use audtool --help for more information."); |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
150 |
2313 | 151 for (i = 0; handlers[i].name != NULL; i++) |
152 { | |
153 if ((!g_strcasecmp(handlers[i].name, argv[1]) || | |
154 !g_strcasecmp(g_strconcat("--", handlers[i].name, NULL), argv[1])) | |
155 && g_strcasecmp("<sep>", handlers[i].name)) | |
156 { | |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
157 handlers[i].handler(argc, argv); |
2313 | 158 exit(0); |
159 } | |
160 } | |
161 | |
2734 | 162 mowgli_error_context_display_with_error(e, "\n * ", g_strdup_printf("Unknown command `%s' encountered, use audtool --help for a command list.", argv[1])); |
2313 | 163 |
164 return 0; | |
165 } | |
166 | |
167 /*** MOVE TO HANDLERS.C ***/ | |
168 | |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
169 void get_current_song(gint argc, gchar **argv) |
2313 | 170 { |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
171 gint playpos = audacious_remote_get_playlist_pos(dbus_proxy); |
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
172 gchar *song = audacious_remote_get_playlist_title(dbus_proxy, playpos); |
2313 | 173 |
174 if (!song) | |
175 { | |
176 g_print("No song playing.\n"); | |
177 return; | |
178 } | |
179 | |
180 g_print("%s\n", song); | |
181 } | |
182 | |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
183 void get_current_song_filename(gint argc, gchar **argv) |
2313 | 184 { |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
185 gint playpos = audacious_remote_get_playlist_pos(dbus_proxy); |
2313 | 186 |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
187 g_print("%s\n", audacious_remote_get_playlist_file(dbus_proxy, playpos)); |
2313 | 188 } |
189 | |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
190 void get_current_song_output_length(gint argc, gchar **argv) |
2313 | 191 { |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
192 gint frames = audacious_remote_get_output_time(dbus_proxy); |
2313 | 193 gint length = frames / 1000; |
194 | |
195 g_print("%d:%.2d\n", length / 60, length % 60); | |
196 } | |
197 | |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
198 void get_current_song_output_length_seconds(gint argc, gchar **argv) |
2313 | 199 { |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
200 gint frames = audacious_remote_get_output_time(dbus_proxy); |
2313 | 201 gint length = frames / 1000; |
202 | |
203 g_print("%d\n", length); | |
204 } | |
205 | |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
206 void get_current_song_output_length_frames(gint argc, gchar **argv) |
2313 | 207 { |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
208 gint frames = audacious_remote_get_output_time(dbus_proxy); |
2313 | 209 |
210 g_print("%d\n", frames); | |
211 } | |
212 | |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
213 void get_current_song_length(gint argc, gchar **argv) |
2313 | 214 { |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
215 gint playpos = audacious_remote_get_playlist_pos(dbus_proxy); |
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
216 gint frames = audacious_remote_get_playlist_time(dbus_proxy, playpos); |
2313 | 217 gint length = frames / 1000; |
218 | |
219 g_print("%d:%.2d\n", length / 60, length % 60); | |
220 } | |
221 | |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
222 void get_current_song_length_seconds(gint argc, gchar **argv) |
2313 | 223 { |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
224 gint playpos = audacious_remote_get_playlist_pos(dbus_proxy); |
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
225 gint frames = audacious_remote_get_playlist_time(dbus_proxy, playpos); |
2313 | 226 gint length = frames / 1000; |
227 | |
228 g_print("%d\n", length); | |
229 } | |
230 | |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
231 void get_current_song_length_frames(gint argc, gchar **argv) |
2313 | 232 { |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
233 gint playpos = audacious_remote_get_playlist_pos(dbus_proxy); |
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
234 gint frames = audacious_remote_get_playlist_time(dbus_proxy, playpos); |
2313 | 235 |
236 g_print("%d\n", frames); | |
237 } | |
238 | |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
239 void get_current_song_bitrate(gint argc, gchar **argv) |
2313 | 240 { |
241 gint rate, freq, nch; | |
242 | |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
243 audacious_remote_get_info(dbus_proxy, &rate, &freq, &nch); |
2313 | 244 |
245 g_print("%d\n", rate); | |
246 } | |
247 | |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
248 void get_current_song_bitrate_kbps(gint argc, gchar **argv) |
2313 | 249 { |
250 gint rate, freq, nch; | |
251 | |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
252 audacious_remote_get_info(dbus_proxy, &rate, &freq, &nch); |
2313 | 253 |
254 g_print("%d\n", rate / 1000); | |
255 } | |
256 | |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
257 void get_current_song_frequency(gint argc, gchar **argv) |
2313 | 258 { |
259 gint rate, freq, nch; | |
260 | |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
261 audacious_remote_get_info(dbus_proxy, &rate, &freq, &nch); |
2313 | 262 |
263 g_print("%d\n", freq); | |
264 } | |
265 | |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
266 void get_current_song_frequency_khz(gint argc, gchar **argv) |
2313 | 267 { |
268 gint rate, freq, nch; | |
269 | |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
270 audacious_remote_get_info(dbus_proxy, &rate, &freq, &nch); |
2313 | 271 |
272 g_print("%0.1f\n", (gfloat) freq / 1000); | |
273 } | |
274 | |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
275 void get_current_song_channels(gint argc, gchar **argv) |
2313 | 276 { |
277 gint rate, freq, nch; | |
278 | |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
279 audacious_remote_get_info(dbus_proxy, &rate, &freq, &nch); |
2313 | 280 |
281 g_print("%d\n", nch); | |
282 } | |
283 | |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
284 void get_current_song_tuple_field_data(gint argc, gchar **argv) |
2585
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
285 { |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
286 gpointer data; |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
287 |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
288 if (argc < 3) |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
289 { |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
290 g_print("%s: invalid parameters for current-song-tuple-data.\n", argv[0]); |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
291 g_print("%s: syntax: %s current-song-tuple-data <fieldname>\n", argv[0], argv[0]); |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
292 g_print("%s: - fieldname example choices: performer, album_name,\n", argv[0]); |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
293 g_print("%s: track_name, track_number, year, date, genre, comment,\n", argv[0]); |
2593
65073812a5cf
[svn] - custom field support for audacious_get_tuple_field_data()
nhjm449
parents:
2585
diff
changeset
|
294 g_print("%s: file_name, file_ext, file_path, length, formatter,\n", argv[0]); |
65073812a5cf
[svn] - custom field support for audacious_get_tuple_field_data()
nhjm449
parents:
2585
diff
changeset
|
295 g_print("%s: custom, mtime\n", argv[0]); |
2585
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
296 return; |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
297 } |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
298 |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
299 if (!(data = audacious_get_tuple_field_data(dbus_proxy, argv[2], audacious_remote_get_playlist_pos(dbus_proxy)))) |
2585
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
300 { |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
301 return; |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
302 } |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
303 |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
304 if (!strcasecmp(argv[2], "track_number") || !strcasecmp(argv[2], "year") || !strcasecmp(argv[2], "length") || !strcasecmp(argv[2], "mtime")) |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
305 { |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
306 if (*(gint *)data > 0) |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
307 { |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
308 g_print("%d\n", *(gint *)data); |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
309 } |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
310 return; |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
311 } |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
312 |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
313 g_print("%s\n", (gchar *)data); |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
314 } |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
315 |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
316 void playlist_reverse(gint argc, gchar **argv) |
2313 | 317 { |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
318 audacious_remote_playlist_prev(dbus_proxy); |
2313 | 319 } |
320 | |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
321 void playlist_advance(gint argc, gchar **argv) |
2313 | 322 { |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
323 audacious_remote_playlist_next(dbus_proxy); |
2313 | 324 } |
325 | |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
326 void playback_play(gint argc, gchar **argv) |
2313 | 327 { |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
328 audacious_remote_play(dbus_proxy); |
2313 | 329 } |
330 | |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
331 void playback_pause(gint argc, gchar **argv) |
2313 | 332 { |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
333 audacious_remote_pause(dbus_proxy); |
2313 | 334 } |
335 | |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
336 void playback_playpause(gint argc, gchar **argv) |
2313 | 337 { |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
338 if (audacious_remote_is_playing(dbus_proxy)) |
2313 | 339 { |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
340 audacious_remote_pause(dbus_proxy); |
2313 | 341 } |
342 else | |
343 { | |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
344 audacious_remote_play(dbus_proxy); |
2313 | 345 } |
346 } | |
347 | |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
348 void playback_stop(gint argc, gchar **argv) |
2313 | 349 { |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
350 audacious_remote_stop(dbus_proxy); |
2313 | 351 } |
352 | |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
353 void playback_playing(gint argc, gchar **argv) |
2313 | 354 { |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
355 if (!audacious_remote_is_paused(dbus_proxy)) |
2313 | 356 { |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
357 exit(!audacious_remote_is_playing(dbus_proxy)); |
2313 | 358 } |
359 else | |
360 { | |
361 exit(1); | |
362 } | |
363 } | |
364 | |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
365 void playback_paused(gint argc, gchar **argv) |
2313 | 366 { |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
367 exit(!audacious_remote_is_paused(dbus_proxy)); |
2313 | 368 } |
369 | |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
370 void playback_stopped(gint argc, gchar **argv) |
2313 | 371 { |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
372 if (!audacious_remote_is_playing(dbus_proxy) && !audacious_remote_is_paused(dbus_proxy)) |
2313 | 373 { |
374 exit(0); | |
375 } | |
376 else | |
377 { | |
378 exit(1); | |
379 } | |
380 } | |
381 | |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
382 void playback_status(gint argc, gchar **argv) |
2313 | 383 { |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
384 if (audacious_remote_is_paused(dbus_proxy)) |
2313 | 385 { |
386 g_print("paused\n"); | |
387 return; | |
388 } | |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
389 else if (audacious_remote_is_playing(dbus_proxy)) |
2313 | 390 { |
391 g_print("playing\n"); | |
392 return; | |
393 } | |
394 else | |
395 { | |
396 g_print("stopped\n"); | |
397 return; | |
398 } | |
399 } | |
400 | |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
401 void playback_seek(gint argc, gchar **argv) |
2313 | 402 { |
403 if (argc < 3) | |
404 { | |
405 g_print("%s: invalid parameters for playback-seek.\n", argv[0]); | |
406 g_print("%s: syntax: %s playback-seek <position>\n", argv[0], argv[0]); | |
407 return; | |
408 } | |
409 | |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
410 audacious_remote_jump_to_time(dbus_proxy, atoi(argv[2]) * 1000); |
2313 | 411 } |
412 | |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
413 void playback_seek_relative(gint argc, gchar **argv) |
2313 | 414 { |
415 gint oldtime, newtime, diff; | |
416 | |
417 if (argc < 3) | |
418 { | |
419 g_print("%s: invalid parameters for playback-seek-relative.\n", argv[0]); | |
420 g_print("%s: syntax: %s playback-seek <position>\n", argv[0], argv[0]); | |
421 return; | |
422 } | |
423 | |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
424 oldtime = audacious_remote_get_output_time(dbus_proxy); |
2313 | 425 diff = atoi(argv[2]) * 1000; |
426 newtime = oldtime + diff; | |
427 | |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
428 audacious_remote_jump_to_time(dbus_proxy, newtime); |
2313 | 429 } |
430 | |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
431 void playlist_add_url_string(gint argc, gchar **argv) |
2313 | 432 { |
433 if (argc < 3) | |
434 { | |
435 g_print("%s: invalid parameters for playlist-addurl.\n", argv[0]); | |
436 g_print("%s: syntax: %s playlist-addurl <url>\n", argv[0], argv[0]); | |
437 return; | |
438 } | |
439 | |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
440 audacious_remote_playlist_add_url_string(dbus_proxy, argv[2]); |
2313 | 441 } |
442 | |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
443 void playlist_delete(gint argc, gchar **argv) |
2313 | 444 { |
445 gint playpos; | |
446 | |
447 if (argc < 3) | |
448 { | |
449 g_print("%s: invalid parameters for playlist-delete.\n", argv[0]); | |
450 g_print("%s: syntax: %s playlist-delete <position>\n", argv[0], argv[0]); | |
451 return; | |
452 } | |
453 | |
454 playpos = atoi(argv[2]); | |
455 | |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
456 if (playpos < 1 || playpos > audacious_remote_get_playlist_length(dbus_proxy)) |
2313 | 457 { |
458 g_print("%s: invalid playlist position %d\n", argv[0], playpos); | |
459 return; | |
460 } | |
461 | |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
462 audacious_remote_playlist_delete(dbus_proxy, playpos - 1); |
2313 | 463 } |
464 | |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
465 void playlist_length(gint argc, gchar **argv) |
2313 | 466 { |
467 gint i; | |
468 | |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
469 i = audacious_remote_get_playlist_length(dbus_proxy); |
2313 | 470 |
471 g_print("%d\n", i); | |
472 } | |
473 | |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
474 void playlist_song(gint argc, gchar **argv) |
2313 | 475 { |
476 gint playpos; | |
477 gchar *song; | |
478 | |
479 if (argc < 3) | |
480 { | |
481 g_print("%s: invalid parameters for playlist-song-title.\n", argv[0]); | |
482 g_print("%s: syntax: %s playlist-song-title <position>\n", argv[0], argv[0]); | |
483 return; | |
484 } | |
485 | |
486 playpos = atoi(argv[2]); | |
487 | |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
488 if (playpos < 1 || playpos > audacious_remote_get_playlist_length(dbus_proxy)) |
2313 | 489 { |
490 g_print("%s: invalid playlist position %d\n", argv[0], playpos); | |
491 return; | |
492 } | |
493 | |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
494 song = audacious_remote_get_playlist_title(dbus_proxy, playpos - 1); |
2313 | 495 |
496 g_print("%s\n", song); | |
497 } | |
498 | |
499 | |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
500 void playlist_song_length(gint argc, gchar **argv) |
2313 | 501 { |
502 gint playpos, frames, length; | |
503 | |
504 if (argc < 3) | |
505 { | |
506 g_print("%s: invalid parameters for playlist-song-length.\n", argv[0]); | |
507 g_print("%s: syntax: %s playlist-song-length <position>\n", argv[0], argv[0]); | |
508 return; | |
509 } | |
510 | |
511 playpos = atoi(argv[2]); | |
512 | |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
513 if (playpos < 1 || playpos > audacious_remote_get_playlist_length(dbus_proxy)) |
2313 | 514 { |
515 g_print("%s: invalid playlist position %d\n", argv[0], playpos); | |
516 return; | |
517 } | |
518 | |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
519 frames = audacious_remote_get_playlist_time(dbus_proxy, playpos - 1); |
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
520 length = frames / 1000; |
2313 | 521 |
522 g_print("%d:%.2d\n", length / 60, length % 60); | |
523 } | |
524 | |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
525 void playlist_song_length_seconds(gint argc, gchar **argv) |
2313 | 526 { |
527 gint playpos, frames, length; | |
528 | |
529 if (argc < 3) | |
530 { | |
531 g_print("%s: invalid parameters for playlist-song-length-seconds.\n", argv[0]); | |
532 g_print("%s: syntax: %s playlist-song-length-seconds <position>\n", argv[0], argv[0]); | |
533 return; | |
534 } | |
535 | |
536 playpos = atoi(argv[2]); | |
537 | |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
538 if (playpos < 1 || playpos > audacious_remote_get_playlist_length(dbus_proxy)) |
2313 | 539 { |
540 g_print("%s: invalid playlist position %d\n", argv[0], playpos); | |
541 return; | |
542 } | |
543 | |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
544 frames = audacious_remote_get_playlist_time(dbus_proxy, playpos - 1); |
2313 | 545 length = frames / 1000; |
546 | |
547 g_print("%d\n", length); | |
548 } | |
549 | |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
550 void playlist_song_length_frames(gint argc, gchar **argv) |
2313 | 551 { |
552 gint playpos, frames; | |
553 | |
554 if (argc < 3) | |
555 { | |
556 g_print("%s: invalid parameters for playlist-song-length-frames.\n", argv[0]); | |
557 g_print("%s: syntax: %s playlist-song-length-frames <position>\n", argv[0], argv[0]); | |
558 return; | |
559 } | |
560 | |
561 playpos = atoi(argv[2]); | |
562 | |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
563 if (playpos < 1 || playpos > audacious_remote_get_playlist_length(dbus_proxy)) |
2313 | 564 { |
565 g_print("%s: invalid playlist position %d\n", argv[0], playpos); | |
566 return; | |
567 } | |
568 | |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
569 frames = audacious_remote_get_playlist_time(dbus_proxy, playpos - 1); |
2313 | 570 |
571 g_print("%d\n", frames); | |
572 } | |
573 | |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
574 void playlist_display(gint argc, gchar **argv) |
2313 | 575 { |
576 gint i, ii, frames, length, total; | |
577 gchar *songname; | |
578 gchar *fmt = NULL, *p; | |
579 gint column; | |
580 | |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
581 i = audacious_remote_get_playlist_length(dbus_proxy); |
2313 | 582 |
583 g_print("%d tracks.\n", i); | |
584 | |
585 total = 0; | |
586 | |
587 for (ii = 0; ii < i; ii++) | |
588 { | |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
589 songname = audacious_remote_get_playlist_title(dbus_proxy, ii); |
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
590 frames = audacious_remote_get_playlist_time(dbus_proxy, ii); |
2313 | 591 length = frames / 1000; |
592 total += length; | |
593 | |
594 /* adjust width for multi byte characters */ | |
595 column = 60; | |
596 if(songname){ | |
597 p = songname; | |
598 while(*p){ | |
599 gint stride; | |
600 stride = g_utf8_next_char(p) - p; | |
601 if(g_unichar_iswide(g_utf8_get_char(p)) | |
602 #if ( (GLIB_MAJOR_VERSION == 2) && (GLIB_MINOR_VERSION >= 12) ) | |
603 || g_unichar_iswide_cjk(g_utf8_get_char(p)) | |
604 #endif | |
605 ){ | |
606 column += (stride - 2); | |
607 } | |
608 else { | |
609 column += (stride - 1); | |
610 } | |
611 p = g_utf8_next_char(p); | |
612 } | |
613 | |
614 } | |
615 | |
616 fmt = g_strdup_printf("%%4d | %%-%ds | %%d:%%.2d\n", column); | |
617 g_print(fmt, ii + 1, songname, length / 60, length % 60); | |
618 g_free(fmt); | |
619 } | |
620 | |
621 g_print("Total length: %d:%.2d\n", total / 60, total % 60); | |
622 } | |
623 | |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
624 void playlist_position(gint argc, gchar **argv) |
2313 | 625 { |
626 gint i; | |
627 | |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
628 i = audacious_remote_get_playlist_pos(dbus_proxy); |
2313 | 629 |
630 g_print("%d\n", i + 1); | |
631 } | |
632 | |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
633 void playlist_song_filename(gint argc, gchar **argv) |
2313 | 634 { |
635 gint i; | |
636 | |
637 if (argc < 3) | |
638 { | |
639 g_print("%s: invalid parameters for playlist-filename.\n", argv[0]); | |
640 g_print("%s: syntax: %s playlist-filename <position>\n", argv[0], argv[0]); | |
641 return; | |
642 } | |
643 | |
644 i = atoi(argv[2]); | |
645 | |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
646 if (i < 1 || i > audacious_remote_get_playlist_length(dbus_proxy)) |
2313 | 647 { |
648 g_print("%s: invalid playlist position %d\n", argv[0], i); | |
649 return; | |
650 } | |
651 | |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
652 g_print("%s\n", audacious_remote_get_playlist_file(dbus_proxy, i - 1)); |
2313 | 653 } |
654 | |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
655 void playlist_jump(gint argc, gchar **argv) |
2313 | 656 { |
657 gint i; | |
658 | |
659 if (argc < 3) | |
660 { | |
661 g_print("%s: invalid parameters for playlist-jump.\n", argv[0]); | |
662 g_print("%s: syntax: %s playlist-jump <position>\n", argv[0], argv[0]); | |
663 return; | |
664 } | |
665 | |
666 i = atoi(argv[2]); | |
667 | |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
668 if (i < 1 || i > audacious_remote_get_playlist_length(dbus_proxy)) |
2313 | 669 { |
670 g_print("%s: invalid playlist position %d\n", argv[0], i); | |
671 return; | |
672 } | |
673 | |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
674 audacious_remote_set_playlist_pos(dbus_proxy, i - 1); |
2313 | 675 } |
676 | |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
677 void playlist_clear(gint argc, gchar **argv) |
2313 | 678 { |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
679 audacious_remote_playlist_clear(dbus_proxy); |
2313 | 680 } |
681 | |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
682 void playlist_repeat_status(gint argc, gchar **argv) |
2313 | 683 { |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
684 if (audacious_remote_is_repeat(dbus_proxy)) |
2313 | 685 { |
686 g_print("on\n"); | |
687 return; | |
688 } | |
689 else | |
690 { | |
691 g_print("off\n"); | |
692 return; | |
693 } | |
694 } | |
695 | |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
696 void playlist_repeat_toggle(gint argc, gchar **argv) |
2313 | 697 { |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
698 audacious_remote_toggle_repeat(dbus_proxy); |
2313 | 699 } |
700 | |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
701 void playlist_shuffle_status(gint argc, gchar **argv) |
2313 | 702 { |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
703 if (audacious_remote_is_shuffle(dbus_proxy)) |
2313 | 704 { |
705 g_print("on\n"); | |
706 return; | |
707 } | |
708 else | |
709 { | |
710 g_print("off\n"); | |
711 return; | |
712 } | |
713 } | |
714 | |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
715 void playlist_shuffle_toggle(gint argc, gchar **argv) |
2313 | 716 { |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
717 audacious_remote_toggle_shuffle(dbus_proxy); |
2313 | 718 } |
719 | |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
720 void playlist_tuple_field_data(gint argc, gchar **argv) |
2585
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
721 { |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
722 gint i; |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
723 gpointer data; |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
724 |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
725 if (argc < 4) |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
726 { |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
727 g_print("%s: invalid parameters for playlist-tuple-data.\n", argv[0]); |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
728 g_print("%s: syntax: %s playlist-tuple-data <fieldname> <position>\n", argv[0], argv[0]); |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
729 g_print("%s: - fieldname example choices: performer, album_name,\n", argv[0]); |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
730 g_print("%s: track_name, track_number, year, date, genre, comment,\n", argv[0]); |
2593
65073812a5cf
[svn] - custom field support for audacious_get_tuple_field_data()
nhjm449
parents:
2585
diff
changeset
|
731 g_print("%s: file_name, file_ext, file_path, length, formatter,\n", argv[0]); |
65073812a5cf
[svn] - custom field support for audacious_get_tuple_field_data()
nhjm449
parents:
2585
diff
changeset
|
732 g_print("%s: custom, mtime\n", argv[0]); |
2585
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
733 return; |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
734 } |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
735 |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
736 i = atoi(argv[3]); |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
737 |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
738 if (i < 1 || i > audacious_remote_get_playlist_length(dbus_proxy)) |
2585
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
739 { |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
740 g_print("%s: invalid playlist position %d\n", argv[0], i); |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
741 return; |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
742 } |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
743 |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
744 if (!(data = audacious_get_tuple_field_data(dbus_proxy, argv[2], i - 1))) |
2585
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
745 { |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
746 return; |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
747 } |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
748 |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
749 if (!strcasecmp(argv[2], "track_number") || !strcasecmp(argv[2], "year") || !strcasecmp(argv[2], "length") || !strcasecmp(argv[2], "mtime")) |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
750 { |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
751 if (*(gint *)data > 0) |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
752 { |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
753 g_print("%d\n", *(gint *)data); |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
754 } |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
755 return; |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
756 } |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
757 |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
758 g_print("%s\n", (gchar *)data); |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
759 } |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
760 |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
761 void playqueue_add(gint argc, gchar **argv) |
2313 | 762 { |
763 gint i; | |
764 | |
765 if (argc < 3) | |
766 { | |
767 g_print("%s: invalid parameters for playqueue-add.\n", argv[0]); | |
768 g_print("%s: syntax: %s playqueue-add <position>\n", argv[0], argv[0]); | |
769 return; | |
770 } | |
771 | |
772 i = atoi(argv[2]); | |
773 | |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
774 if (i < 1 || i > audacious_remote_get_playlist_length(dbus_proxy)) |
2313 | 775 { |
776 g_print("%s: invalid playlist position %d\n", argv[0], i); | |
777 return; | |
778 } | |
779 | |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
780 if (!(audacious_remote_playqueue_is_queued(dbus_proxy, i - 1))) |
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
781 audacious_remote_playqueue_add(dbus_proxy, i - 1); |
2313 | 782 } |
783 | |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
784 void playqueue_remove(gint argc, gchar **argv) |
2313 | 785 { |
786 gint i; | |
787 | |
788 if (argc < 3) | |
789 { | |
790 g_print("%s: invalid parameters for playqueue-remove.\n", argv[0]); | |
791 g_print("%s: syntax: %s playqueue-remove <position>\n", argv[0], argv[0]); | |
792 return; | |
793 } | |
794 | |
795 i = atoi(argv[2]); | |
796 | |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
797 if (i < 1 || i > audacious_remote_get_playlist_length(dbus_proxy)) |
2313 | 798 { |
799 g_print("%s: invalid playlist position %d\n", argv[0], i); | |
800 return; | |
801 } | |
802 | |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
803 if (audacious_remote_playqueue_is_queued(dbus_proxy, i - 1)) |
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
804 audacious_remote_playqueue_remove(dbus_proxy, i - 1); |
2313 | 805 } |
806 | |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
807 void playqueue_is_queued(gint argc, gchar **argv) |
2313 | 808 { |
809 gint i; | |
810 | |
811 if (argc < 3) | |
812 { | |
813 g_print("%s: invalid parameters for playqueue-is-queued.\n", argv[0]); | |
814 g_print("%s: syntax: %s playqueue-is-queued <position>\n", argv[0], argv[0]); | |
815 return; | |
816 } | |
817 | |
818 i = atoi(argv[2]); | |
819 | |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
820 if (i < 1 || i > audacious_remote_get_playlist_length(dbus_proxy)) |
2313 | 821 { |
822 g_print("%s: invalid playlist position %d\n", argv[0], i); | |
823 return; | |
824 } | |
825 | |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
826 exit(!(audacious_remote_playqueue_is_queued(dbus_proxy, i - 1))); |
2313 | 827 } |
828 | |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
829 void playqueue_get_position(gint argc, gchar **argv) |
2313 | 830 { |
831 gint i, pos; | |
832 | |
833 if (argc < 3) | |
834 { | |
835 g_print("%s: invalid parameters for playqueue-get-position.\n", argv[0]); | |
836 g_print("%s: syntax: %s playqueue-get-position <position>\n", argv[0], argv[0]); | |
837 return; | |
838 } | |
839 | |
840 i = atoi(argv[2]); | |
841 | |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
842 if (i < 1 || i > audacious_remote_get_playlist_length(dbus_proxy)) |
2313 | 843 { |
844 g_print("%s: invalid playlist position %d\n", argv[0], i); | |
845 return; | |
846 } | |
847 | |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
848 pos = audacious_remote_get_playqueue_position(dbus_proxy, i - 1) + 1; |
2313 | 849 |
850 if (pos < 1) | |
851 return; | |
852 | |
853 g_print("%d\n", pos); | |
854 } | |
855 | |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
856 void playqueue_get_qposition(gint argc, gchar **argv) |
2313 | 857 { |
858 gint i, pos; | |
859 | |
860 if (argc < 3) | |
861 { | |
862 g_print("%s: invalid parameters for playqueue-get-qposition.\n", argv[0]); | |
863 g_print("%s: syntax: %s playqueue-get-qposition <position>\n", argv[0], argv[0]); | |
864 return; | |
865 } | |
866 | |
867 i = atoi(argv[2]); | |
868 | |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
869 if (i < 1 || i > audacious_remote_get_playqueue_length(dbus_proxy)) |
2313 | 870 { |
871 g_print("%s: invalid playlist position %d\n", argv[0], i); | |
872 return; | |
873 } | |
874 | |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
875 pos = audacious_remote_get_playqueue_queue_position(dbus_proxy, i - 1) + 1; |
2313 | 876 |
877 if (pos < 1) | |
878 return; | |
879 | |
880 g_print("%d\n", pos); | |
881 } | |
882 | |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
883 void playqueue_display(gint argc, gchar **argv) |
2313 | 884 { |
885 gint i, ii, position, frames, length, total; | |
886 gchar *songname; | |
887 gchar *fmt = NULL, *p; | |
888 gint column; | |
889 | |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
890 i = audacious_remote_get_playqueue_length(dbus_proxy); |
2313 | 891 |
892 g_print("%d queued tracks.\n", i); | |
893 | |
894 total = 0; | |
895 | |
896 for (ii = 0; ii < i; ii++) | |
897 { | |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
898 position = audacious_remote_get_playqueue_queue_position(dbus_proxy, ii); |
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
899 songname = audacious_remote_get_playlist_title(dbus_proxy, position); |
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
900 frames = audacious_remote_get_playlist_time(dbus_proxy, position); |
2313 | 901 length = frames / 1000; |
902 total += length; | |
903 | |
904 /* adjust width for multi byte characters */ | |
905 column = 60; | |
906 if(songname) { | |
907 p = songname; | |
908 while(*p){ | |
909 gint stride; | |
910 stride = g_utf8_next_char(p) - p; | |
911 if(g_unichar_iswide(g_utf8_get_char(p)) | |
912 #if ( (GLIB_MAJOR_VERSION == 2) && (GLIB_MINOR_VERSION >= 12) ) | |
913 || g_unichar_iswide_cjk(g_utf8_get_char(p)) | |
914 #endif | |
915 ){ | |
916 column += (stride - 2); | |
917 } | |
918 else { | |
919 column += (stride - 1); | |
920 } | |
921 p = g_utf8_next_char(p); | |
922 } | |
923 } | |
924 | |
925 fmt = g_strdup_printf("%%4d | %%4d | %%-%ds | %%d:%%.2d\n", column); | |
926 g_print(fmt, ii + 1, position + 1, songname, length / 60, length % 60); | |
927 g_free(fmt); | |
928 } | |
929 | |
930 g_print("Total length: %d:%.2d\n", total / 60, total % 60); | |
931 } | |
932 | |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
933 void playqueue_length(gint argc, gchar **argv) |
2313 | 934 { |
935 gint i; | |
936 | |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
937 i = audacious_remote_get_playqueue_length(dbus_proxy); |
2313 | 938 |
939 g_print("%d\n", i); | |
940 } | |
941 | |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
942 void playqueue_clear(gint argc, gchar **argv) |
2313 | 943 { |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
944 audacious_remote_playqueue_clear(dbus_proxy); |
2313 | 945 } |
946 | |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
947 void get_volume(gint argc, gchar **argv) |
2313 | 948 { |
949 gint i; | |
950 | |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
951 i = audacious_remote_get_main_volume(dbus_proxy); |
2313 | 952 |
953 g_print("%d\n", i); | |
954 } | |
955 | |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
956 void set_volume(gint argc, gchar **argv) |
2313 | 957 { |
958 gint i, current_volume; | |
959 | |
960 if (argc < 3) | |
961 { | |
962 g_print("%s: invalid parameters for set-volume.\n", argv[0]); | |
963 g_print("%s: syntax: %s set-volume <level>\n", argv[0], argv[0]); | |
964 return; | |
965 } | |
966 | |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
967 current_volume = audacious_remote_get_main_volume(dbus_proxy); |
2313 | 968 switch (argv[2][0]) |
969 { | |
970 case '+': | |
971 case '-': | |
972 i = current_volume + atoi(argv[2]); | |
973 break; | |
974 default: | |
975 i = atoi(argv[2]); | |
976 break; | |
977 } | |
978 | |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
979 audacious_remote_set_main_volume(dbus_proxy, i); |
2313 | 980 } |
981 | |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
982 void mainwin_show(gint argc, gchar **argv) |
2313 | 983 { |
984 if (argc > 2) | |
985 { | |
986 if (!strncmp(argv[2],"on",2)) { | |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
987 audacious_remote_main_win_toggle(dbus_proxy, TRUE); |
2313 | 988 return; |
989 } | |
990 else if (!strncmp(argv[2],"off",3)) { | |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
991 audacious_remote_main_win_toggle(dbus_proxy, FALSE); |
2313 | 992 return; |
993 } | |
994 } | |
995 g_print("%s: invalid parameter for mainwin-show.\n",argv[0]); | |
996 g_print("%s: syntax: %s mainwin-show <on/off>\n",argv[0],argv[0]); | |
997 } | |
998 | |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
999 void playlist_show(gint argc, gchar **argv) |
2313 | 1000 { |
1001 if (argc > 2) | |
1002 { | |
1003 if (!strncmp(argv[2],"on",2)) { | |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
1004 audacious_remote_pl_win_toggle(dbus_proxy, TRUE); |
2313 | 1005 return; |
1006 } | |
1007 else if (!strncmp(argv[2],"off",3)) { | |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
1008 audacious_remote_pl_win_toggle(dbus_proxy, FALSE); |
2313 | 1009 return; |
1010 } | |
1011 } | |
1012 g_print("%s: invalid parameter for playlist-show.\n",argv[0]); | |
1013 g_print("%s: syntax: %s playlist-show <on/off>\n",argv[0],argv[0]); | |
1014 } | |
1015 | |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
1016 void equalizer_show(gint argc, gchar **argv) |
2313 | 1017 { |
1018 if (argc > 2) | |
1019 { | |
1020 if (!strncmp(argv[2],"on",2)) { | |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
1021 audacious_remote_eq_win_toggle(dbus_proxy, TRUE); |
2313 | 1022 return; |
1023 } | |
1024 else if (!strncmp(argv[2],"off",3)) { | |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
1025 audacious_remote_eq_win_toggle(dbus_proxy, FALSE); |
2313 | 1026 return; |
1027 } | |
1028 } | |
1029 g_print("%s: invalid parameter for equalizer-show.\n",argv[0]); | |
1030 g_print("%s: syntax: %s equalizer-show <on/off>\n",argv[0],argv[0]); | |
1031 } | |
1032 | |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
1033 void show_preferences_window(gint argc, gchar **argv) |
2313 | 1034 { |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
1035 audacious_remote_show_prefs_box(dbus_proxy); |
2313 | 1036 } |
1037 | |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
1038 void show_jtf_window(gint argc, gchar **argv) |
2313 | 1039 { |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
1040 audacious_remote_show_jtf_box(dbus_proxy); |
2313 | 1041 } |
1042 | |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
1043 void shutdown_audacious_server(gint argc, gchar **argv) |
2313 | 1044 { |
2731
f4a5f8fa3836
[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h.
magma
parents:
2723
diff
changeset
|
1045 audacious_remote_quit(dbus_proxy); |
2313 | 1046 } |
1047 | |
2723
5051af882447
[svn] - bind to the right dbus interfaces, but this still has problems building
nenolod
parents:
2720
diff
changeset
|
1048 void get_handlers_list(gint argc, gchar **argv) |
2313 | 1049 { |
1050 gint i; | |
1051 | |
1052 for (i = 0; handlers[i].name != NULL; i++) | |
1053 { | |
1054 if (!g_strcasecmp("<sep>", handlers[i].name)) | |
1055 g_print("%s%s:\n", i == 0 ? "" : "\n", handlers[i].desc); | |
1056 else | |
1057 g_print(" %-34s - %s\n", handlers[i].name, handlers[i].desc); | |
1058 } | |
1059 | |
1060 g_print("\nHandlers may be prefixed with `--' (GNU-style long-options) or not, your choice.\n"); | |
1061 g_print("Report bugs to http://bugs-meta.atheme.org/\n"); | |
1062 } |