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