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