annotate audtool/audtool.c @ 2203:60bd49189fde trunk

[svn] - two realcolour modes for voiceprint vis: Fire and Ice - removed duplicate code from vis.c
author marvin
date Fri, 22 Dec 2006 20:10:22 -0800
parents 6bfa0777a57a
children ef1316b48550
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
2137
6bfa0777a57a [svn] Fixed a bug where xmms_remote_jump_to_time was called with seconds instead of milliseconds.
jerome
parents: 2055
diff changeset
359 oldtime = xmms_remote_get_output_time(session);
6bfa0777a57a [svn] Fixed a bug where xmms_remote_jump_to_time was called with seconds instead of milliseconds.
jerome
parents: 2055
diff changeset
360 diff = atoi(argv[2]) * 1000;
1932
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 {
2055
8feb3d69b5be [svn] - cleanups from oliver@freebsd.org
nenolod
parents: 1953
diff changeset
380 gint playpos;
8feb3d69b5be [svn] - cleanups from oliver@freebsd.org
nenolod
parents: 1953
diff changeset
381
1365
97000f8de201 [svn] - Added playlist-delete command.
nhjm449
parents: 1319
diff changeset
382 if (argc < 3)
97000f8de201 [svn] - Added playlist-delete command.
nhjm449
parents: 1319
diff changeset
383 {
97000f8de201 [svn] - Added playlist-delete command.
nhjm449
parents: 1319
diff changeset
384 g_print("%s: invalid parameters for playlist-delete.\n", argv[0]);
97000f8de201 [svn] - Added playlist-delete command.
nhjm449
parents: 1319
diff changeset
385 g_print("%s: syntax: %s playlist-delete <position>\n", argv[0], argv[0]);
97000f8de201 [svn] - Added playlist-delete command.
nhjm449
parents: 1319
diff changeset
386 return;
97000f8de201 [svn] - Added playlist-delete command.
nhjm449
parents: 1319
diff changeset
387 }
97000f8de201 [svn] - Added playlist-delete command.
nhjm449
parents: 1319
diff changeset
388
2055
8feb3d69b5be [svn] - cleanups from oliver@freebsd.org
nenolod
parents: 1953
diff changeset
389 playpos = atoi(argv[2]);
1365
97000f8de201 [svn] - Added playlist-delete command.
nhjm449
parents: 1319
diff changeset
390
97000f8de201 [svn] - Added playlist-delete command.
nhjm449
parents: 1319
diff changeset
391 if (playpos < 1 || playpos > xmms_remote_get_playlist_length(session))
97000f8de201 [svn] - Added playlist-delete command.
nhjm449
parents: 1319
diff changeset
392 {
97000f8de201 [svn] - Added playlist-delete command.
nhjm449
parents: 1319
diff changeset
393 g_print("%s: invalid playlist position %d\n", argv[0], playpos);
97000f8de201 [svn] - Added playlist-delete command.
nhjm449
parents: 1319
diff changeset
394 return;
97000f8de201 [svn] - Added playlist-delete command.
nhjm449
parents: 1319
diff changeset
395 }
97000f8de201 [svn] - Added playlist-delete command.
nhjm449
parents: 1319
diff changeset
396
97000f8de201 [svn] - Added playlist-delete command.
nhjm449
parents: 1319
diff changeset
397 xmms_remote_playlist_delete(session, playpos - 1);
97000f8de201 [svn] - Added playlist-delete command.
nhjm449
parents: 1319
diff changeset
398 }
97000f8de201 [svn] - Added playlist-delete command.
nhjm449
parents: 1319
diff changeset
399
1200
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
400 void playlist_length(gint session, gint argc, gchar **argv)
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 gint i;
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 i = xmms_remote_get_playlist_length(session);
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 g_print("%d\n", i);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
407 }
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 void playlist_song(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
410 {
2055
8feb3d69b5be [svn] - cleanups from oliver@freebsd.org
nenolod
parents: 1953
diff changeset
411 gint playpos;
8feb3d69b5be [svn] - cleanups from oliver@freebsd.org
nenolod
parents: 1953
diff changeset
412 gchar *song;
8feb3d69b5be [svn] - cleanups from oliver@freebsd.org
nenolod
parents: 1953
diff changeset
413
1200
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
414 if (argc < 3)
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 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
417 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
418 return;
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
2055
8feb3d69b5be [svn] - cleanups from oliver@freebsd.org
nenolod
parents: 1953
diff changeset
421 playpos = atoi(argv[2]);
1200
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 if (playpos < 1 || playpos > xmms_remote_get_playlist_length(session))
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
424 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
425 g_print("%s: invalid playlist position %d\n", argv[0], playpos);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
426 return;
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
2055
8feb3d69b5be [svn] - cleanups from oliver@freebsd.org
nenolod
parents: 1953
diff changeset
429 song = xmms_remote_get_playlist_title(session, playpos - 1);
1200
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
430
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
431 g_print("%s\n", song);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
432 }
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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
435 void playlist_song_length(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
436 {
2055
8feb3d69b5be [svn] - cleanups from oliver@freebsd.org
nenolod
parents: 1953
diff changeset
437 gint playpos, frames, length;
8feb3d69b5be [svn] - cleanups from oliver@freebsd.org
nenolod
parents: 1953
diff changeset
438
1200
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
439 if (argc < 3)
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 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
442 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
443 return;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
444 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
445
2055
8feb3d69b5be [svn] - cleanups from oliver@freebsd.org
nenolod
parents: 1953
diff changeset
446 playpos = atoi(argv[2]);
1200
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
447
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
448 if (playpos < 1 || playpos > xmms_remote_get_playlist_length(session))
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("%s: invalid playlist position %d\n", argv[0], playpos);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
451 return;
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
2055
8feb3d69b5be [svn] - cleanups from oliver@freebsd.org
nenolod
parents: 1953
diff changeset
454 frames = xmms_remote_get_playlist_time(session, playpos - 1);
8feb3d69b5be [svn] - cleanups from oliver@freebsd.org
nenolod
parents: 1953
diff changeset
455 length = frames / 1000;
1200
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("%d:%.2d\n", length / 60, length % 60);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
458 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
459
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
460 void playlist_song_length_seconds(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
461 {
2055
8feb3d69b5be [svn] - cleanups from oliver@freebsd.org
nenolod
parents: 1953
diff changeset
462 gint playpos, frames, length;
8feb3d69b5be [svn] - cleanups from oliver@freebsd.org
nenolod
parents: 1953
diff changeset
463
1200
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
464 if (argc < 3)
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 parameters for playlist-song-length-seconds.\n", argv[0]);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
467 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
468 return;
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
2055
8feb3d69b5be [svn] - cleanups from oliver@freebsd.org
nenolod
parents: 1953
diff changeset
471 playpos = atoi(argv[2]);
1200
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 if (playpos < 1 || playpos > xmms_remote_get_playlist_length(session))
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 g_print("%s: invalid playlist position %d\n", argv[0], playpos);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
476 return;
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
2055
8feb3d69b5be [svn] - cleanups from oliver@freebsd.org
nenolod
parents: 1953
diff changeset
479 frames = xmms_remote_get_playlist_time(session, playpos - 1);
8feb3d69b5be [svn] - cleanups from oliver@freebsd.org
nenolod
parents: 1953
diff changeset
480 length = frames / 1000;
1200
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
481
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
482 g_print("%d\n", length);
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 void playlist_song_length_frames(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
486 {
2055
8feb3d69b5be [svn] - cleanups from oliver@freebsd.org
nenolod
parents: 1953
diff changeset
487 gint playpos, frames;
8feb3d69b5be [svn] - cleanups from oliver@freebsd.org
nenolod
parents: 1953
diff changeset
488
1200
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
489 if (argc < 3)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
490 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
491 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
492 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
493 return;
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
2055
8feb3d69b5be [svn] - cleanups from oliver@freebsd.org
nenolod
parents: 1953
diff changeset
496 playpos = atoi(argv[2]);
1200
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 if (playpos < 1 || playpos > xmms_remote_get_playlist_length(session))
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 g_print("%s: invalid playlist position %d\n", argv[0], playpos);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
501 return;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
502 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
503
2055
8feb3d69b5be [svn] - cleanups from oliver@freebsd.org
nenolod
parents: 1953
diff changeset
504 frames = xmms_remote_get_playlist_time(session, playpos - 1);
1200
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
505
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
506 g_print("%d\n", frames);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
507 }
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 void playlist_display(gint session, gint argc, gchar **argv)
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 gint i, ii, frames, length, total;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
512 gchar *songname;
1931
111f30d09ef2 [svn] audtool improvement:
yaz
parents: 1459
diff changeset
513 gchar *fmt = NULL, *p;
111f30d09ef2 [svn] audtool improvement:
yaz
parents: 1459
diff changeset
514 gint column;
111f30d09ef2 [svn] audtool improvement:
yaz
parents: 1459
diff changeset
515
1200
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
516 i = xmms_remote_get_playlist_length(session);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
517
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
518 g_print("%d tracks.\n", i);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
519
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
520 total = 0;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
521
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
522 for (ii = 0; ii < i; ii++)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
523 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
524 songname = xmms_remote_get_playlist_title(session, ii);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
525 frames = xmms_remote_get_playlist_time(session, ii);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
526 length = frames / 1000;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
527 total += length;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
528
1931
111f30d09ef2 [svn] audtool improvement:
yaz
parents: 1459
diff changeset
529 /* adjust width for multi byte characters */
111f30d09ef2 [svn] audtool improvement:
yaz
parents: 1459
diff changeset
530 column = 60;
111f30d09ef2 [svn] audtool improvement:
yaz
parents: 1459
diff changeset
531 if(songname){
111f30d09ef2 [svn] audtool improvement:
yaz
parents: 1459
diff changeset
532 p = songname;
111f30d09ef2 [svn] audtool improvement:
yaz
parents: 1459
diff changeset
533 while(*p){
111f30d09ef2 [svn] audtool improvement:
yaz
parents: 1459
diff changeset
534 gint stride;
111f30d09ef2 [svn] audtool improvement:
yaz
parents: 1459
diff changeset
535 stride = g_utf8_next_char(p) - p;
1953
e00f2d82233b [svn] - build fix
yaz
parents: 1948
diff changeset
536 if(g_unichar_iswide(g_utf8_get_char(p))
e00f2d82233b [svn] - build fix
yaz
parents: 1948
diff changeset
537 #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
538 || 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
539 #endif
78e8d9dd5036 [svn] - only use g_unichar_iswide_cjk if GLib 2.12 is available.
nenolod
parents: 1932
diff changeset
540 ){
1931
111f30d09ef2 [svn] audtool improvement:
yaz
parents: 1459
diff changeset
541 column += (stride - 2);
111f30d09ef2 [svn] audtool improvement:
yaz
parents: 1459
diff changeset
542 }
111f30d09ef2 [svn] audtool improvement:
yaz
parents: 1459
diff changeset
543 else {
111f30d09ef2 [svn] audtool improvement:
yaz
parents: 1459
diff changeset
544 column += (stride - 1);
111f30d09ef2 [svn] audtool improvement:
yaz
parents: 1459
diff changeset
545 }
111f30d09ef2 [svn] audtool improvement:
yaz
parents: 1459
diff changeset
546 p = g_utf8_next_char(p);
111f30d09ef2 [svn] audtool improvement:
yaz
parents: 1459
diff changeset
547 }
111f30d09ef2 [svn] audtool improvement:
yaz
parents: 1459
diff changeset
548
111f30d09ef2 [svn] audtool improvement:
yaz
parents: 1459
diff changeset
549 }
111f30d09ef2 [svn] audtool improvement:
yaz
parents: 1459
diff changeset
550
111f30d09ef2 [svn] audtool improvement:
yaz
parents: 1459
diff changeset
551 fmt = g_strdup_printf("%%4d | %%-%ds | %%d:%%.2d\n", column);
111f30d09ef2 [svn] audtool improvement:
yaz
parents: 1459
diff changeset
552 g_print(fmt, ii + 1, songname, length / 60, length % 60);
111f30d09ef2 [svn] audtool improvement:
yaz
parents: 1459
diff changeset
553 g_free(fmt);
1200
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
554 }
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 g_print("Total length: %d:%.2d\n", total / 60, total % 60);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
557 }
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 void playlist_position(gint session, gint argc, gchar **argv)
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 gint i;
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 i = xmms_remote_get_playlist_pos(session);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
564
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
565 g_print("%d\n", i + 1);
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 void playlist_song_filename(gint session, gint argc, gchar **argv)
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 gint i;
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 if (argc < 3)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
573 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
574 g_print("%s: invalid parameters for playlist-filename.\n", argv[0]);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
575 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
576 return;
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 i = atoi(argv[2]);
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 if (i < 1 || i > xmms_remote_get_playlist_length(session))
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 g_print("%s: invalid playlist position %d\n", argv[0], i);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
584 return;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
585 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
586
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
587 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
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 void playlist_jump(gint session, gint argc, gchar **argv)
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 gint i;
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 if (argc < 3)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
595 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
596 g_print("%s: invalid parameters for playlist-jump.\n", argv[0]);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
597 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
598 return;
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 i = atoi(argv[2]);
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 if (i < 1 || i > xmms_remote_get_playlist_length(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 g_print("%s: invalid playlist position %d\n", argv[0], i);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
606 return;
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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
609 xmms_remote_set_playlist_pos(session, i - 1);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
610 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
611
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
612 void playlist_clear(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
613 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
614 xmms_remote_playlist_clear(session);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
615 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
616
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
617 void playlist_repeat_status(gint session, gint argc, gchar **argv)
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 if (xmms_remote_is_repeat(session))
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
620 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
621 g_print("on\n");
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
622 return;
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 else
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
625 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
626 g_print("off\n");
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
627 return;
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 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
630
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
631 void playlist_repeat_toggle(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
632 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
633 xmms_remote_toggle_repeat(session);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
634 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
635
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
636 void playlist_shuffle_status(gint session, gint argc, gchar **argv)
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 if (xmms_remote_is_shuffle(session))
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
639 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
640 g_print("on\n");
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
641 return;
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 else
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
644 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
645 g_print("off\n");
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
646 return;
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 }
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 void playlist_shuffle_toggle(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
651 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
652 xmms_remote_toggle_shuffle(session);
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 void playqueue_add(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
656 {
1204
76e6b66fb859 [svn] - compiles warningless inside the audacious buildsystem now
nenolod
parents: 1203
diff changeset
657 gint i;
1200
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 if (argc < 3)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
660 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
661 g_print("%s: invalid parameters for playqueue-add.\n", argv[0]);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
662 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
663 return;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
664 }
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 i = atoi(argv[2]);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
667
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
668 if (i < 1 || i > xmms_remote_get_playlist_length(session))
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
669 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
670 g_print("%s: invalid playlist position %d\n", argv[0], i);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
671 return;
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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
674 if (!(xmms_remote_playqueue_is_queued(session, i - 1)))
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
675 xmms_remote_playqueue_add(session, i - 1);
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 void playqueue_remove(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
679 {
1204
76e6b66fb859 [svn] - compiles warningless inside the audacious buildsystem now
nenolod
parents: 1203
diff changeset
680 gint i;
1200
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 if (argc < 3)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
683 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
684 g_print("%s: invalid parameters for playqueue-remove.\n", argv[0]);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
685 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
686 return;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
687 }
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 i = atoi(argv[2]);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
690
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
691 if (i < 1 || i > xmms_remote_get_playlist_length(session))
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
692 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
693 g_print("%s: invalid playlist position %d\n", argv[0], i);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
694 return;
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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
697 if (xmms_remote_playqueue_is_queued(session, i - 1))
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
698 xmms_remote_playqueue_remove(session, i - 1);
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 void playqueue_is_queued(gint session, gint argc, gchar **argv)
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 gint i;
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 if (argc < 3)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
706 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
707 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
708 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
709 return;
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 i = atoi(argv[2]);
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 if (i < 1 || i > xmms_remote_get_playlist_length(session))
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 g_print("%s: invalid playlist position %d\n", argv[0], i);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
717 return;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
718 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
719
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
720 exit(!(xmms_remote_playqueue_is_queued(session, i - 1)));
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 void playqueue_get_position(gint session, gint argc, gchar **argv)
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 gint i, pos;
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 if (argc < 3)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
728 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
729 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
730 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
731 return;
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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
734 i = atoi(argv[2]);
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 if (i < 1 || i > xmms_remote_get_playlist_length(session))
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 g_print("%s: invalid playlist position %d\n", argv[0], i);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
739 return;
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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
742 pos = xmms_remote_get_playqueue_position(session, i - 1) + 1;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
743
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
744 if (pos < 1)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
745 return;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
746
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
747 g_print("%d\n", pos);
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 void playqueue_get_qposition(gint session, gint argc, gchar **argv)
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 gint i, pos;
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 if (argc < 3)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
755 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
756 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
757 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
758 return;
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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
761 i = atoi(argv[2]);
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 if (i < 1 || i > xmms_remote_get_playqueue_length(session))
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 g_print("%s: invalid playlist position %d\n", argv[0], i);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
766 return;
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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
769 pos = xmms_remote_get_playqueue_queue_position(session, i - 1) + 1;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
770
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
771 if (pos < 1)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
772 return;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
773
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
774 g_print("%d\n", pos);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
775 }
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 void playqueue_display(gint session, gint argc, gchar **argv)
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 gint i, ii, position, frames, length, total;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
780 gchar *songname;
1931
111f30d09ef2 [svn] audtool improvement:
yaz
parents: 1459
diff changeset
781 gchar *fmt = NULL, *p;
111f30d09ef2 [svn] audtool improvement:
yaz
parents: 1459
diff changeset
782 gint column;
1200
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
783
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
784 i = xmms_remote_get_playqueue_length(session);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
785
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
786 g_print("%d queued tracks.\n", i);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
787
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
788 total = 0;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
789
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
790 for (ii = 0; ii < i; ii++)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
791 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
792 position = xmms_remote_get_playqueue_queue_position(session, ii);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
793 songname = xmms_remote_get_playlist_title(session, position);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
794 frames = xmms_remote_get_playlist_time(session, position);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
795 length = frames / 1000;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
796 total += length;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
797
1931
111f30d09ef2 [svn] audtool improvement:
yaz
parents: 1459
diff changeset
798 /* adjust width for multi byte characters */
111f30d09ef2 [svn] audtool improvement:
yaz
parents: 1459
diff changeset
799 column = 60;
111f30d09ef2 [svn] audtool improvement:
yaz
parents: 1459
diff changeset
800 if(songname) {
111f30d09ef2 [svn] audtool improvement:
yaz
parents: 1459
diff changeset
801 p = songname;
111f30d09ef2 [svn] audtool improvement:
yaz
parents: 1459
diff changeset
802 while(*p){
111f30d09ef2 [svn] audtool improvement:
yaz
parents: 1459
diff changeset
803 gint stride;
111f30d09ef2 [svn] audtool improvement:
yaz
parents: 1459
diff changeset
804 stride = g_utf8_next_char(p) - p;
1953
e00f2d82233b [svn] - build fix
yaz
parents: 1948
diff changeset
805 if(g_unichar_iswide(g_utf8_get_char(p))
e00f2d82233b [svn] - build fix
yaz
parents: 1948
diff changeset
806 #if ( (GLIB_MAJOR_VERSION == 2) && (GLIB_MINOR_VERSION >= 12) )
e00f2d82233b [svn] - build fix
yaz
parents: 1948
diff changeset
807 || g_unichar_iswide_cjk(g_utf8_get_char(p))
e00f2d82233b [svn] - build fix
yaz
parents: 1948
diff changeset
808 #endif
e00f2d82233b [svn] - build fix
yaz
parents: 1948
diff changeset
809 ){
1931
111f30d09ef2 [svn] audtool improvement:
yaz
parents: 1459
diff changeset
810 column += (stride - 2);
111f30d09ef2 [svn] audtool improvement:
yaz
parents: 1459
diff changeset
811 }
111f30d09ef2 [svn] audtool improvement:
yaz
parents: 1459
diff changeset
812 else {
111f30d09ef2 [svn] audtool improvement:
yaz
parents: 1459
diff changeset
813 column += (stride - 1);
111f30d09ef2 [svn] audtool improvement:
yaz
parents: 1459
diff changeset
814 }
111f30d09ef2 [svn] audtool improvement:
yaz
parents: 1459
diff changeset
815 p = g_utf8_next_char(p);
111f30d09ef2 [svn] audtool improvement:
yaz
parents: 1459
diff changeset
816 }
111f30d09ef2 [svn] audtool improvement:
yaz
parents: 1459
diff changeset
817 }
111f30d09ef2 [svn] audtool improvement:
yaz
parents: 1459
diff changeset
818
111f30d09ef2 [svn] audtool improvement:
yaz
parents: 1459
diff changeset
819 fmt = g_strdup_printf("%%4d | %%4d | %%-%ds | %%d:%%.2d\n", column);
111f30d09ef2 [svn] audtool improvement:
yaz
parents: 1459
diff changeset
820 g_print(fmt, ii + 1, position + 1, songname, length / 60, length % 60);
111f30d09ef2 [svn] audtool improvement:
yaz
parents: 1459
diff changeset
821 g_free(fmt);
1200
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
822 }
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 g_print("Total length: %d:%.2d\n", total / 60, total % 60);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
825 }
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 void playqueue_length(gint session, gint argc, gchar **argv)
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 gint i;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
830
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
831 i = xmms_remote_get_playqueue_length(session);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
832
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
833 g_print("%d\n", i);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
834 }
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 void playqueue_clear(gint session, gint argc, gchar **argv)
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 xmms_remote_playqueue_clear(session);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
839 }
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 void get_volume(gint session, gint argc, gchar **argv)
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 gint i;
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 i = xmms_remote_get_main_volume(session);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
846
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
847 g_print("%d\n", i);
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 void set_volume(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
851 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
852 gint i, current_volume;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
853
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
854 if (argc < 3)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
855 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
856 g_print("%s: invalid parameters for set-volume.\n", argv[0]);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
857 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
858 return;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
859 }
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 current_volume = xmms_remote_get_main_volume(session);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
862 switch (argv[2][0])
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 case '+':
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
865 case '-':
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
866 i = current_volume + atoi(argv[2]);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
867 break;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
868 default:
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
869 i = atoi(argv[2]);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
870 break;
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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
873 xmms_remote_set_main_volume(session, i);
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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
876 void show_preferences_window(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
877 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
878 xmms_remote_show_prefs_box(session);
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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
881 void show_jtf_window(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
882 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
883 xmms_remote_show_jtf_box(session);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
884 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
885
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
886 void shutdown_audacious_server(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
887 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
888 xmms_remote_quit(session);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
889 }
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 void get_handlers_list(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
892 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
893 gint i;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
894
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
895 for (i = 0; handlers[i].name != NULL; i++)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
896 {
1203
a09393433f83 [svn] - OMKize Makefile (examples not installed yet)
nenolod
parents: 1200
diff changeset
897 if (!g_strcasecmp("<sep>", handlers[i].name))
1316
276cc2ce63b7 [svn] - category titles
nenolod
parents: 1225
diff changeset
898 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
899 else
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
900 g_print(" %-34s - %s\n", handlers[i].name, handlers[i].desc);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
901 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
902
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
903 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
904 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
905 }