annotate audtool/audtool.c @ 2004:1b4c0face93f trunk

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