Mercurial > audlegacy
annotate src/audtool/audtool.c @ 2720:b00c0f81efd4 trunk
[svn] - this needs work. lots of work.
author | nenolod |
---|---|
date | Wed, 09 May 2007 15:41:21 -0700 |
parents | 7a60a4236fb9 |
children | 5051af882447 |
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> | |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
23 #include "libaudclient/audctrl.h" |
2313 | 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 | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
98 DBusGProxy *audtool_connect(GError *error) |
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
99 { |
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
100 DBusGConnection *connection = dbus_g_bus_get(DBUS_BUS_SESSION, &error); |
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
101 |
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
102 if (connection == NULL) |
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
103 return NULL; |
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
104 |
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
105 return dbus_g_proxy_new_for_name(connection, |
2720 | 106 "org.atheme.audacious", "/org/atheme/audacious", |
107 "org.atheme.audacious"); | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
108 } |
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
109 |
2313 | 110 gint main(gint argc, gchar **argv) |
111 { | |
112 gint i; | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
113 DBusGProxy *session; |
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
114 GError *error = NULL; |
2313 | 115 |
116 setlocale(LC_CTYPE, ""); | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
117 g_type_init(); |
2313 | 118 |
119 if (argc < 2) | |
120 { | |
121 g_print("%s: usage: %s <command>\n", argv[0], argv[0]); | |
122 g_print("%s: use `%s help' to get a listing of available commands.\n", | |
123 argv[0], argv[0]); | |
124 exit(-2); | |
125 } | |
126 | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
127 if (!(session = audtool_connect(error)) && g_strcasecmp("help", argv[1]) |
2313 | 128 && g_strcasecmp("list-handlers", argv[1])) |
129 { | |
130 g_print("%s: audacious server is not running!\n", argv[0]); | |
131 exit(-1); | |
132 } | |
133 | |
134 for (i = 0; handlers[i].name != NULL; i++) | |
135 { | |
136 if ((!g_strcasecmp(handlers[i].name, argv[1]) || | |
137 !g_strcasecmp(g_strconcat("--", handlers[i].name, NULL), argv[1])) | |
138 && g_strcasecmp("<sep>", handlers[i].name)) | |
139 { | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
140 handlers[i].handler(session, argc, argv); |
2313 | 141 exit(0); |
142 } | |
143 } | |
144 | |
145 g_print("%s: invalid command '%s'\n", argv[0], argv[1]); | |
146 g_print("%s: use `%s help' to get a listing of available commands.\n", argv[0], argv[0]); | |
147 | |
148 return 0; | |
149 } | |
150 | |
151 /*** MOVE TO HANDLERS.C ***/ | |
152 | |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
153 void get_current_song(DBusGProxy *session, gint argc, gchar **argv) |
2313 | 154 { |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
155 #if 0 |
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
156 gint playpos = audacious_remote_get_playlist_pos(session); |
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
157 gchar *song = audacious_remote_get_playlist_title(session, playpos); |
2313 | 158 |
159 if (!song) | |
160 { | |
161 g_print("No song playing.\n"); | |
162 return; | |
163 } | |
164 | |
165 g_print("%s\n", song); | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
166 #endif |
2313 | 167 } |
168 | |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
169 void get_current_song_filename(DBusGProxy *session, gint argc, gchar **argv) |
2313 | 170 { |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
171 #if 0 |
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
172 gint playpos = audacious_remote_get_playlist_pos(session); |
2313 | 173 |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
174 g_print("%s\n", audacious_remote_get_playlist_file(session, playpos)); |
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
175 #endif |
2313 | 176 } |
177 | |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
178 void get_current_song_output_length(DBusGProxy *session, gint argc, gchar **argv) |
2313 | 179 { |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
180 #if 0 |
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
181 gint frames = audacious_remote_get_output_time(session); |
2313 | 182 gint length = frames / 1000; |
183 | |
184 g_print("%d:%.2d\n", length / 60, length % 60); | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
185 #endif |
2313 | 186 } |
187 | |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
188 void get_current_song_output_length_seconds(DBusGProxy *session, gint argc, gchar **argv) |
2313 | 189 { |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
190 #if 0 |
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
191 gint frames = audacious_remote_get_output_time(session); |
2313 | 192 gint length = frames / 1000; |
193 | |
194 g_print("%d\n", length); | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
195 #endif |
2313 | 196 } |
197 | |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
198 void get_current_song_output_length_frames(DBusGProxy *session, gint argc, gchar **argv) |
2313 | 199 { |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
200 #if 0 |
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
201 gint frames = audacious_remote_get_output_time(session); |
2313 | 202 |
203 g_print("%d\n", frames); | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
204 #endif |
2313 | 205 } |
206 | |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
207 void get_current_song_length(DBusGProxy *session, gint argc, gchar **argv) |
2313 | 208 { |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
209 #if 0 |
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
210 gint playpos = audacious_remote_get_playlist_pos(session); |
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
211 gint frames = audacious_remote_get_playlist_time(session, playpos); |
2313 | 212 gint length = frames / 1000; |
213 | |
214 g_print("%d:%.2d\n", length / 60, length % 60); | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
215 #endif |
2313 | 216 } |
217 | |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
218 void get_current_song_length_seconds(DBusGProxy *session, gint argc, gchar **argv) |
2313 | 219 { |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
220 #if 0 |
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
221 gint playpos = audacious_remote_get_playlist_pos(session); |
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
222 gint frames = audacious_remote_get_playlist_time(session, playpos); |
2313 | 223 gint length = frames / 1000; |
224 | |
225 g_print("%d\n", length); | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
226 #endif |
2313 | 227 } |
228 | |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
229 void get_current_song_length_frames(DBusGProxy *session, gint argc, gchar **argv) |
2313 | 230 { |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
231 #if 0 |
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
232 gint playpos = audacious_remote_get_playlist_pos(session); |
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
233 gint frames = audacious_remote_get_playlist_time(session, playpos); |
2313 | 234 |
235 g_print("%d\n", frames); | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
236 #endif |
2313 | 237 } |
238 | |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
239 void get_current_song_bitrate(DBusGProxy *session, gint argc, gchar **argv) |
2313 | 240 { |
241 gint rate, freq, nch; | |
242 | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
243 // audacious_remote_get_info(session, &rate, &freq, &nch); |
2313 | 244 |
245 g_print("%d\n", rate); | |
246 } | |
247 | |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
248 void get_current_song_bitrate_kbps(DBusGProxy *session, gint argc, gchar **argv) |
2313 | 249 { |
250 gint rate, freq, nch; | |
251 | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
252 // audacious_remote_get_info(session, &rate, &freq, &nch); |
2313 | 253 |
254 g_print("%d\n", rate / 1000); | |
255 } | |
256 | |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
257 void get_current_song_frequency(DBusGProxy *session, gint argc, gchar **argv) |
2313 | 258 { |
259 gint rate, freq, nch; | |
260 | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
261 // audacious_remote_get_info(session, &rate, &freq, &nch); |
2313 | 262 |
263 g_print("%d\n", freq); | |
264 } | |
265 | |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
266 void get_current_song_frequency_khz(DBusGProxy *session, gint argc, gchar **argv) |
2313 | 267 { |
268 gint rate, freq, nch; | |
269 | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
270 // audacious_remote_get_info(session, &rate, &freq, &nch); |
2313 | 271 |
272 g_print("%0.1f\n", (gfloat) freq / 1000); | |
273 } | |
274 | |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
275 void get_current_song_channels(DBusGProxy *session, gint argc, gchar **argv) |
2313 | 276 { |
277 gint rate, freq, nch; | |
278 | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
279 // audacious_remote_get_info(session, &rate, &freq, &nch); |
2313 | 280 |
281 g_print("%d\n", nch); | |
282 } | |
283 | |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
284 void get_current_song_tuple_field_data(DBusGProxy *session, 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 { |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
286 #if 0 |
2585
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
287 gpointer data; |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
288 |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
289 if (argc < 3) |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
290 { |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
291 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
|
292 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
|
293 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
|
294 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
|
295 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
|
296 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
|
297 return; |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
298 } |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
299 |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
300 if (!(data = audacious_get_tuple_field_data(session, argv[2], audacious_remote_get_playlist_pos(session)))) |
2585
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
301 { |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
302 return; |
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 |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
305 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
|
306 { |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
307 if (*(gint *)data > 0) |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
308 { |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
309 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
|
310 } |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
311 return; |
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 |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
314 g_print("%s\n", (gchar *)data); |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
315 #endif |
2585
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
316 } |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
317 |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
318 void playlist_reverse(DBusGProxy *session, gint argc, gchar **argv) |
2313 | 319 { |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
320 // audacious_remote_playlist_prev(session); |
2313 | 321 } |
322 | |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
323 void playlist_advance(DBusGProxy *session, gint argc, gchar **argv) |
2313 | 324 { |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
325 // audacious_remote_playlist_next(session); |
2313 | 326 } |
327 | |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
328 void playback_play(DBusGProxy *session, gint argc, gchar **argv) |
2313 | 329 { |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
330 audacious_remote_play(session); |
2313 | 331 } |
332 | |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
333 void playback_pause(DBusGProxy *session, gint argc, gchar **argv) |
2313 | 334 { |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
335 audacious_remote_pause(session); |
2313 | 336 } |
337 | |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
338 void playback_playpause(DBusGProxy *session, gint argc, gchar **argv) |
2313 | 339 { |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
340 if (audacious_remote_is_playing(session)) |
2313 | 341 { |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
342 audacious_remote_pause(session); |
2313 | 343 } |
344 else | |
345 { | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
346 audacious_remote_play(session); |
2313 | 347 } |
348 } | |
349 | |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
350 void playback_stop(DBusGProxy *session, gint argc, gchar **argv) |
2313 | 351 { |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
352 audacious_remote_stop(session); |
2313 | 353 } |
354 | |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
355 void playback_playing(DBusGProxy *session, gint argc, gchar **argv) |
2313 | 356 { |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
357 if (!audacious_remote_is_paused(session)) |
2313 | 358 { |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
359 exit(!audacious_remote_is_playing(session)); |
2313 | 360 } |
361 else | |
362 { | |
363 exit(1); | |
364 } | |
365 } | |
366 | |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
367 void playback_paused(DBusGProxy *session, gint argc, gchar **argv) |
2313 | 368 { |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
369 exit(!audacious_remote_is_paused(session)); |
2313 | 370 } |
371 | |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
372 void playback_stopped(DBusGProxy *session, gint argc, gchar **argv) |
2313 | 373 { |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
374 if (!audacious_remote_is_playing(session) && !audacious_remote_is_paused(session)) |
2313 | 375 { |
376 exit(0); | |
377 } | |
378 else | |
379 { | |
380 exit(1); | |
381 } | |
382 } | |
383 | |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
384 void playback_status(DBusGProxy *session, gint argc, gchar **argv) |
2313 | 385 { |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
386 if (audacious_remote_is_paused(session)) |
2313 | 387 { |
388 g_print("paused\n"); | |
389 return; | |
390 } | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
391 else if (audacious_remote_is_playing(session)) |
2313 | 392 { |
393 g_print("playing\n"); | |
394 return; | |
395 } | |
396 else | |
397 { | |
398 g_print("stopped\n"); | |
399 return; | |
400 } | |
401 } | |
402 | |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
403 void playback_seek(DBusGProxy *session, gint argc, gchar **argv) |
2313 | 404 { |
405 if (argc < 3) | |
406 { | |
407 g_print("%s: invalid parameters for playback-seek.\n", argv[0]); | |
408 g_print("%s: syntax: %s playback-seek <position>\n", argv[0], argv[0]); | |
409 return; | |
410 } | |
411 | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
412 audacious_remote_jump_to_time(session, atoi(argv[2]) * 1000); |
2313 | 413 } |
414 | |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
415 void playback_seek_relative(DBusGProxy *session, gint argc, gchar **argv) |
2313 | 416 { |
417 gint oldtime, newtime, diff; | |
418 | |
419 if (argc < 3) | |
420 { | |
421 g_print("%s: invalid parameters for playback-seek-relative.\n", argv[0]); | |
422 g_print("%s: syntax: %s playback-seek <position>\n", argv[0], argv[0]); | |
423 return; | |
424 } | |
425 | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
426 oldtime = audacious_remote_get_output_time(session); |
2313 | 427 diff = atoi(argv[2]) * 1000; |
428 newtime = oldtime + diff; | |
429 | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
430 audacious_remote_jump_to_time(session, newtime); |
2313 | 431 } |
432 | |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
433 void playlist_add_url_string(DBusGProxy *session, gint argc, gchar **argv) |
2313 | 434 { |
435 if (argc < 3) | |
436 { | |
437 g_print("%s: invalid parameters for playlist-addurl.\n", argv[0]); | |
438 g_print("%s: syntax: %s playlist-addurl <url>\n", argv[0], argv[0]); | |
439 return; | |
440 } | |
441 | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
442 audacious_remote_playlist_add_url_string(session, argv[2]); |
2313 | 443 } |
444 | |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
445 void playlist_delete(DBusGProxy *session, gint argc, gchar **argv) |
2313 | 446 { |
447 gint playpos; | |
448 | |
449 if (argc < 3) | |
450 { | |
451 g_print("%s: invalid parameters for playlist-delete.\n", argv[0]); | |
452 g_print("%s: syntax: %s playlist-delete <position>\n", argv[0], argv[0]); | |
453 return; | |
454 } | |
455 | |
456 playpos = atoi(argv[2]); | |
457 | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
458 if (playpos < 1 || playpos > audacious_remote_get_playlist_length(session)) |
2313 | 459 { |
460 g_print("%s: invalid playlist position %d\n", argv[0], playpos); | |
461 return; | |
462 } | |
463 | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
464 audacious_remote_playlist_delete(session, playpos - 1); |
2313 | 465 } |
466 | |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
467 void playlist_length(DBusGProxy *session, gint argc, gchar **argv) |
2313 | 468 { |
469 gint i; | |
470 | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
471 i = audacious_remote_get_playlist_length(session); |
2313 | 472 |
473 g_print("%d\n", i); | |
474 } | |
475 | |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
476 void playlist_song(DBusGProxy *session, gint argc, gchar **argv) |
2313 | 477 { |
478 gint playpos; | |
479 gchar *song; | |
480 | |
481 if (argc < 3) | |
482 { | |
483 g_print("%s: invalid parameters for playlist-song-title.\n", argv[0]); | |
484 g_print("%s: syntax: %s playlist-song-title <position>\n", argv[0], argv[0]); | |
485 return; | |
486 } | |
487 | |
488 playpos = atoi(argv[2]); | |
489 | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
490 if (playpos < 1 || playpos > audacious_remote_get_playlist_length(session)) |
2313 | 491 { |
492 g_print("%s: invalid playlist position %d\n", argv[0], playpos); | |
493 return; | |
494 } | |
495 | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
496 // song = audacious_remote_get_playlist_title(session, playpos - 1); |
2313 | 497 |
498 g_print("%s\n", song); | |
499 } | |
500 | |
501 | |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
502 void playlist_song_length(DBusGProxy *session, gint argc, gchar **argv) |
2313 | 503 { |
504 gint playpos, frames, length; | |
505 | |
506 if (argc < 3) | |
507 { | |
508 g_print("%s: invalid parameters for playlist-song-length.\n", argv[0]); | |
509 g_print("%s: syntax: %s playlist-song-length <position>\n", argv[0], argv[0]); | |
510 return; | |
511 } | |
512 | |
513 playpos = atoi(argv[2]); | |
514 | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
515 if (playpos < 1 || playpos > audacious_remote_get_playlist_length(session)) |
2313 | 516 { |
517 g_print("%s: invalid playlist position %d\n", argv[0], playpos); | |
518 return; | |
519 } | |
520 | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
521 // frames = audacious_remote_get_playlist_time(session, playpos - 1); |
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
522 // length = frames / 1000; |
2313 | 523 |
524 g_print("%d:%.2d\n", length / 60, length % 60); | |
525 } | |
526 | |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
527 void playlist_song_length_seconds(DBusGProxy *session, gint argc, gchar **argv) |
2313 | 528 { |
529 gint playpos, frames, length; | |
530 | |
531 if (argc < 3) | |
532 { | |
533 g_print("%s: invalid parameters for playlist-song-length-seconds.\n", argv[0]); | |
534 g_print("%s: syntax: %s playlist-song-length-seconds <position>\n", argv[0], argv[0]); | |
535 return; | |
536 } | |
537 | |
538 playpos = atoi(argv[2]); | |
539 | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
540 if (playpos < 1 || playpos > audacious_remote_get_playlist_length(session)) |
2313 | 541 { |
542 g_print("%s: invalid playlist position %d\n", argv[0], playpos); | |
543 return; | |
544 } | |
545 | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
546 // frames = audacious_remote_get_playlist_time(session, playpos - 1); |
2313 | 547 length = frames / 1000; |
548 | |
549 g_print("%d\n", length); | |
550 } | |
551 | |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
552 void playlist_song_length_frames(DBusGProxy *session, gint argc, gchar **argv) |
2313 | 553 { |
554 gint playpos, frames; | |
555 | |
556 if (argc < 3) | |
557 { | |
558 g_print("%s: invalid parameters for playlist-song-length-frames.\n", argv[0]); | |
559 g_print("%s: syntax: %s playlist-song-length-frames <position>\n", argv[0], argv[0]); | |
560 return; | |
561 } | |
562 | |
563 playpos = atoi(argv[2]); | |
564 | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
565 if (playpos < 1 || playpos > audacious_remote_get_playlist_length(session)) |
2313 | 566 { |
567 g_print("%s: invalid playlist position %d\n", argv[0], playpos); | |
568 return; | |
569 } | |
570 | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
571 // frames = audacious_remote_get_playlist_time(session, playpos - 1); |
2313 | 572 |
573 g_print("%d\n", frames); | |
574 } | |
575 | |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
576 void playlist_display(DBusGProxy *session, gint argc, gchar **argv) |
2313 | 577 { |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
578 #if 0 |
2313 | 579 gint i, ii, frames, length, total; |
580 gchar *songname; | |
581 gchar *fmt = NULL, *p; | |
582 gint column; | |
583 | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
584 i = audacious_remote_get_playlist_length(session); |
2313 | 585 |
586 g_print("%d tracks.\n", i); | |
587 | |
588 total = 0; | |
589 | |
590 for (ii = 0; ii < i; ii++) | |
591 { | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
592 songname = audacious_remote_get_playlist_title(session, ii); |
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
593 frames = audacious_remote_get_playlist_time(session, ii); |
2313 | 594 length = frames / 1000; |
595 total += length; | |
596 | |
597 /* adjust width for multi byte characters */ | |
598 column = 60; | |
599 if(songname){ | |
600 p = songname; | |
601 while(*p){ | |
602 gint stride; | |
603 stride = g_utf8_next_char(p) - p; | |
604 if(g_unichar_iswide(g_utf8_get_char(p)) | |
605 #if ( (GLIB_MAJOR_VERSION == 2) && (GLIB_MINOR_VERSION >= 12) ) | |
606 || g_unichar_iswide_cjk(g_utf8_get_char(p)) | |
607 #endif | |
608 ){ | |
609 column += (stride - 2); | |
610 } | |
611 else { | |
612 column += (stride - 1); | |
613 } | |
614 p = g_utf8_next_char(p); | |
615 } | |
616 | |
617 } | |
618 | |
619 fmt = g_strdup_printf("%%4d | %%-%ds | %%d:%%.2d\n", column); | |
620 g_print(fmt, ii + 1, songname, length / 60, length % 60); | |
621 g_free(fmt); | |
622 } | |
623 | |
624 g_print("Total length: %d:%.2d\n", total / 60, total % 60); | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
625 #endif |
2313 | 626 } |
627 | |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
628 void playlist_position(DBusGProxy *session, gint argc, gchar **argv) |
2313 | 629 { |
630 gint i; | |
631 | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
632 i = audacious_remote_get_playlist_pos(session); |
2313 | 633 |
634 g_print("%d\n", i + 1); | |
635 } | |
636 | |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
637 void playlist_song_filename(DBusGProxy *session, gint argc, gchar **argv) |
2313 | 638 { |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
639 #if 0 |
2313 | 640 gint i; |
641 | |
642 if (argc < 3) | |
643 { | |
644 g_print("%s: invalid parameters for playlist-filename.\n", argv[0]); | |
645 g_print("%s: syntax: %s playlist-filename <position>\n", argv[0], argv[0]); | |
646 return; | |
647 } | |
648 | |
649 i = atoi(argv[2]); | |
650 | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
651 if (i < 1 || i > audacious_remote_get_playlist_length(session)) |
2313 | 652 { |
653 g_print("%s: invalid playlist position %d\n", argv[0], i); | |
654 return; | |
655 } | |
656 | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
657 g_print("%s\n", audacious_remote_get_playlist_file(session, i - 1)); |
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
658 #endif |
2313 | 659 } |
660 | |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
661 void playlist_jump(DBusGProxy *session, gint argc, gchar **argv) |
2313 | 662 { |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
663 #if 0 |
2313 | 664 gint i; |
665 | |
666 if (argc < 3) | |
667 { | |
668 g_print("%s: invalid parameters for playlist-jump.\n", argv[0]); | |
669 g_print("%s: syntax: %s playlist-jump <position>\n", argv[0], argv[0]); | |
670 return; | |
671 } | |
672 | |
673 i = atoi(argv[2]); | |
674 | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
675 if (i < 1 || i > audacious_remote_get_playlist_length(session)) |
2313 | 676 { |
677 g_print("%s: invalid playlist position %d\n", argv[0], i); | |
678 return; | |
679 } | |
680 | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
681 audacious_remote_set_playlist_pos(session, i - 1); |
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
682 #endif |
2313 | 683 } |
684 | |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
685 void playlist_clear(DBusGProxy *session, gint argc, gchar **argv) |
2313 | 686 { |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
687 // audacious_remote_playlist_clear(session); |
2313 | 688 } |
689 | |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
690 void playlist_repeat_status(DBusGProxy *session, gint argc, gchar **argv) |
2313 | 691 { |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
692 #if 0 |
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
693 if (audacious_remote_is_repeat(session)) |
2313 | 694 { |
695 g_print("on\n"); | |
696 return; | |
697 } | |
698 else | |
699 { | |
700 g_print("off\n"); | |
701 return; | |
702 } | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
703 #endif |
2313 | 704 } |
705 | |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
706 void playlist_repeat_toggle(DBusGProxy *session, gint argc, gchar **argv) |
2313 | 707 { |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
708 // audacious_remote_toggle_repeat(session); |
2313 | 709 } |
710 | |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
711 void playlist_shuffle_status(DBusGProxy *session, gint argc, gchar **argv) |
2313 | 712 { |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
713 #if 0 |
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
714 if (audacious_remote_is_shuffle(session)) |
2313 | 715 { |
716 g_print("on\n"); | |
717 return; | |
718 } | |
719 else | |
720 { | |
721 g_print("off\n"); | |
722 return; | |
723 } | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
724 #endif |
2313 | 725 } |
726 | |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
727 void playlist_shuffle_toggle(DBusGProxy *session, gint argc, gchar **argv) |
2313 | 728 { |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
729 // audacious_remote_toggle_shuffle(session); |
2313 | 730 } |
731 | |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
732 void playlist_tuple_field_data(DBusGProxy *session, gint argc, gchar **argv) |
2585
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
733 { |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
734 #if 0 |
2585
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
735 gint i; |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
736 gpointer data; |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
737 |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
738 if (argc < 4) |
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 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
|
741 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
|
742 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
|
743 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
|
744 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
|
745 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
|
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 i = atoi(argv[3]); |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
750 |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
751 if (i < 1 || i > audacious_remote_get_playlist_length(session)) |
2585
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("%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
|
754 return; |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
755 } |
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 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
|
758 { |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
759 return; |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
760 } |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
761 |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
762 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
|
763 { |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
764 if (*(gint *)data > 0) |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
765 { |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
766 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
|
767 } |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
768 return; |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
769 } |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
770 |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
771 g_print("%s\n", (gchar *)data); |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
772 #endif |
2585
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
773 } |
c2b49ba4be45
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
nhjm449
parents:
2327
diff
changeset
|
774 |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
775 void playqueue_add(DBusGProxy *session, gint argc, gchar **argv) |
2313 | 776 { |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
777 #if 0 |
2313 | 778 gint i; |
779 | |
780 if (argc < 3) | |
781 { | |
782 g_print("%s: invalid parameters for playqueue-add.\n", argv[0]); | |
783 g_print("%s: syntax: %s playqueue-add <position>\n", argv[0], argv[0]); | |
784 return; | |
785 } | |
786 | |
787 i = atoi(argv[2]); | |
788 | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
789 if (i < 1 || i > audacious_remote_get_playlist_length(session)) |
2313 | 790 { |
791 g_print("%s: invalid playlist position %d\n", argv[0], i); | |
792 return; | |
793 } | |
794 | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
795 if (!(audacious_remote_playqueue_is_queued(session, i - 1))) |
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
796 audacious_remote_playqueue_add(session, i - 1); |
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
797 #endif |
2313 | 798 } |
799 | |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
800 void playqueue_remove(DBusGProxy *session, gint argc, gchar **argv) |
2313 | 801 { |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
802 #if 0 |
2313 | 803 gint i; |
804 | |
805 if (argc < 3) | |
806 { | |
807 g_print("%s: invalid parameters for playqueue-remove.\n", argv[0]); | |
808 g_print("%s: syntax: %s playqueue-remove <position>\n", argv[0], argv[0]); | |
809 return; | |
810 } | |
811 | |
812 i = atoi(argv[2]); | |
813 | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
814 if (i < 1 || i > audacious_remote_get_playlist_length(session)) |
2313 | 815 { |
816 g_print("%s: invalid playlist position %d\n", argv[0], i); | |
817 return; | |
818 } | |
819 | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
820 if (audacious_remote_playqueue_is_queued(session, i - 1)) |
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
821 audacious_remote_playqueue_remove(session, i - 1); |
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
822 #endif |
2313 | 823 } |
824 | |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
825 void playqueue_is_queued(DBusGProxy *session, gint argc, gchar **argv) |
2313 | 826 { |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
827 #if 0 |
2313 | 828 gint i; |
829 | |
830 if (argc < 3) | |
831 { | |
832 g_print("%s: invalid parameters for playqueue-is-queued.\n", argv[0]); | |
833 g_print("%s: syntax: %s playqueue-is-queued <position>\n", argv[0], argv[0]); | |
834 return; | |
835 } | |
836 | |
837 i = atoi(argv[2]); | |
838 | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
839 if (i < 1 || i > audacious_remote_get_playlist_length(session)) |
2313 | 840 { |
841 g_print("%s: invalid playlist position %d\n", argv[0], i); | |
842 return; | |
843 } | |
844 | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
845 exit(!(audacious_remote_playqueue_is_queued(session, i - 1))); |
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
846 #endif |
2313 | 847 } |
848 | |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
849 void playqueue_get_position(DBusGProxy *session, gint argc, gchar **argv) |
2313 | 850 { |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
851 #if 0 |
2313 | 852 gint i, pos; |
853 | |
854 if (argc < 3) | |
855 { | |
856 g_print("%s: invalid parameters for playqueue-get-position.\n", argv[0]); | |
857 g_print("%s: syntax: %s playqueue-get-position <position>\n", argv[0], argv[0]); | |
858 return; | |
859 } | |
860 | |
861 i = atoi(argv[2]); | |
862 | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
863 if (i < 1 || i > audacious_remote_get_playlist_length(session)) |
2313 | 864 { |
865 g_print("%s: invalid playlist position %d\n", argv[0], i); | |
866 return; | |
867 } | |
868 | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
869 pos = audacious_remote_get_playqueue_position(session, i - 1) + 1; |
2313 | 870 |
871 if (pos < 1) | |
872 return; | |
873 | |
874 g_print("%d\n", pos); | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
875 #endif |
2313 | 876 } |
877 | |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
878 void playqueue_get_qposition(DBusGProxy *session, gint argc, gchar **argv) |
2313 | 879 { |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
880 #if 0 |
2313 | 881 gint i, pos; |
882 | |
883 if (argc < 3) | |
884 { | |
885 g_print("%s: invalid parameters for playqueue-get-qposition.\n", argv[0]); | |
886 g_print("%s: syntax: %s playqueue-get-qposition <position>\n", argv[0], argv[0]); | |
887 return; | |
888 } | |
889 | |
890 i = atoi(argv[2]); | |
891 | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
892 if (i < 1 || i > audacious_remote_get_playqueue_length(session)) |
2313 | 893 { |
894 g_print("%s: invalid playlist position %d\n", argv[0], i); | |
895 return; | |
896 } | |
897 | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
898 pos = audacious_remote_get_playqueue_queue_position(session, i - 1) + 1; |
2313 | 899 |
900 if (pos < 1) | |
901 return; | |
902 | |
903 g_print("%d\n", pos); | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
904 #endif |
2313 | 905 } |
906 | |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
907 void playqueue_display(DBusGProxy *session, gint argc, gchar **argv) |
2313 | 908 { |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
909 #if 0 |
2313 | 910 gint i, ii, position, frames, length, total; |
911 gchar *songname; | |
912 gchar *fmt = NULL, *p; | |
913 gint column; | |
914 | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
915 i = audacious_remote_get_playqueue_length(session); |
2313 | 916 |
917 g_print("%d queued tracks.\n", i); | |
918 | |
919 total = 0; | |
920 | |
921 for (ii = 0; ii < i; ii++) | |
922 { | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
923 position = audacious_remote_get_playqueue_queue_position(session, ii); |
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
924 songname = audacious_remote_get_playlist_title(session, position); |
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
925 frames = audacious_remote_get_playlist_time(session, position); |
2313 | 926 length = frames / 1000; |
927 total += length; | |
928 | |
929 /* adjust width for multi byte characters */ | |
930 column = 60; | |
931 if(songname) { | |
932 p = songname; | |
933 while(*p){ | |
934 gint stride; | |
935 stride = g_utf8_next_char(p) - p; | |
936 if(g_unichar_iswide(g_utf8_get_char(p)) | |
937 #if ( (GLIB_MAJOR_VERSION == 2) && (GLIB_MINOR_VERSION >= 12) ) | |
938 || g_unichar_iswide_cjk(g_utf8_get_char(p)) | |
939 #endif | |
940 ){ | |
941 column += (stride - 2); | |
942 } | |
943 else { | |
944 column += (stride - 1); | |
945 } | |
946 p = g_utf8_next_char(p); | |
947 } | |
948 } | |
949 | |
950 fmt = g_strdup_printf("%%4d | %%4d | %%-%ds | %%d:%%.2d\n", column); | |
951 g_print(fmt, ii + 1, position + 1, songname, length / 60, length % 60); | |
952 g_free(fmt); | |
953 } | |
954 | |
955 g_print("Total length: %d:%.2d\n", total / 60, total % 60); | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
956 #endif |
2313 | 957 } |
958 | |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
959 void playqueue_length(DBusGProxy *session, gint argc, gchar **argv) |
2313 | 960 { |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
961 #if 0 |
2313 | 962 gint i; |
963 | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
964 i = audacious_remote_get_playqueue_length(session); |
2313 | 965 |
966 g_print("%d\n", i); | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
967 #endif |
2313 | 968 } |
969 | |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
970 void playqueue_clear(DBusGProxy *session, gint argc, gchar **argv) |
2313 | 971 { |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
972 // audacious_remote_playqueue_clear(session); |
2313 | 973 } |
974 | |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
975 void get_volume(DBusGProxy *session, gint argc, gchar **argv) |
2313 | 976 { |
977 gint i; | |
978 | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
979 i = audacious_remote_get_main_volume(session); |
2313 | 980 |
981 g_print("%d\n", i); | |
982 } | |
983 | |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
984 void set_volume(DBusGProxy *session, gint argc, gchar **argv) |
2313 | 985 { |
986 gint i, current_volume; | |
987 | |
988 if (argc < 3) | |
989 { | |
990 g_print("%s: invalid parameters for set-volume.\n", argv[0]); | |
991 g_print("%s: syntax: %s set-volume <level>\n", argv[0], argv[0]); | |
992 return; | |
993 } | |
994 | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
995 current_volume = audacious_remote_get_main_volume(session); |
2313 | 996 switch (argv[2][0]) |
997 { | |
998 case '+': | |
999 case '-': | |
1000 i = current_volume + atoi(argv[2]); | |
1001 break; | |
1002 default: | |
1003 i = atoi(argv[2]); | |
1004 break; | |
1005 } | |
1006 | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
1007 audacious_remote_set_main_volume(session, i); |
2313 | 1008 } |
1009 | |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
1010 void mainwin_show(DBusGProxy *session, gint argc, gchar **argv) |
2313 | 1011 { |
1012 if (argc > 2) | |
1013 { | |
1014 if (!strncmp(argv[2],"on",2)) { | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
1015 // audacious_remote_main_win_toggle(session, TRUE); |
2313 | 1016 return; |
1017 } | |
1018 else if (!strncmp(argv[2],"off",3)) { | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
1019 // audacious_remote_main_win_toggle(session, FALSE); |
2313 | 1020 return; |
1021 } | |
1022 } | |
1023 g_print("%s: invalid parameter for mainwin-show.\n",argv[0]); | |
1024 g_print("%s: syntax: %s mainwin-show <on/off>\n",argv[0],argv[0]); | |
1025 } | |
1026 | |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
1027 void playlist_show(DBusGProxy *session, gint argc, gchar **argv) |
2313 | 1028 { |
1029 if (argc > 2) | |
1030 { | |
1031 if (!strncmp(argv[2],"on",2)) { | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
1032 // audacious_remote_pl_win_toggle(session, TRUE); |
2313 | 1033 return; |
1034 } | |
1035 else if (!strncmp(argv[2],"off",3)) { | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
1036 // audacious_remote_pl_win_toggle(session, FALSE); |
2313 | 1037 return; |
1038 } | |
1039 } | |
1040 g_print("%s: invalid parameter for playlist-show.\n",argv[0]); | |
1041 g_print("%s: syntax: %s playlist-show <on/off>\n",argv[0],argv[0]); | |
1042 } | |
1043 | |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
1044 void equalizer_show(DBusGProxy *session, gint argc, gchar **argv) |
2313 | 1045 { |
1046 if (argc > 2) | |
1047 { | |
1048 if (!strncmp(argv[2],"on",2)) { | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
1049 // audacious_remote_eq_win_toggle(session, TRUE); |
2313 | 1050 return; |
1051 } | |
1052 else if (!strncmp(argv[2],"off",3)) { | |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
1053 // audacious_remote_eq_win_toggle(session, FALSE); |
2313 | 1054 return; |
1055 } | |
1056 } | |
1057 g_print("%s: invalid parameter for equalizer-show.\n",argv[0]); | |
1058 g_print("%s: syntax: %s equalizer-show <on/off>\n",argv[0],argv[0]); | |
1059 } | |
1060 | |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
1061 void show_preferences_window(DBusGProxy *session, gint argc, gchar **argv) |
2313 | 1062 { |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
1063 // audacious_remote_show_prefs_box(session); |
2313 | 1064 } |
1065 | |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
1066 void show_jtf_window(DBusGProxy *session, gint argc, gchar **argv) |
2313 | 1067 { |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
1068 // audacious_remote_show_jtf_box(session); |
2313 | 1069 } |
1070 | |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
1071 void shutdown_audacious_server(DBusGProxy *session, gint argc, gchar **argv) |
2313 | 1072 { |
2719
7a60a4236fb9
[svn] - make this build again, most functionality does not work
nenolod
parents:
2715
diff
changeset
|
1073 // audacious_remote_quit(session); |
2313 | 1074 } |
1075 | |
2715
a20d843fe3f7
[svn] - some progress towards making audtool build again
nenolod
parents:
2593
diff
changeset
|
1076 void get_handlers_list(DBusGProxy *session, gint argc, gchar **argv) |
2313 | 1077 { |
1078 gint i; | |
1079 | |
1080 for (i = 0; handlers[i].name != NULL; i++) | |
1081 { | |
1082 if (!g_strcasecmp("<sep>", handlers[i].name)) | |
1083 g_print("%s%s:\n", i == 0 ? "" : "\n", handlers[i].desc); | |
1084 else | |
1085 g_print(" %-34s - %s\n", handlers[i].name, handlers[i].desc); | |
1086 } | |
1087 | |
1088 g_print("\nHandlers may be prefixed with `--' (GNU-style long-options) or not, your choice.\n"); | |
1089 g_print("Report bugs to http://bugs-meta.atheme.org/\n"); | |
1090 } |