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