Mercurial > audlegacy
annotate src/audtool/audtool.c @ 2585:c2b49ba4be45 trunk
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
author | nhjm449 |
---|---|
date | Mon, 26 Feb 2007 19:06:45 -0800 |
parents | 921b2d8d9b2e |
children | 65073812a5cf |
rev | line source |
---|---|
2313 | 1 /* Audtool -- Audacious scripting tool |
2 * Copyright (c) 2005-2007 Audacious development team | |
3 * | |
4 * This program is free software; you can redistribute it and/or modify | |
5 * it under the terms of the GNU General Public License as published by | |
6 * the Free Software Foundation; either version 2 of the License, or | |
7 * (at your option) any later version. | |
8 * | |
9 * This program is distributed in the hope that it will be useful, | |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 * GNU General Public License for more details. | |
13 * | |
14 * You should have received a copy of the GNU General Public License | |
15 * along with this program; if not, write to the Free Software | |
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 */ | |
18 | |
19 #include <stdlib.h> | |
2327
921b2d8d9b2e
[svn] Fixed: audtool.c:883: warning: implicit declaration of function 'strncmp'
js
parents:
2313
diff
changeset
|
20 #include <string.h> |
2313 | 21 #include <glib.h> |
22 #include <locale.h> | |
23 #include "libaudacious/beepctrl.h" | |
24 #include "audtool.h" | |
25 | |
26 struct commandhandler handlers[] = { | |
27 {"<sep>", NULL, "Vital information"}, | |
28 {"current-song", get_current_song, "returns current song title"}, | |
29 {"current-song-filename", get_current_song_filename, "returns current song filename"}, | |
30 {"current-song-length", get_current_song_length, "returns current song length"}, | |
31 {"current-song-length-seconds", get_current_song_length_seconds, "returns current song length in seconds"}, | |
32 {"current-song-length-frames", get_current_song_length_frames, "returns current song length in frames"}, | |
33 {"current-song-output-length", get_current_song_output_length, "returns current song output length"}, | |
34 {"current-song-output-length-seconds", get_current_song_output_length_seconds, "returns current song output length in seconds"}, | |
35 {"current-song-output-length-frames", get_current_song_output_length_frames, "returns current song output length in frames"}, | |
36 {"current-song-bitrate", get_current_song_bitrate, "returns current song bitrate in bits per second"}, | |
37 {"current-song-bitrate-kbps", get_current_song_bitrate_kbps, "returns current song bitrate in kilobits per second"}, | |
38 {"current-song-frequency", get_current_song_frequency, "returns current song frequency in hertz"}, | |
39 {"current-song-frequency-khz", get_current_song_frequency_khz, "returns current song frequency in kilohertz"}, | |
40 {"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
|
41 {"current-song-tuple-data", get_current_song_tuple_field_data, "returns the value of a tuple field for the current song"}, |
2313 | 42 {"<sep>", NULL, "Playlist manipulation"}, |
43 {"playlist-advance", playlist_advance, "go to the next song in the playlist"}, | |
44 {"playlist-reverse", playlist_reverse, "go to the previous song in the playlist"}, | |
45 {"playlist-addurl", playlist_add_url_string, "adds a url to the playlist"}, | |
46 {"playlist-delete", playlist_delete, "deletes a song from the playlist"}, | |
47 {"playlist-length", playlist_length, "returns the total length of the playlist"}, | |
48 {"playlist-song", playlist_song, "returns the title of a song in the playlist"}, | |
49 {"playlist-song-filename", playlist_song_filename, "returns the filename of a song in the playlist"}, | |
50 {"playlist-song-length", playlist_song_length, "returns the length of a song in the playlist"}, | |
51 {"playlist-song-length-seconds", playlist_song_length_seconds, "returns the length of a song in the playlist in seconds"}, | |
52 {"playlist-song-length-frames", playlist_song_length_frames, "returns the length of a song in the playlist in frames"}, | |
53 {"playlist-display", playlist_display, "returns the entire playlist"}, | |
54 {"playlist-position", playlist_position, "returns the position in the playlist"}, | |
55 {"playlist-jump", playlist_jump, "jumps to a position in the playlist"}, | |
56 {"playlist-clear", playlist_clear, "clears the playlist"}, | |
57 {"playlist-repeat-status", playlist_repeat_status, "returns the status of playlist repeat"}, | |
58 {"playlist-repeat-toggle", playlist_repeat_toggle, "toggles playlist repeat"}, | |
59 {"playlist-shuffle-status", playlist_shuffle_status, "returns the status of playlist shuffle"}, | |
60 {"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
|
61 {"playlist-tuple-data", playlist_tuple_field_data, "returns the value of a tuple field for a song in the playlist"}, |
2313 | 62 {"<sep>", NULL, "Playqueue manipulation"}, |
63 {"playqueue-add", playqueue_add, "adds a song to the playqueue"}, | |
64 {"playqueue-remove", playqueue_remove, "removes a song from the playqueue"}, | |
65 {"playqueue-is-queued", playqueue_is_queued, "returns OK if a song is queued"}, | |
66 {"playqueue-get-position", playqueue_get_position, "returns the queue position of a song in the playlist"}, | |
67 {"playqueue-get-qposition", playqueue_get_qposition, "returns the playlist position of a song in the queue"}, | |
68 {"playqueue-length", playqueue_length, "returns the length of the playqueue"}, | |
69 {"playqueue-display", playqueue_display, "returns a list of currently-queued songs"}, | |
70 {"playqueue-clear", playqueue_clear, "clears the playqueue"}, | |
71 {"<sep>", NULL, "Playback manipulation"}, | |
72 {"playback-play", playback_play, "starts/unpauses song playback"}, | |
73 {"playback-pause", playback_pause, "(un)pauses song playback"}, | |
74 {"playback-playpause", playback_playpause, "plays/(un)pauses song playback"}, | |
75 {"playback-stop", playback_stop, "stops song playback"}, | |
76 {"playback-playing", playback_playing, "returns OK if audacious is playing"}, | |
77 {"playback-paused", playback_paused, "returns OK if audacious is paused"}, | |
78 {"playback-stopped", playback_stopped, "returns OK if audacious is stopped"}, | |
79 {"playback-status", playback_status, "returns the playback status"}, | |
80 {"playback-seek", playback_seek, "performs an absolute seek"}, | |
81 {"playback-seek-relative", playback_seek_relative, "performs a seek relative to the current position"}, | |
82 {"<sep>", NULL, "Volume control"}, | |
83 {"get-volume", get_volume, "returns the current volume level in percent"}, | |
84 {"set-volume", set_volume, "sets the current volume level in percent"}, | |
85 {"<sep>", NULL, "Miscellaneous"}, | |
86 {"mainwin-show", mainwin_show, "shows/hides the main window"}, | |
87 {"playlist-show", playlist_show, "shows/hides the playlist window"}, | |
88 {"equalizer-show", equalizer_show, "shows/hides the equalizer window"}, | |
89 {"preferences", show_preferences_window, "shows/hides the preferences window"}, | |
90 {"jumptofile", show_jtf_window, "shows the jump to file window"}, | |
91 {"shutdown", shutdown_audacious_server, "shuts down audacious"}, | |
92 {"<sep>", NULL, "Help system"}, | |
93 {"list-handlers", get_handlers_list, "shows handlers list"}, | |
94 {"help", get_handlers_list, "shows handlers list"}, | |
95 {NULL, NULL, NULL} | |
96 }; | |
97 | |
98 gint main(gint argc, gchar **argv) | |
99 { | |
100 gint i; | |
101 gchar *remote_uri; | |
102 | |
103 setlocale(LC_CTYPE, ""); | |
104 | |
105 if (argc < 2) | |
106 { | |
107 g_print("%s: usage: %s <command>\n", argv[0], argv[0]); | |
108 g_print("%s: use `%s help' to get a listing of available commands.\n", | |
109 argv[0], argv[0]); | |
110 exit(-2); | |
111 } | |
112 | |
113 remote_uri = getenv("AUDTOOL_REMOTE_URI"); | |
114 audacious_set_session_uri(remote_uri); | |
115 | |
116 if (!xmms_remote_is_running(0) && g_strcasecmp("help", argv[1]) | |
117 && g_strcasecmp("list-handlers", argv[1])) | |
118 { | |
119 g_print("%s: audacious server is not running!\n", argv[0]); | |
120 exit(-1); | |
121 } | |
122 | |
123 for (i = 0; handlers[i].name != NULL; i++) | |
124 { | |
125 if ((!g_strcasecmp(handlers[i].name, argv[1]) || | |
126 !g_strcasecmp(g_strconcat("--", handlers[i].name, NULL), argv[1])) | |
127 && g_strcasecmp("<sep>", handlers[i].name)) | |
128 { | |
129 handlers[i].handler(0, argc, argv); | |
130 exit(0); | |
131 } | |
132 } | |
133 | |
134 g_print("%s: invalid command '%s'\n", argv[0], argv[1]); | |
135 g_print("%s: use `%s help' to get a listing of available commands.\n", argv[0], argv[0]); | |
136 | |
137 return 0; | |
138 } | |
139 | |
140 /*** MOVE TO HANDLERS.C ***/ | |
141 | |
142 void get_current_song(gint session, gint argc, gchar **argv) | |
143 { | |
144 gint playpos = xmms_remote_get_playlist_pos(session); | |
145 gchar *song = xmms_remote_get_playlist_title(session, playpos); | |
146 | |
147 if (!song) | |
148 { | |
149 g_print("No song playing.\n"); | |
150 return; | |
151 } | |
152 | |
153 g_print("%s\n", song); | |
154 } | |
155 | |
156 void get_current_song_filename(gint session, gint argc, gchar **argv) | |
157 { | |
158 gint playpos = xmms_remote_get_playlist_pos(session); | |
159 | |
160 g_print("%s\n", xmms_remote_get_playlist_file(session, playpos)); | |
161 } | |
162 | |
163 void get_current_song_output_length(gint session, gint argc, gchar **argv) | |
164 { | |
165 gint frames = xmms_remote_get_output_time(session); | |
166 gint length = frames / 1000; | |
167 | |
168 g_print("%d:%.2d\n", length / 60, length % 60); | |
169 } | |
170 | |
171 void get_current_song_output_length_seconds(gint session, gint argc, gchar **argv) | |
172 { | |
173 gint frames = xmms_remote_get_output_time(session); | |
174 gint length = frames / 1000; | |
175 | |
176 g_print("%d\n", length); | |
177 } | |
178 | |
179 void get_current_song_output_length_frames(gint session, gint argc, gchar **argv) | |
180 { | |
181 gint frames = xmms_remote_get_output_time(session); | |
182 | |
183 g_print("%d\n", frames); | |
184 } | |
185 | |
186 void get_current_song_length(gint session, gint argc, gchar **argv) | |
187 { | |
188 gint playpos = xmms_remote_get_playlist_pos(session); | |
189 gint frames = xmms_remote_get_playlist_time(session, playpos); | |
190 gint length = frames / 1000; | |
191 | |
192 g_print("%d:%.2d\n", length / 60, length % 60); | |
193 } | |
194 | |
195 void get_current_song_length_seconds(gint session, gint argc, gchar **argv) | |
196 { | |
197 gint playpos = xmms_remote_get_playlist_pos(session); | |
198 gint frames = xmms_remote_get_playlist_time(session, playpos); | |
199 gint length = frames / 1000; | |
200 | |
201 g_print("%d\n", length); | |
202 } | |
203 | |
204 void get_current_song_length_frames(gint session, gint argc, gchar **argv) | |
205 { | |
206 gint playpos = xmms_remote_get_playlist_pos(session); | |
207 gint frames = xmms_remote_get_playlist_time(session, playpos); | |
208 | |
209 g_print("%d\n", frames); | |
210 } | |
211 | |
212 void get_current_song_bitrate(gint session, gint argc, gchar **argv) | |
213 { | |
214 gint rate, freq, nch; | |
215 | |
216 xmms_remote_get_info(session, &rate, &freq, &nch); | |
217 | |
218 g_print("%d\n", rate); | |
219 } | |
220 | |
221 void get_current_song_bitrate_kbps(gint session, gint argc, gchar **argv) | |
222 { | |
223 gint rate, freq, nch; | |
224 | |
225 xmms_remote_get_info(session, &rate, &freq, &nch); | |
226 | |
227 g_print("%d\n", rate / 1000); | |
228 } | |
229 | |
230 void get_current_song_frequency(gint session, gint argc, gchar **argv) | |
231 { | |
232 gint rate, freq, nch; | |
233 | |
234 xmms_remote_get_info(session, &rate, &freq, &nch); | |
235 | |
236 g_print("%d\n", freq); | |
237 } | |
238 | |
239 void get_current_song_frequency_khz(gint session, gint argc, gchar **argv) | |
240 { | |
241 gint rate, freq, nch; | |
242 | |
243 xmms_remote_get_info(session, &rate, &freq, &nch); | |
244 | |
245 g_print("%0.1f\n", (gfloat) freq / 1000); | |
246 } | |
247 | |
248 void get_current_song_channels(gint session, gint argc, gchar **argv) | |
249 { | |
250 gint rate, freq, nch; | |
251 | |
252 xmms_remote_get_info(session, &rate, &freq, &nch); | |
253 | |
254 g_print("%d\n", nch); | |
255 } | |
256 | |
2585
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
257 |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
258 void get_current_song_tuple_field_data(gint session, gint argc, gchar **argv) |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
259 { |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
260 gpointer data; |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
261 |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
262 if (argc < 3) |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
263 { |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
264 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
|
265 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
|
266 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
|
267 g_print("%s: track_name, track_number, year, date, genre, comment,\n", argv[0]); |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
268 g_print("%s: file_name, file_ext, file_path, length, formatter, mtime\n", argv[0]); |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
269 return; |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
270 } |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
271 |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
272 if (!(data = audacious_get_tuple_field_data(session, argv[2], xmms_remote_get_playlist_pos(session)))) |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
273 { |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
274 return; |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
275 } |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
276 |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
277 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
|
278 { |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
279 if (*(gint *)data > 0) |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
280 { |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
281 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
|
282 } |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
283 return; |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
284 } |
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 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
|
287 } |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
288 |
2313 | 289 void playlist_reverse(gint session, gint argc, gchar **argv) |
290 { | |
291 xmms_remote_playlist_prev(session); | |
292 } | |
293 | |
294 void playlist_advance(gint session, gint argc, gchar **argv) | |
295 { | |
296 xmms_remote_playlist_next(session); | |
297 } | |
298 | |
299 void playback_play(gint session, gint argc, gchar **argv) | |
300 { | |
301 xmms_remote_play(session); | |
302 } | |
303 | |
304 void playback_pause(gint session, gint argc, gchar **argv) | |
305 { | |
306 xmms_remote_pause(session); | |
307 } | |
308 | |
309 void playback_playpause(gint session, gint argc, gchar **argv) | |
310 { | |
311 if (xmms_remote_is_playing(session)) | |
312 { | |
313 xmms_remote_pause(session); | |
314 } | |
315 else | |
316 { | |
317 xmms_remote_play(session); | |
318 } | |
319 } | |
320 | |
321 void playback_stop(gint session, gint argc, gchar **argv) | |
322 { | |
323 xmms_remote_stop(session); | |
324 } | |
325 | |
326 void playback_playing(gint session, gint argc, gchar **argv) | |
327 { | |
328 if (!xmms_remote_is_paused(session)) | |
329 { | |
330 exit(!xmms_remote_is_playing(session)); | |
331 } | |
332 else | |
333 { | |
334 exit(1); | |
335 } | |
336 } | |
337 | |
338 void playback_paused(gint session, gint argc, gchar **argv) | |
339 { | |
340 exit(!xmms_remote_is_paused(session)); | |
341 } | |
342 | |
343 void playback_stopped(gint session, gint argc, gchar **argv) | |
344 { | |
345 if (!xmms_remote_is_playing(session) && !xmms_remote_is_paused(session)) | |
346 { | |
347 exit(0); | |
348 } | |
349 else | |
350 { | |
351 exit(1); | |
352 } | |
353 } | |
354 | |
355 void playback_status(gint session, gint argc, gchar **argv) | |
356 { | |
357 if (xmms_remote_is_paused(session)) | |
358 { | |
359 g_print("paused\n"); | |
360 return; | |
361 } | |
362 else if (xmms_remote_is_playing(session)) | |
363 { | |
364 g_print("playing\n"); | |
365 return; | |
366 } | |
367 else | |
368 { | |
369 g_print("stopped\n"); | |
370 return; | |
371 } | |
372 } | |
373 | |
374 void playback_seek(gint session, gint argc, gchar **argv) | |
375 { | |
376 if (argc < 3) | |
377 { | |
378 g_print("%s: invalid parameters for playback-seek.\n", argv[0]); | |
379 g_print("%s: syntax: %s playback-seek <position>\n", argv[0], argv[0]); | |
380 return; | |
381 } | |
382 | |
383 xmms_remote_jump_to_time(session, atoi(argv[2]) * 1000); | |
384 } | |
385 | |
386 void playback_seek_relative(gint session, gint argc, gchar **argv) | |
387 { | |
388 gint oldtime, newtime, diff; | |
389 | |
390 if (argc < 3) | |
391 { | |
392 g_print("%s: invalid parameters for playback-seek-relative.\n", argv[0]); | |
393 g_print("%s: syntax: %s playback-seek <position>\n", argv[0], argv[0]); | |
394 return; | |
395 } | |
396 | |
397 oldtime = xmms_remote_get_output_time(session); | |
398 diff = atoi(argv[2]) * 1000; | |
399 newtime = oldtime + diff; | |
400 | |
401 xmms_remote_jump_to_time(session, newtime); | |
402 } | |
403 | |
404 void playlist_add_url_string(gint session, gint argc, gchar **argv) | |
405 { | |
406 if (argc < 3) | |
407 { | |
408 g_print("%s: invalid parameters for playlist-addurl.\n", argv[0]); | |
409 g_print("%s: syntax: %s playlist-addurl <url>\n", argv[0], argv[0]); | |
410 return; | |
411 } | |
412 | |
413 xmms_remote_playlist_add_url_string(session, argv[2]); | |
414 } | |
415 | |
416 void playlist_delete(gint session, gint argc, gchar **argv) | |
417 { | |
418 gint playpos; | |
419 | |
420 if (argc < 3) | |
421 { | |
422 g_print("%s: invalid parameters for playlist-delete.\n", argv[0]); | |
423 g_print("%s: syntax: %s playlist-delete <position>\n", argv[0], argv[0]); | |
424 return; | |
425 } | |
426 | |
427 playpos = atoi(argv[2]); | |
428 | |
429 if (playpos < 1 || playpos > xmms_remote_get_playlist_length(session)) | |
430 { | |
431 g_print("%s: invalid playlist position %d\n", argv[0], playpos); | |
432 return; | |
433 } | |
434 | |
435 xmms_remote_playlist_delete(session, playpos - 1); | |
436 } | |
437 | |
438 void playlist_length(gint session, gint argc, gchar **argv) | |
439 { | |
440 gint i; | |
441 | |
442 i = xmms_remote_get_playlist_length(session); | |
443 | |
444 g_print("%d\n", i); | |
445 } | |
446 | |
447 void playlist_song(gint session, gint argc, gchar **argv) | |
448 { | |
449 gint playpos; | |
450 gchar *song; | |
451 | |
452 if (argc < 3) | |
453 { | |
454 g_print("%s: invalid parameters for playlist-song-title.\n", argv[0]); | |
455 g_print("%s: syntax: %s playlist-song-title <position>\n", argv[0], argv[0]); | |
456 return; | |
457 } | |
458 | |
459 playpos = atoi(argv[2]); | |
460 | |
461 if (playpos < 1 || playpos > xmms_remote_get_playlist_length(session)) | |
462 { | |
463 g_print("%s: invalid playlist position %d\n", argv[0], playpos); | |
464 return; | |
465 } | |
466 | |
467 song = xmms_remote_get_playlist_title(session, playpos - 1); | |
468 | |
469 g_print("%s\n", song); | |
470 } | |
471 | |
472 | |
473 void playlist_song_length(gint session, gint argc, gchar **argv) | |
474 { | |
475 gint playpos, frames, length; | |
476 | |
477 if (argc < 3) | |
478 { | |
479 g_print("%s: invalid parameters for playlist-song-length.\n", argv[0]); | |
480 g_print("%s: syntax: %s playlist-song-length <position>\n", argv[0], argv[0]); | |
481 return; | |
482 } | |
483 | |
484 playpos = atoi(argv[2]); | |
485 | |
486 if (playpos < 1 || playpos > xmms_remote_get_playlist_length(session)) | |
487 { | |
488 g_print("%s: invalid playlist position %d\n", argv[0], playpos); | |
489 return; | |
490 } | |
491 | |
492 frames = xmms_remote_get_playlist_time(session, playpos - 1); | |
493 length = frames / 1000; | |
494 | |
495 g_print("%d:%.2d\n", length / 60, length % 60); | |
496 } | |
497 | |
498 void playlist_song_length_seconds(gint session, gint argc, gchar **argv) | |
499 { | |
500 gint playpos, frames, length; | |
501 | |
502 if (argc < 3) | |
503 { | |
504 g_print("%s: invalid parameters for playlist-song-length-seconds.\n", argv[0]); | |
505 g_print("%s: syntax: %s playlist-song-length-seconds <position>\n", argv[0], argv[0]); | |
506 return; | |
507 } | |
508 | |
509 playpos = atoi(argv[2]); | |
510 | |
511 if (playpos < 1 || playpos > xmms_remote_get_playlist_length(session)) | |
512 { | |
513 g_print("%s: invalid playlist position %d\n", argv[0], playpos); | |
514 return; | |
515 } | |
516 | |
517 frames = xmms_remote_get_playlist_time(session, playpos - 1); | |
518 length = frames / 1000; | |
519 | |
520 g_print("%d\n", length); | |
521 } | |
522 | |
523 void playlist_song_length_frames(gint session, gint argc, gchar **argv) | |
524 { | |
525 gint playpos, frames; | |
526 | |
527 if (argc < 3) | |
528 { | |
529 g_print("%s: invalid parameters for playlist-song-length-frames.\n", argv[0]); | |
530 g_print("%s: syntax: %s playlist-song-length-frames <position>\n", argv[0], argv[0]); | |
531 return; | |
532 } | |
533 | |
534 playpos = atoi(argv[2]); | |
535 | |
536 if (playpos < 1 || playpos > xmms_remote_get_playlist_length(session)) | |
537 { | |
538 g_print("%s: invalid playlist position %d\n", argv[0], playpos); | |
539 return; | |
540 } | |
541 | |
542 frames = xmms_remote_get_playlist_time(session, playpos - 1); | |
543 | |
544 g_print("%d\n", frames); | |
545 } | |
546 | |
547 void playlist_display(gint session, gint argc, gchar **argv) | |
548 { | |
549 gint i, ii, frames, length, total; | |
550 gchar *songname; | |
551 gchar *fmt = NULL, *p; | |
552 gint column; | |
553 | |
554 i = xmms_remote_get_playlist_length(session); | |
555 | |
556 g_print("%d tracks.\n", i); | |
557 | |
558 total = 0; | |
559 | |
560 for (ii = 0; ii < i; ii++) | |
561 { | |
562 songname = xmms_remote_get_playlist_title(session, ii); | |
563 frames = xmms_remote_get_playlist_time(session, ii); | |
564 length = frames / 1000; | |
565 total += length; | |
566 | |
567 /* adjust width for multi byte characters */ | |
568 column = 60; | |
569 if(songname){ | |
570 p = songname; | |
571 while(*p){ | |
572 gint stride; | |
573 stride = g_utf8_next_char(p) - p; | |
574 if(g_unichar_iswide(g_utf8_get_char(p)) | |
575 #if ( (GLIB_MAJOR_VERSION == 2) && (GLIB_MINOR_VERSION >= 12) ) | |
576 || g_unichar_iswide_cjk(g_utf8_get_char(p)) | |
577 #endif | |
578 ){ | |
579 column += (stride - 2); | |
580 } | |
581 else { | |
582 column += (stride - 1); | |
583 } | |
584 p = g_utf8_next_char(p); | |
585 } | |
586 | |
587 } | |
588 | |
589 fmt = g_strdup_printf("%%4d | %%-%ds | %%d:%%.2d\n", column); | |
590 g_print(fmt, ii + 1, songname, length / 60, length % 60); | |
591 g_free(fmt); | |
592 } | |
593 | |
594 g_print("Total length: %d:%.2d\n", total / 60, total % 60); | |
595 } | |
596 | |
597 void playlist_position(gint session, gint argc, gchar **argv) | |
598 { | |
599 gint i; | |
600 | |
601 i = xmms_remote_get_playlist_pos(session); | |
602 | |
603 g_print("%d\n", i + 1); | |
604 } | |
605 | |
606 void playlist_song_filename(gint session, gint argc, gchar **argv) | |
607 { | |
608 gint i; | |
609 | |
610 if (argc < 3) | |
611 { | |
612 g_print("%s: invalid parameters for playlist-filename.\n", argv[0]); | |
613 g_print("%s: syntax: %s playlist-filename <position>\n", argv[0], argv[0]); | |
614 return; | |
615 } | |
616 | |
617 i = atoi(argv[2]); | |
618 | |
619 if (i < 1 || i > xmms_remote_get_playlist_length(session)) | |
620 { | |
621 g_print("%s: invalid playlist position %d\n", argv[0], i); | |
622 return; | |
623 } | |
624 | |
625 g_print("%s\n", xmms_remote_get_playlist_file(session, i - 1)); | |
626 } | |
627 | |
628 void playlist_jump(gint session, gint argc, gchar **argv) | |
629 { | |
630 gint i; | |
631 | |
632 if (argc < 3) | |
633 { | |
634 g_print("%s: invalid parameters for playlist-jump.\n", argv[0]); | |
635 g_print("%s: syntax: %s playlist-jump <position>\n", argv[0], argv[0]); | |
636 return; | |
637 } | |
638 | |
639 i = atoi(argv[2]); | |
640 | |
641 if (i < 1 || i > xmms_remote_get_playlist_length(session)) | |
642 { | |
643 g_print("%s: invalid playlist position %d\n", argv[0], i); | |
644 return; | |
645 } | |
646 | |
647 xmms_remote_set_playlist_pos(session, i - 1); | |
648 } | |
649 | |
650 void playlist_clear(gint session, gint argc, gchar **argv) | |
651 { | |
652 xmms_remote_playlist_clear(session); | |
653 } | |
654 | |
655 void playlist_repeat_status(gint session, gint argc, gchar **argv) | |
656 { | |
657 if (xmms_remote_is_repeat(session)) | |
658 { | |
659 g_print("on\n"); | |
660 return; | |
661 } | |
662 else | |
663 { | |
664 g_print("off\n"); | |
665 return; | |
666 } | |
667 } | |
668 | |
669 void playlist_repeat_toggle(gint session, gint argc, gchar **argv) | |
670 { | |
671 xmms_remote_toggle_repeat(session); | |
672 } | |
673 | |
674 void playlist_shuffle_status(gint session, gint argc, gchar **argv) | |
675 { | |
676 if (xmms_remote_is_shuffle(session)) | |
677 { | |
678 g_print("on\n"); | |
679 return; | |
680 } | |
681 else | |
682 { | |
683 g_print("off\n"); | |
684 return; | |
685 } | |
686 } | |
687 | |
688 void playlist_shuffle_toggle(gint session, gint argc, gchar **argv) | |
689 { | |
690 xmms_remote_toggle_shuffle(session); | |
691 } | |
692 | |
2585
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
693 void playlist_tuple_field_data(gint session, gint argc, gchar **argv) |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
694 { |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
695 gint i; |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
696 gpointer data; |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
697 |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
698 if (argc < 4) |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
699 { |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
700 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
|
701 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
|
702 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
|
703 g_print("%s: track_name, track_number, year, date, genre, comment,\n", argv[0]); |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
704 g_print("%s: file_name, file_ext, file_path, length, formatter, mtime\n", argv[0]); |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
705 return; |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
706 } |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
707 |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
708 i = atoi(argv[3]); |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
709 |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
710 if (i < 1 || i > xmms_remote_get_playlist_length(session)) |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
711 { |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
712 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
|
713 return; |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
714 } |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
715 |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
716 if (!(data = audacious_get_tuple_field_data(session, argv[2], i - 1))) |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
717 { |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
718 return; |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
719 } |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
720 |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
721 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
|
722 { |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
723 if (*(gint *)data > 0) |
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 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
|
726 } |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
727 return; |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
728 } |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
729 |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
730 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
|
731 } |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
732 |
2313 | 733 void playqueue_add(gint session, gint argc, gchar **argv) |
734 { | |
735 gint i; | |
736 | |
737 if (argc < 3) | |
738 { | |
739 g_print("%s: invalid parameters for playqueue-add.\n", argv[0]); | |
740 g_print("%s: syntax: %s playqueue-add <position>\n", argv[0], argv[0]); | |
741 return; | |
742 } | |
743 | |
744 i = atoi(argv[2]); | |
745 | |
746 if (i < 1 || i > xmms_remote_get_playlist_length(session)) | |
747 { | |
748 g_print("%s: invalid playlist position %d\n", argv[0], i); | |
749 return; | |
750 } | |
751 | |
752 if (!(xmms_remote_playqueue_is_queued(session, i - 1))) | |
753 xmms_remote_playqueue_add(session, i - 1); | |
754 } | |
755 | |
756 void playqueue_remove(gint session, gint argc, gchar **argv) | |
757 { | |
758 gint i; | |
759 | |
760 if (argc < 3) | |
761 { | |
762 g_print("%s: invalid parameters for playqueue-remove.\n", argv[0]); | |
763 g_print("%s: syntax: %s playqueue-remove <position>\n", argv[0], argv[0]); | |
764 return; | |
765 } | |
766 | |
767 i = atoi(argv[2]); | |
768 | |
769 if (i < 1 || i > xmms_remote_get_playlist_length(session)) | |
770 { | |
771 g_print("%s: invalid playlist position %d\n", argv[0], i); | |
772 return; | |
773 } | |
774 | |
775 if (xmms_remote_playqueue_is_queued(session, i - 1)) | |
776 xmms_remote_playqueue_remove(session, i - 1); | |
777 } | |
778 | |
779 void playqueue_is_queued(gint session, gint argc, gchar **argv) | |
780 { | |
781 gint i; | |
782 | |
783 if (argc < 3) | |
784 { | |
785 g_print("%s: invalid parameters for playqueue-is-queued.\n", argv[0]); | |
786 g_print("%s: syntax: %s playqueue-is-queued <position>\n", argv[0], argv[0]); | |
787 return; | |
788 } | |
789 | |
790 i = atoi(argv[2]); | |
791 | |
792 if (i < 1 || i > xmms_remote_get_playlist_length(session)) | |
793 { | |
794 g_print("%s: invalid playlist position %d\n", argv[0], i); | |
795 return; | |
796 } | |
797 | |
798 exit(!(xmms_remote_playqueue_is_queued(session, i - 1))); | |
799 } | |
800 | |
801 void playqueue_get_position(gint session, gint argc, gchar **argv) | |
802 { | |
803 gint i, pos; | |
804 | |
805 if (argc < 3) | |
806 { | |
807 g_print("%s: invalid parameters for playqueue-get-position.\n", argv[0]); | |
808 g_print("%s: syntax: %s playqueue-get-position <position>\n", argv[0], argv[0]); | |
809 return; | |
810 } | |
811 | |
812 i = atoi(argv[2]); | |
813 | |
814 if (i < 1 || i > xmms_remote_get_playlist_length(session)) | |
815 { | |
816 g_print("%s: invalid playlist position %d\n", argv[0], i); | |
817 return; | |
818 } | |
819 | |
820 pos = xmms_remote_get_playqueue_position(session, i - 1) + 1; | |
821 | |
822 if (pos < 1) | |
823 return; | |
824 | |
825 g_print("%d\n", pos); | |
826 } | |
827 | |
828 void playqueue_get_qposition(gint session, gint argc, gchar **argv) | |
829 { | |
830 gint i, pos; | |
831 | |
832 if (argc < 3) | |
833 { | |
834 g_print("%s: invalid parameters for playqueue-get-qposition.\n", argv[0]); | |
835 g_print("%s: syntax: %s playqueue-get-qposition <position>\n", argv[0], argv[0]); | |
836 return; | |
837 } | |
838 | |
839 i = atoi(argv[2]); | |
840 | |
841 if (i < 1 || i > xmms_remote_get_playqueue_length(session)) | |
842 { | |
843 g_print("%s: invalid playlist position %d\n", argv[0], i); | |
844 return; | |
845 } | |
846 | |
847 pos = xmms_remote_get_playqueue_queue_position(session, i - 1) + 1; | |
848 | |
849 if (pos < 1) | |
850 return; | |
851 | |
852 g_print("%d\n", pos); | |
853 } | |
854 | |
855 void playqueue_display(gint session, gint argc, gchar **argv) | |
856 { | |
857 gint i, ii, position, frames, length, total; | |
858 gchar *songname; | |
859 gchar *fmt = NULL, *p; | |
860 gint column; | |
861 | |
862 i = xmms_remote_get_playqueue_length(session); | |
863 | |
864 g_print("%d queued tracks.\n", i); | |
865 | |
866 total = 0; | |
867 | |
868 for (ii = 0; ii < i; ii++) | |
869 { | |
870 position = xmms_remote_get_playqueue_queue_position(session, ii); | |
871 songname = xmms_remote_get_playlist_title(session, position); | |
872 frames = xmms_remote_get_playlist_time(session, position); | |
873 length = frames / 1000; | |
874 total += length; | |
875 | |
876 /* adjust width for multi byte characters */ | |
877 column = 60; | |
878 if(songname) { | |
879 p = songname; | |
880 while(*p){ | |
881 gint stride; | |
882 stride = g_utf8_next_char(p) - p; | |
883 if(g_unichar_iswide(g_utf8_get_char(p)) | |
884 #if ( (GLIB_MAJOR_VERSION == 2) && (GLIB_MINOR_VERSION >= 12) ) | |
885 || g_unichar_iswide_cjk(g_utf8_get_char(p)) | |
886 #endif | |
887 ){ | |
888 column += (stride - 2); | |
889 } | |
890 else { | |
891 column += (stride - 1); | |
892 } | |
893 p = g_utf8_next_char(p); | |
894 } | |
895 } | |
896 | |
897 fmt = g_strdup_printf("%%4d | %%4d | %%-%ds | %%d:%%.2d\n", column); | |
898 g_print(fmt, ii + 1, position + 1, songname, length / 60, length % 60); | |
899 g_free(fmt); | |
900 } | |
901 | |
902 g_print("Total length: %d:%.2d\n", total / 60, total % 60); | |
903 } | |
904 | |
905 void playqueue_length(gint session, gint argc, gchar **argv) | |
906 { | |
907 gint i; | |
908 | |
909 i = xmms_remote_get_playqueue_length(session); | |
910 | |
911 g_print("%d\n", i); | |
912 } | |
913 | |
914 void playqueue_clear(gint session, gint argc, gchar **argv) | |
915 { | |
916 xmms_remote_playqueue_clear(session); | |
917 } | |
918 | |
919 void get_volume(gint session, gint argc, gchar **argv) | |
920 { | |
921 gint i; | |
922 | |
923 i = xmms_remote_get_main_volume(session); | |
924 | |
925 g_print("%d\n", i); | |
926 } | |
927 | |
928 void set_volume(gint session, gint argc, gchar **argv) | |
929 { | |
930 gint i, current_volume; | |
931 | |
932 if (argc < 3) | |
933 { | |
934 g_print("%s: invalid parameters for set-volume.\n", argv[0]); | |
935 g_print("%s: syntax: %s set-volume <level>\n", argv[0], argv[0]); | |
936 return; | |
937 } | |
938 | |
939 current_volume = xmms_remote_get_main_volume(session); | |
940 switch (argv[2][0]) | |
941 { | |
942 case '+': | |
943 case '-': | |
944 i = current_volume + atoi(argv[2]); | |
945 break; | |
946 default: | |
947 i = atoi(argv[2]); | |
948 break; | |
949 } | |
950 | |
951 xmms_remote_set_main_volume(session, i); | |
952 } | |
953 | |
954 void mainwin_show(gint session, gint argc, gchar **argv) | |
955 { | |
956 if (argc > 2) | |
957 { | |
958 if (!strncmp(argv[2],"on",2)) { | |
959 xmms_remote_main_win_toggle(session, TRUE); | |
960 return; | |
961 } | |
962 else if (!strncmp(argv[2],"off",3)) { | |
963 xmms_remote_main_win_toggle(session, FALSE); | |
964 return; | |
965 } | |
966 } | |
967 g_print("%s: invalid parameter for mainwin-show.\n",argv[0]); | |
968 g_print("%s: syntax: %s mainwin-show <on/off>\n",argv[0],argv[0]); | |
969 } | |
970 | |
971 void playlist_show(gint session, gint argc, gchar **argv) | |
972 { | |
973 if (argc > 2) | |
974 { | |
975 if (!strncmp(argv[2],"on",2)) { | |
976 xmms_remote_pl_win_toggle(session, TRUE); | |
977 return; | |
978 } | |
979 else if (!strncmp(argv[2],"off",3)) { | |
980 xmms_remote_pl_win_toggle(session, FALSE); | |
981 return; | |
982 } | |
983 } | |
984 g_print("%s: invalid parameter for playlist-show.\n",argv[0]); | |
985 g_print("%s: syntax: %s playlist-show <on/off>\n",argv[0],argv[0]); | |
986 } | |
987 | |
988 void equalizer_show(gint session, gint argc, gchar **argv) | |
989 { | |
990 if (argc > 2) | |
991 { | |
992 if (!strncmp(argv[2],"on",2)) { | |
993 xmms_remote_eq_win_toggle(session, TRUE); | |
994 return; | |
995 } | |
996 else if (!strncmp(argv[2],"off",3)) { | |
997 xmms_remote_eq_win_toggle(session, FALSE); | |
998 return; | |
999 } | |
1000 } | |
1001 g_print("%s: invalid parameter for equalizer-show.\n",argv[0]); | |
1002 g_print("%s: syntax: %s equalizer-show <on/off>\n",argv[0],argv[0]); | |
1003 } | |
1004 | |
1005 void show_preferences_window(gint session, gint argc, gchar **argv) | |
1006 { | |
1007 xmms_remote_show_prefs_box(session); | |
1008 } | |
1009 | |
1010 void show_jtf_window(gint session, gint argc, gchar **argv) | |
1011 { | |
1012 xmms_remote_show_jtf_box(session); | |
1013 } | |
1014 | |
1015 void shutdown_audacious_server(gint session, gint argc, gchar **argv) | |
1016 { | |
1017 xmms_remote_quit(session); | |
1018 } | |
1019 | |
1020 void get_handlers_list(gint session, gint argc, gchar **argv) | |
1021 { | |
1022 gint i; | |
1023 | |
1024 for (i = 0; handlers[i].name != NULL; i++) | |
1025 { | |
1026 if (!g_strcasecmp("<sep>", handlers[i].name)) | |
1027 g_print("%s%s:\n", i == 0 ? "" : "\n", handlers[i].desc); | |
1028 else | |
1029 g_print(" %-34s - %s\n", handlers[i].name, handlers[i].desc); | |
1030 } | |
1031 | |
1032 g_print("\nHandlers may be prefixed with `--' (GNU-style long-options) or not, your choice.\n"); | |
1033 g_print("Report bugs to http://bugs-meta.atheme.org/\n"); | |
1034 } |