annotate audtool/audtool.c @ 1233:47a8833c2b01 trunk

[svn] - get_song_tuple() implementation
author nenolod
date Wed, 14 Jun 2006 21:47:23 -0700
parents b8f5cb287ed2
children 276cc2ce63b7
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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
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>
1225
b8f5cb287ed2 [svn] - Use the correct beepctrl.h.
nhjm449
parents: 1204
diff changeset
21 #include "libaudacious/beepctrl.h"
1200
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
22 #include "audtool.h"
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
23
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
24 struct commandhandler handlers[] = {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
25 {"current-song", get_current_song, "returns current song title"},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
26 {"current-song-filename", get_current_song_filename, "returns current song filename"},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
27 {"current-song-length", get_current_song_length, "returns current song length"},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
28 {"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
29 {"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
30 {"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
31 {"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
32 {"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
33 {"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
34 {"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
35 {"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
36 {"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
37 {"current-song-channels", get_current_song_channels, "returns current song channels"},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
38 {"<sep>", NULL, NULL},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
39 {"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
40 {"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
41 {"playlist-addurl", playlist_add_url_string, "adds a url to the playlist"},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
42 {"playlist-length", playlist_length, "returns the total length of the playlist"},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
43 {"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
44 {"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
45 {"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
46 {"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
47 {"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
48 {"playlist-display", playlist_display, "returns the entire playlist"},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
49 {"playlist-position", playlist_position, "returns the position in the playlist"},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
50 {"playlist-jump", playlist_jump, "jumps to a position in the playlist"},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
51 {"playlist-clear", playlist_clear, "clears the playlist"},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
52 {"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
53 {"playlist-repeat-toggle", playlist_repeat_toggle, "toggles playlist repeat"},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
54 {"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
55 {"playlist-shuffle-toggle", playlist_shuffle_toggle, "toggles playlist shuffle"},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
56 {"<sep>", NULL, NULL},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
57 {"playqueue-add", playqueue_add, "adds a song to the playqueue"},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
58 {"playqueue-remove", playqueue_remove, "removes a song from the playqueue"},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
59 {"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
60 {"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
61 {"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
62 {"playqueue-length", playqueue_length, "returns the length of the playqueue"},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
63 {"playqueue-display", playqueue_display, "returns a list of currently-queued songs"},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
64 {"playqueue-clear", playqueue_clear, "clears the playqueue"},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
65 {"<sep>", NULL, NULL},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
66 {"playback-play", playback_play, "starts/unpauses song playback"},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
67 {"playback-pause", playback_pause, "(un)pauses song playback"},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
68 {"playback-playpause", playback_playpause, "plays/(un)pauses song playback"},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
69 {"playback-stop", playback_stop, "stops song playback"},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
70 {"playback-playing", playback_playing, "returns OK if audacious is playing"},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
71 {"playback-paused", playback_paused, "returns OK if audacious is paused"},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
72 {"playback-stopped", playback_stopped, "returns OK if audacious is stopped"},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
73 {"playback-status", playback_status, "returns the playback status"},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
74 {"<sep>", NULL, NULL},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
75 {"get-volume", get_volume, "returns the current volume level in percent"},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
76 {"set-volume", set_volume, "sets the current volume level in percent"},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
77 {"<sep>", NULL, NULL},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
78 {"preferences", show_preferences_window, "shows/hides the preferences window"},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
79 {"jumptofile", show_jtf_window, "shows the jump to file window"},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
80 {"shutdown", shutdown_audacious_server, "shuts down audacious"},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
81 {"<sep>", NULL, NULL},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
82 {"list-handlers", get_handlers_list, "shows handlers list"},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
83 {"help", get_handlers_list, "shows handlers list"},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
84 {NULL, NULL, NULL}
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
85 };
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
86
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
87 gint main(gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
88 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
89 gint i;
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 if (argc < 2)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
92 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
93 g_print("%s: usage: %s <command>\n", argv[0], argv[0]);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
94 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
95 argv[0], argv[0]);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
96 exit(0);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
97 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
98
1203
a09393433f83 [svn] - OMKize Makefile (examples not installed yet)
nenolod
parents: 1200
diff changeset
99 if (!xmms_remote_is_running(0) && g_strcasecmp("help", argv[1])
a09393433f83 [svn] - OMKize Makefile (examples not installed yet)
nenolod
parents: 1200
diff changeset
100 && g_strcasecmp("list-handlers", argv[1]))
1200
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
101 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
102 g_print("%s: audacious server is not running!\n", argv[0]);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
103 exit(0);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
104 }
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 for (i = 0; handlers[i].name != NULL; i++)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
107 {
1203
a09393433f83 [svn] - OMKize Makefile (examples not installed yet)
nenolod
parents: 1200
diff changeset
108 if ((!g_strcasecmp(handlers[i].name, argv[1]) ||
a09393433f83 [svn] - OMKize Makefile (examples not installed yet)
nenolod
parents: 1200
diff changeset
109 !g_strcasecmp(g_strconcat("--", handlers[i].name, NULL), argv[1]))
a09393433f83 [svn] - OMKize Makefile (examples not installed yet)
nenolod
parents: 1200
diff changeset
110 && g_strcasecmp("<sep>", handlers[i].name))
1200
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
111 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
112 handlers[i].handler(0, argc, argv);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
113 exit(0);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
114 }
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 g_print("%s: invalid command '%s'\n", argv[0], argv[1]);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
118 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
119
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
120 return 0;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
121 }
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 /*** MOVE TO HANDLERS.C ***/
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
124
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
125 void get_current_song(gint session, gint argc, gchar **argv)
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 gint playpos = xmms_remote_get_playlist_pos(session);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
128 gchar *song = xmms_remote_get_playlist_title(session, playpos);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
129
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
130 if (!song)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
131 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
132 g_print("No song playing.\n");
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
133 return;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
134 }
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 g_print("%s\n", song);
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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
139 void get_current_song_filename(gint session, gint argc, gchar **argv)
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 gint playpos = xmms_remote_get_playlist_pos(session);
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("%s\n", xmms_remote_get_playlist_file(session, playpos));
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
144 }
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 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
147 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
148 gint frames = xmms_remote_get_output_time(session);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
149 gint length = frames / 1000;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
150
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
151 g_print("%d:%.2d\n", length / 60, length % 60);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
152 }
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 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
155 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
156 gint frames = xmms_remote_get_output_time(session);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
157 gint length = frames / 1000;
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 g_print("%d\n", length);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
160 }
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 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
163 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
164 gint frames = xmms_remote_get_output_time(session);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
165
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
166 g_print("%d\n", frames);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
167 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
168
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
169 void get_current_song_length(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
170 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
171 gint playpos = xmms_remote_get_playlist_pos(session);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
172 gint frames = xmms_remote_get_playlist_time(session, playpos);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
173 gint length = frames / 1000;
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 g_print("%d:%.2d\n", length / 60, length % 60);
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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
178 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
179 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
180 gint playpos = xmms_remote_get_playlist_pos(session);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
181 gint frames = xmms_remote_get_playlist_time(session, playpos);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
182 gint length = frames / 1000;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
183
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
184 g_print("%d\n", length);
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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
187 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
188 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
189 gint playpos = xmms_remote_get_playlist_pos(session);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
190 gint frames = xmms_remote_get_playlist_time(session, playpos);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
191
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
192 g_print("%d\n", frames);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
193 }
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 void get_current_song_bitrate(gint session, gint argc, gchar **argv)
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 gint rate, freq, nch;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
198
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
199 xmms_remote_get_info(session, &rate, &freq, &nch);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
200
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
201 g_print("%d\n", rate);
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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
204 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
205 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
206 gint rate, freq, nch;
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 xmms_remote_get_info(session, &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 g_print("%d\n", rate / 1000);
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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
213 void get_current_song_frequency(gint session, gint argc, gchar **argv)
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 gint rate, freq, nch;
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 xmms_remote_get_info(session, &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 g_print("%d\n", freq);
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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
222 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
223 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
224 gint rate, freq, nch;
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 xmms_remote_get_info(session, &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 g_print("%0.1f\n", (gfloat) freq / 1000);
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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
231 void get_current_song_channels(gint session, gint argc, gchar **argv)
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 gint rate, freq, nch;
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 xmms_remote_get_info(session, &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 g_print("%d\n", 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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
240 void playlist_reverse(gint session, gint argc, gchar **argv)
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 xmms_remote_playlist_prev(session);
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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
245 void playlist_advance(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
246 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
247 xmms_remote_playlist_next(session);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
248 }
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 void playback_play(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
251 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
252 xmms_remote_play(session);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
253 }
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 void playback_pause(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
256 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
257 xmms_remote_pause(session);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
258 }
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 void playback_playpause(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
261 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
262 if (xmms_remote_is_playing(session))
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
263 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
264 xmms_remote_pause(session);
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 else
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_play(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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
272 void playback_stop(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
273 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
274 xmms_remote_stop(session);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
275 }
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 void playback_playing(gint session, gint argc, gchar **argv)
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 if (!xmms_remote_is_paused(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 exit(!xmms_remote_is_playing(session));
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 else
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 exit(1);
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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
289 void playback_paused(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
290 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
291 exit(!xmms_remote_is_paused(session));
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
292 }
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 void playback_stopped(gint session, gint argc, gchar **argv)
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 if (!xmms_remote_is_playing(session) && !xmms_remote_is_paused(session))
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 exit(0);
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 else
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(1);
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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
306 void playback_status(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
307 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
308 if (xmms_remote_is_paused(session))
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
309 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
310 g_print("paused\n");
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
311 return;
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 else if (xmms_remote_is_playing(session))
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 g_print("playing\n");
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
316 return;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
317 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
318 else
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
319 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
320 g_print("stopped\n");
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
321 return;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
322 }
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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
325 void playlist_add_url_string(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
326 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
327 if (argc < 3)
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 g_print("%s: invalid parameters for playlist-addurl.\n", argv[0]);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
330 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
331 return;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
332 }
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 xmms_remote_playlist_add_url_string(session, argv[2]);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
335 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
336
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
337 void playlist_length(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
338 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
339 gint i;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
340
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
341 i = xmms_remote_get_playlist_length(session);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
342
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
343 g_print("%d\n", i);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
344 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
345
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
346 void playlist_song(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
347 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
348 if (argc < 3)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
349 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
350 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
351 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
352 return;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
353 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
354
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
355 gint playpos = atoi(argv[2]);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
356
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
357 if (playpos < 1 || playpos > xmms_remote_get_playlist_length(session))
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
358 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
359 g_print("%s: invalid playlist position %d\n", argv[0], playpos);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
360 return;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
361 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
362
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
363 gchar *song = xmms_remote_get_playlist_title(session, playpos - 1);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
364
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
365 g_print("%s\n", song);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
366 }
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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
369 void playlist_song_length(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
370 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
371 if (argc < 3)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
372 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
373 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
374 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
375 return;
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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
378 gint playpos = atoi(argv[2]);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
379
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
380 if (playpos < 1 || playpos > xmms_remote_get_playlist_length(session))
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
381 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
382 g_print("%s: invalid playlist position %d\n", argv[0], playpos);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
383 return;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
384 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
385
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
386 gint frames = xmms_remote_get_playlist_time(session, playpos - 1);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
387 gint length = frames / 1000;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
388
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
389 g_print("%d:%.2d\n", length / 60, length % 60);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
390 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
391
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
392 void playlist_song_length_seconds(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
393 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
394 if (argc < 3)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
395 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
396 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
397 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
398 return;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
399 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
400
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
401 gint playpos = atoi(argv[2]);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
402
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
403 if (playpos < 1 || playpos > xmms_remote_get_playlist_length(session))
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
404 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
405 g_print("%s: invalid playlist position %d\n", argv[0], playpos);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
406 return;
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 gint frames = xmms_remote_get_playlist_time(session, playpos - 1);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
410 gint length = frames / 1000;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
411
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
412 g_print("%d\n", length);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
413 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
414
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
415 void playlist_song_length_frames(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
416 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
417 if (argc < 3)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
418 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
419 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
420 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
421 return;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
422 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
423
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
424 gint playpos = atoi(argv[2]);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
425
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
426 if (playpos < 1 || playpos > xmms_remote_get_playlist_length(session))
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 g_print("%s: invalid playlist position %d\n", argv[0], playpos);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
429 return;
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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
432 gint frames = xmms_remote_get_playlist_time(session, playpos - 1);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
433
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
434 g_print("%d\n", frames);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
435 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
436
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
437 void playlist_display(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
438 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
439 gint i, ii, frames, length, total;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
440 gchar *songname;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
441
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
442 i = xmms_remote_get_playlist_length(session);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
443
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
444 g_print("%d tracks.\n", i);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
445
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
446 total = 0;
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 for (ii = 0; ii < i; ii++)
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 songname = xmms_remote_get_playlist_title(session, ii);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
451 frames = xmms_remote_get_playlist_time(session, ii);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
452 length = frames / 1000;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
453 total += length;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
454
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
455 g_print("%4d | %-60s | %d:%.2d\n",
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
456 ii + 1, songname, length / 60, length % 60);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
457 }
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 g_print("Total length: %d:%.2d\n", total / 60, total % 60);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
460 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
461
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
462 void playlist_position(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
463 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
464 gint i;
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 i = xmms_remote_get_playlist_pos(session);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
467
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
468 g_print("%d\n", i + 1);
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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
471 void playlist_song_filename(gint session, gint argc, gchar **argv)
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 gint i;
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 if (argc < 3)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
476 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
477 g_print("%s: invalid parameters for playlist-filename.\n", argv[0]);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
478 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
479 return;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
480 }
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 i = atoi(argv[2]);
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 if (i < 1 || i > xmms_remote_get_playlist_length(session))
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
485 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
486 g_print("%s: invalid playlist position %d\n", argv[0], i);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
487 return;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
488 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
489
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
490 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
491 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
492
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
493 void playlist_jump(gint session, gint argc, gchar **argv)
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 gint i;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
496
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
497 if (argc < 3)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
498 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
499 g_print("%s: invalid parameters for playlist-jump.\n", argv[0]);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
500 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
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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
504 i = atoi(argv[2]);
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 if (i < 1 || i > xmms_remote_get_playlist_length(session))
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 g_print("%s: invalid playlist position %d\n", argv[0], i);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
509 return;
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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
512 xmms_remote_set_playlist_pos(session, i - 1);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
513 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
514
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
515 void playlist_clear(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
516 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
517 xmms_remote_playlist_clear(session);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
518 }
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 void playlist_repeat_status(gint session, gint argc, gchar **argv)
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 if (xmms_remote_is_repeat(session))
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 g_print("on\n");
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
525 return;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
526 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
527 else
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
528 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
529 g_print("off\n");
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
530 return;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
531 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
532 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
533
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
534 void playlist_repeat_toggle(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
535 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
536 xmms_remote_toggle_repeat(session);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
537 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
538
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
539 void playlist_shuffle_status(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
540 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
541 if (xmms_remote_is_shuffle(session))
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
542 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
543 g_print("on\n");
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
544 return;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
545 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
546 else
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
547 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
548 g_print("off\n");
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
549 return;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
550 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
551 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
552
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
553 void playlist_shuffle_toggle(gint session, gint argc, gchar **argv)
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 xmms_remote_toggle_shuffle(session);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
556 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
557
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
558 void playqueue_add(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
559 {
1204
76e6b66fb859 [svn] - compiles warningless inside the audacious buildsystem now
nenolod
parents: 1203
diff changeset
560 gint i;
1200
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
561
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
562 if (argc < 3)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
563 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
564 g_print("%s: invalid parameters for playqueue-add.\n", argv[0]);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
565 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
566 return;
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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
569 i = atoi(argv[2]);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
570
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
571 if (i < 1 || i > xmms_remote_get_playlist_length(session))
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
572 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
573 g_print("%s: invalid playlist position %d\n", argv[0], i);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
574 return;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
575 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
576
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
577 if (!(xmms_remote_playqueue_is_queued(session, i - 1)))
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
578 xmms_remote_playqueue_add(session, i - 1);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
579 }
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 void playqueue_remove(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
582 {
1204
76e6b66fb859 [svn] - compiles warningless inside the audacious buildsystem now
nenolod
parents: 1203
diff changeset
583 gint i;
1200
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
584
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
585 if (argc < 3)
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: invalid parameters for playqueue-remove.\n", argv[0]);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
588 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
589 return;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
590 }
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 i = atoi(argv[2]);
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 (i < 1 || i > xmms_remote_get_playlist_length(session))
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 playlist position %d\n", argv[0], i);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
597 return;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
598 }
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 if (xmms_remote_playqueue_is_queued(session, i - 1))
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
601 xmms_remote_playqueue_remove(session, i - 1);
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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
604 void playqueue_is_queued(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
605 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
606 gint i;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
607
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
608 if (argc < 3)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
609 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
610 g_print("%s: invalid parameters for playqueue-is-queued.\n", argv[0]);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
611 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
612 return;
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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
615 i = atoi(argv[2]);
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 if (i < 1 || i > xmms_remote_get_playlist_length(session))
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 g_print("%s: invalid playlist position %d\n", argv[0], i);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
620 return;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
621 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
622
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
623 exit(!(xmms_remote_playqueue_is_queued(session, i - 1)));
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
624 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
625
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
626 void playqueue_get_position(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
627 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
628 gint i, pos;
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 if (argc < 3)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
631 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
632 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
633 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
634 return;
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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
637 i = atoi(argv[2]);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
638
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
639 if (i < 1 || i > xmms_remote_get_playlist_length(session))
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
640 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
641 g_print("%s: invalid playlist position %d\n", argv[0], i);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
642 return;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
643 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
644
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
645 pos = xmms_remote_get_playqueue_position(session, i - 1) + 1;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
646
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
647 if (pos < 1)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
648 return;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
649
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
650 g_print("%d\n", pos);
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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
653 void playqueue_get_qposition(gint session, gint argc, gchar **argv)
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 gint i, pos;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
656
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
657 if (argc < 3)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
658 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
659 g_print("%s: invalid parameters for playqueue-get-qposition.\n", argv[0]);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
660 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
661 return;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
662 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
663
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
664 i = atoi(argv[2]);
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 if (i < 1 || i > xmms_remote_get_playqueue_length(session))
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 g_print("%s: invalid playlist position %d\n", argv[0], i);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
669 return;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
670 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
671
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
672 pos = xmms_remote_get_playqueue_queue_position(session, i - 1) + 1;
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 (pos < 1)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
675 return;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
676
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
677 g_print("%d\n", pos);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
678 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
679
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
680 void playqueue_display(gint session, gint argc, gchar **argv)
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 gint i, ii, position, frames, length, total;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
683 gchar *songname;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
684
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
685 i = xmms_remote_get_playqueue_length(session);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
686
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
687 g_print("%d queued tracks.\n", i);
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 total = 0;
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 for (ii = 0; ii < i; ii++)
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 position = xmms_remote_get_playqueue_queue_position(session, ii);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
694 songname = xmms_remote_get_playlist_title(session, position);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
695 frames = xmms_remote_get_playlist_time(session, position);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
696 length = frames / 1000;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
697 total += length;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
698
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
699 g_print("%4d | %4d | %-60s | %d:%.2d\n",
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
700 ii + 1, position + 1, songname, length / 60, length % 60);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
701 }
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 g_print("Total length: %d:%.2d\n", total / 60, total % 60);
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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
706 void playqueue_length(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
707 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
708 gint i;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
709
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
710 i = xmms_remote_get_playqueue_length(session);
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 g_print("%d\n", i);
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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
715 void playqueue_clear(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
716 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
717 xmms_remote_playqueue_clear(session);
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 void get_volume(gint session, gint argc, gchar **argv)
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 gint i;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
723
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
724 i = xmms_remote_get_main_volume(session);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
725
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
726 g_print("%d\n", i);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
727 }
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 void set_volume(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
730 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
731 gint i, current_volume;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
732
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
733 if (argc < 3)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
734 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
735 g_print("%s: invalid parameters for set-volume.\n", argv[0]);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
736 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
737 return;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
738 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
739
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
740 current_volume = xmms_remote_get_main_volume(session);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
741 switch (argv[2][0])
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
742 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
743 case '+':
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
744 case '-':
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
745 i = current_volume + atoi(argv[2]);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
746 break;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
747 default:
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
748 i = atoi(argv[2]);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
749 break;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
750 }
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 xmms_remote_set_main_volume(session, i);
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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
755 void show_preferences_window(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
756 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
757 xmms_remote_show_prefs_box(session);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
758 }
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 void show_jtf_window(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
761 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
762 xmms_remote_show_jtf_box(session);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
763 }
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 void shutdown_audacious_server(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
766 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
767 xmms_remote_quit(session);
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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
770 void get_handlers_list(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
771 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
772 gint i;
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("Available handlers:\n\n");
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 for (i = 0; handlers[i].name != NULL; i++)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
777 {
1203
a09393433f83 [svn] - OMKize Makefile (examples not installed yet)
nenolod
parents: 1200
diff changeset
778 if (!g_strcasecmp("<sep>", handlers[i].name))
1200
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
779 g_print("\n");
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
780 else
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
781 g_print(" %-34s - %s\n", handlers[i].name, handlers[i].desc);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
782 }
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 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
785 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
786 }