annotate audtool/audtool.c @ 1734:43c197f55dda trunk

[svn] - merge libaudacious (public) and audacious util APIs
author nenolod
date Mon, 18 Sep 2006 01:44:39 -0700
parents 705d4c089fce
children 111f30d09ef2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1200
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
1 /* Audtool -- Audacious scripting tool
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
2 * Copyright (c) 2005-2006 George Averill, William Pitcock
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
3 *
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
4 * This program is free software; you can redistribute it and/or modify
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
5 * it under the terms of the GNU General Public License as published by
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
6 * the Free Software Foundation; either version 2 of the License, or
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
7 * (at your option) any later version.
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
8 *
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
9 * This program is distributed in the hope that it will be useful,
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
12 * GNU General Public License for more details.
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
13 *
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
14 * You should have received a copy of the GNU General Public License
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
15 * along with this program; if not, write to the Free Software
1459
705d4c089fce [svn] Fix postal code.
chainsaw
parents: 1458
diff changeset
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
1200
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
17 */
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
18
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
19 #include <stdlib.h>
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
20 #include <glib.h>
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[] = {
1316
276cc2ce63b7 [svn] - category titles
nenolod
parents: 1225
diff changeset
25 {"<sep>", NULL, "Vital information"},
1200
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
26 {"current-song", get_current_song, "returns current song title"},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
27 {"current-song-filename", get_current_song_filename, "returns current song filename"},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
28 {"current-song-length", get_current_song_length, "returns current song length"},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
29 {"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
30 {"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
31 {"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
32 {"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
33 {"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
34 {"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
35 {"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
36 {"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
37 {"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
38 {"current-song-channels", get_current_song_channels, "returns current song channels"},
1316
276cc2ce63b7 [svn] - category titles
nenolod
parents: 1225
diff changeset
39 {"<sep>", NULL, "Playlist manipulation"},
1200
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
40 {"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
41 {"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
42 {"playlist-addurl", playlist_add_url_string, "adds a url to the playlist"},
1365
97000f8de201 [svn] - Added playlist-delete command.
nhjm449
parents: 1319
diff changeset
43 {"playlist-delete", playlist_delete, "deletes a song from the playlist"},
1200
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
44 {"playlist-length", playlist_length, "returns the total length of the playlist"},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
45 {"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
46 {"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
47 {"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
48 {"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
49 {"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
50 {"playlist-display", playlist_display, "returns the entire playlist"},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
51 {"playlist-position", playlist_position, "returns the position in the playlist"},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
52 {"playlist-jump", playlist_jump, "jumps to a position in the playlist"},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
53 {"playlist-clear", playlist_clear, "clears the playlist"},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
54 {"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
55 {"playlist-repeat-toggle", playlist_repeat_toggle, "toggles playlist repeat"},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
56 {"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
57 {"playlist-shuffle-toggle", playlist_shuffle_toggle, "toggles playlist shuffle"},
1316
276cc2ce63b7 [svn] - category titles
nenolod
parents: 1225
diff changeset
58 {"<sep>", NULL, "Playqueue manipulation"},
1200
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
59 {"playqueue-add", playqueue_add, "adds a song to the playqueue"},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
60 {"playqueue-remove", playqueue_remove, "removes a song from the playqueue"},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
61 {"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
62 {"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
63 {"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
64 {"playqueue-length", playqueue_length, "returns the length of the playqueue"},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
65 {"playqueue-display", playqueue_display, "returns a list of currently-queued songs"},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
66 {"playqueue-clear", playqueue_clear, "clears the playqueue"},
1316
276cc2ce63b7 [svn] - category titles
nenolod
parents: 1225
diff changeset
67 {"<sep>", NULL, "Playback manipulation"},
1200
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
68 {"playback-play", playback_play, "starts/unpauses song playback"},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
69 {"playback-pause", playback_pause, "(un)pauses song playback"},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
70 {"playback-playpause", playback_playpause, "plays/(un)pauses song playback"},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
71 {"playback-stop", playback_stop, "stops song playback"},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
72 {"playback-playing", playback_playing, "returns OK if audacious is playing"},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
73 {"playback-paused", playback_paused, "returns OK if audacious is paused"},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
74 {"playback-stopped", playback_stopped, "returns OK if audacious is stopped"},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
75 {"playback-status", playback_status, "returns the playback status"},
1316
276cc2ce63b7 [svn] - category titles
nenolod
parents: 1225
diff changeset
76 {"<sep>", NULL, "Volume control"},
1200
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
77 {"get-volume", get_volume, "returns the current volume level in percent"},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
78 {"set-volume", set_volume, "sets the current volume level in percent"},
1319
3783e06f951b [svn] - s/Miscillaneous/Miscellaneous/ in audtool.c
nhjm449
parents: 1316
diff changeset
79 {"<sep>", NULL, "Miscellaneous"},
1200
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
80 {"preferences", show_preferences_window, "shows/hides the preferences window"},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
81 {"jumptofile", show_jtf_window, "shows the jump to file window"},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
82 {"shutdown", shutdown_audacious_server, "shuts down audacious"},
1316
276cc2ce63b7 [svn] - category titles
nenolod
parents: 1225
diff changeset
83 {"<sep>", NULL, "Help system"},
1200
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
84 {"list-handlers", get_handlers_list, "shows handlers list"},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
85 {"help", get_handlers_list, "shows handlers list"},
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
86 {NULL, NULL, NULL}
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
87 };
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 main(gint argc, gchar **argv)
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 gint i;
1440
acdc12679d1a [svn] - allow environment variable AUDTOOL_REMOTE_URI to influence where the client library accesses the audacious session
nenolod
parents: 1365
diff changeset
92 gchar *remote_uri;
1200
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
93
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
94 if (argc < 2)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
95 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
96 g_print("%s: usage: %s <command>\n", argv[0], argv[0]);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
97 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
98 argv[0], argv[0]);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
99 exit(0);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
100 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
101
1440
acdc12679d1a [svn] - allow environment variable AUDTOOL_REMOTE_URI to influence where the client library accesses the audacious session
nenolod
parents: 1365
diff changeset
102 remote_uri = getenv("AUDTOOL_REMOTE_URI");
acdc12679d1a [svn] - allow environment variable AUDTOOL_REMOTE_URI to influence where the client library accesses the audacious session
nenolod
parents: 1365
diff changeset
103 audacious_set_session_uri(remote_uri);
acdc12679d1a [svn] - allow environment variable AUDTOOL_REMOTE_URI to influence where the client library accesses the audacious session
nenolod
parents: 1365
diff changeset
104
1203
a09393433f83 [svn] - OMKize Makefile (examples not installed yet)
nenolod
parents: 1200
diff changeset
105 if (!xmms_remote_is_running(0) && g_strcasecmp("help", argv[1])
a09393433f83 [svn] - OMKize Makefile (examples not installed yet)
nenolod
parents: 1200
diff changeset
106 && g_strcasecmp("list-handlers", argv[1]))
1200
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
107 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
108 g_print("%s: audacious server is not running!\n", argv[0]);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
109 exit(0);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
110 }
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 for (i = 0; handlers[i].name != NULL; i++)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
113 {
1203
a09393433f83 [svn] - OMKize Makefile (examples not installed yet)
nenolod
parents: 1200
diff changeset
114 if ((!g_strcasecmp(handlers[i].name, argv[1]) ||
a09393433f83 [svn] - OMKize Makefile (examples not installed yet)
nenolod
parents: 1200
diff changeset
115 !g_strcasecmp(g_strconcat("--", handlers[i].name, NULL), argv[1]))
a09393433f83 [svn] - OMKize Makefile (examples not installed yet)
nenolod
parents: 1200
diff changeset
116 && g_strcasecmp("<sep>", handlers[i].name))
1200
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
117 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
118 handlers[i].handler(0, argc, argv);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
119 exit(0);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
120 }
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 g_print("%s: invalid command '%s'\n", argv[0], argv[1]);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
124 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
125
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
126 return 0;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
127 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
128
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
129 /*** MOVE TO HANDLERS.C ***/
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
130
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
131 void get_current_song(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
132 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
133 gint playpos = xmms_remote_get_playlist_pos(session);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
134 gchar *song = xmms_remote_get_playlist_title(session, playpos);
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 if (!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 g_print("No song playing.\n");
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
139 return;
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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
142 g_print("%s\n", song);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
143 }
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 void get_current_song_filename(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
146 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
147 gint playpos = xmms_remote_get_playlist_pos(session);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
148
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
149 g_print("%s\n", xmms_remote_get_playlist_file(session, playpos));
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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
152 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
153 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
154 gint frames = xmms_remote_get_output_time(session);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
155 gint length = frames / 1000;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
156
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
157 g_print("%d:%.2d\n", length / 60, length % 60);
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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
160 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
161 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
162 gint frames = xmms_remote_get_output_time(session);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
163 gint length = frames / 1000;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
164
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
165 g_print("%d\n", length);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
166 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
167
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
168 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
169 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
170 gint frames = xmms_remote_get_output_time(session);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
171
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
172 g_print("%d\n", frames);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
173 }
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 void get_current_song_length(gint session, gint argc, gchar **argv)
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 gint playpos = xmms_remote_get_playlist_pos(session);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
178 gint frames = xmms_remote_get_playlist_time(session, playpos);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
179 gint length = frames / 1000;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
180
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
181 g_print("%d:%.2d\n", length / 60, length % 60);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
182 }
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 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
185 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
186 gint playpos = xmms_remote_get_playlist_pos(session);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
187 gint frames = xmms_remote_get_playlist_time(session, playpos);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
188 gint length = frames / 1000;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
189
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
190 g_print("%d\n", length);
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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
193 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
194 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
195 gint playpos = xmms_remote_get_playlist_pos(session);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
196 gint frames = xmms_remote_get_playlist_time(session, playpos);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
197
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
198 g_print("%d\n", frames);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
199 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
200
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
201 void get_current_song_bitrate(gint session, gint argc, gchar **argv)
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 gint rate, freq, nch;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
204
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
205 xmms_remote_get_info(session, &rate, &freq, &nch);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
206
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
207 g_print("%d\n", rate);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
208 }
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 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
211 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
212 gint rate, freq, nch;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
213
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
214 xmms_remote_get_info(session, &rate, &freq, &nch);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
215
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
216 g_print("%d\n", rate / 1000);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
217 }
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 void get_current_song_frequency(gint session, gint argc, gchar **argv)
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 gint rate, freq, nch;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
222
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
223 xmms_remote_get_info(session, &rate, &freq, &nch);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
224
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
225 g_print("%d\n", freq);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
226 }
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 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
229 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
230 gint rate, freq, nch;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
231
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
232 xmms_remote_get_info(session, &rate, &freq, &nch);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
233
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
234 g_print("%0.1f\n", (gfloat) freq / 1000);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
235 }
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 void get_current_song_channels(gint session, gint argc, gchar **argv)
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 gint rate, freq, nch;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
240
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
241 xmms_remote_get_info(session, &rate, &freq, &nch);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
242
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
243 g_print("%d\n", nch);
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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
246 void playlist_reverse(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
247 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
248 xmms_remote_playlist_prev(session);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
249 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
250
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
251 void playlist_advance(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
252 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
253 xmms_remote_playlist_next(session);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
254 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
255
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
256 void playback_play(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
257 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
258 xmms_remote_play(session);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
259 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
260
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
261 void playback_pause(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
262 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
263 xmms_remote_pause(session);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
264 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
265
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
266 void playback_playpause(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
267 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
268 if (xmms_remote_is_playing(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 xmms_remote_pause(session);
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 else
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_play(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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
278 void playback_stop(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
279 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
280 xmms_remote_stop(session);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
281 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
282
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
283 void playback_playing(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
284 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
285 if (!xmms_remote_is_paused(session))
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
286 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
287 exit(!xmms_remote_is_playing(session));
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 else
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(1);
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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
295 void playback_paused(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
296 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
297 exit(!xmms_remote_is_paused(session));
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
298 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
299
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
300 void playback_stopped(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
301 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
302 if (!xmms_remote_is_playing(session) && !xmms_remote_is_paused(session))
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
303 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
304 exit(0);
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 else
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 exit(1);
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 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
311
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
312 void playback_status(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
313 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
314 if (xmms_remote_is_paused(session))
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
315 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
316 g_print("paused\n");
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
317 return;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
318 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
319 else if (xmms_remote_is_playing(session))
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
320 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
321 g_print("playing\n");
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
322 return;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
323 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
324 else
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
325 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
326 g_print("stopped\n");
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
327 return;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
328 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
329 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
330
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
331 void playlist_add_url_string(gint session, gint argc, gchar **argv)
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 if (argc < 3)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
334 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
335 g_print("%s: invalid parameters for playlist-addurl.\n", argv[0]);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
336 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
337 return;
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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
340 xmms_remote_playlist_add_url_string(session, argv[2]);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
341 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
342
1365
97000f8de201 [svn] - Added playlist-delete command.
nhjm449
parents: 1319
diff changeset
343 void playlist_delete(gint session, gint argc, gchar **argv)
97000f8de201 [svn] - Added playlist-delete command.
nhjm449
parents: 1319
diff changeset
344 {
97000f8de201 [svn] - Added playlist-delete command.
nhjm449
parents: 1319
diff changeset
345 if (argc < 3)
97000f8de201 [svn] - Added playlist-delete command.
nhjm449
parents: 1319
diff changeset
346 {
97000f8de201 [svn] - Added playlist-delete command.
nhjm449
parents: 1319
diff changeset
347 g_print("%s: invalid parameters for playlist-delete.\n", argv[0]);
97000f8de201 [svn] - Added playlist-delete command.
nhjm449
parents: 1319
diff changeset
348 g_print("%s: syntax: %s playlist-delete <position>\n", argv[0], argv[0]);
97000f8de201 [svn] - Added playlist-delete command.
nhjm449
parents: 1319
diff changeset
349 return;
97000f8de201 [svn] - Added playlist-delete command.
nhjm449
parents: 1319
diff changeset
350 }
97000f8de201 [svn] - Added playlist-delete command.
nhjm449
parents: 1319
diff changeset
351
97000f8de201 [svn] - Added playlist-delete command.
nhjm449
parents: 1319
diff changeset
352 gint playpos = atoi(argv[2]);
97000f8de201 [svn] - Added playlist-delete command.
nhjm449
parents: 1319
diff changeset
353
97000f8de201 [svn] - Added playlist-delete command.
nhjm449
parents: 1319
diff changeset
354 if (playpos < 1 || playpos > xmms_remote_get_playlist_length(session))
97000f8de201 [svn] - Added playlist-delete command.
nhjm449
parents: 1319
diff changeset
355 {
97000f8de201 [svn] - Added playlist-delete command.
nhjm449
parents: 1319
diff changeset
356 g_print("%s: invalid playlist position %d\n", argv[0], playpos);
97000f8de201 [svn] - Added playlist-delete command.
nhjm449
parents: 1319
diff changeset
357 return;
97000f8de201 [svn] - Added playlist-delete command.
nhjm449
parents: 1319
diff changeset
358 }
97000f8de201 [svn] - Added playlist-delete command.
nhjm449
parents: 1319
diff changeset
359
97000f8de201 [svn] - Added playlist-delete command.
nhjm449
parents: 1319
diff changeset
360 xmms_remote_playlist_delete(session, playpos - 1);
97000f8de201 [svn] - Added playlist-delete command.
nhjm449
parents: 1319
diff changeset
361 }
97000f8de201 [svn] - Added playlist-delete command.
nhjm449
parents: 1319
diff changeset
362
1200
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
363 void playlist_length(gint session, gint argc, gchar **argv)
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 gint i;
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 i = xmms_remote_get_playlist_length(session);
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 g_print("%d\n", i);
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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
372 void playlist_song(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
373 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
374 if (argc < 3)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
375 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
376 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
377 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
378 return;
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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
381 gint playpos = atoi(argv[2]);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
382
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
383 if (playpos < 1 || playpos > xmms_remote_get_playlist_length(session))
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 g_print("%s: invalid playlist position %d\n", argv[0], playpos);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
386 return;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
387 }
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 gchar *song = xmms_remote_get_playlist_title(session, playpos - 1);
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 g_print("%s\n", song);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
392 }
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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
395 void playlist_song_length(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
396 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
397 if (argc < 3)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
398 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
399 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
400 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
401 return;
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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
404 gint playpos = atoi(argv[2]);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
405
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
406 if (playpos < 1 || playpos > xmms_remote_get_playlist_length(session))
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 g_print("%s: invalid playlist position %d\n", argv[0], playpos);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
409 return;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
410 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
411
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
412 gint frames = xmms_remote_get_playlist_time(session, playpos - 1);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
413 gint length = frames / 1000;
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 g_print("%d:%.2d\n", length / 60, length % 60);
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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
418 void playlist_song_length_seconds(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
419 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
420 if (argc < 3)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
421 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
422 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
423 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
424 return;
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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
427 gint playpos = atoi(argv[2]);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
428
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
429 if (playpos < 1 || playpos > xmms_remote_get_playlist_length(session))
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
430 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
431 g_print("%s: invalid playlist position %d\n", argv[0], playpos);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
432 return;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
433 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
434
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
435 gint frames = xmms_remote_get_playlist_time(session, playpos - 1);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
436 gint length = frames / 1000;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
437
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
438 g_print("%d\n", length);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
439 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
440
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
441 void playlist_song_length_frames(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
442 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
443 if (argc < 3)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
444 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
445 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
446 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
447 return;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
448 }
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 gint playpos = atoi(argv[2]);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
451
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
452 if (playpos < 1 || playpos > xmms_remote_get_playlist_length(session))
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
453 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
454 g_print("%s: invalid playlist position %d\n", argv[0], playpos);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
455 return;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
456 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
457
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
458 gint frames = xmms_remote_get_playlist_time(session, playpos - 1);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
459
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
460 g_print("%d\n", frames);
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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
463 void playlist_display(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
464 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
465 gint i, ii, frames, length, total;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
466 gchar *songname;
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 i = xmms_remote_get_playlist_length(session);
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 g_print("%d tracks.\n", i);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
471
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
472 total = 0;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
473
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
474 for (ii = 0; ii < i; ii++)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
475 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
476 songname = xmms_remote_get_playlist_title(session, ii);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
477 frames = xmms_remote_get_playlist_time(session, ii);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
478 length = frames / 1000;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
479 total += length;
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 g_print("%4d | %-60s | %d:%.2d\n",
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
482 ii + 1, songname, length / 60, length % 60);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
483 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
484
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
485 g_print("Total length: %d:%.2d\n", total / 60, total % 60);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
486 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
487
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
488 void playlist_position(gint session, gint argc, gchar **argv)
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 gint i;
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 i = xmms_remote_get_playlist_pos(session);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
493
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
494 g_print("%d\n", i + 1);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
495 }
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 void playlist_song_filename(gint session, gint argc, gchar **argv)
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 gint i;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
500
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
501 if (argc < 3)
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 g_print("%s: invalid parameters for playlist-filename.\n", argv[0]);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
504 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
505 return;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
506 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
507
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
508 i = atoi(argv[2]);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
509
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
510 if (i < 1 || i > xmms_remote_get_playlist_length(session))
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 g_print("%s: invalid playlist position %d\n", argv[0], i);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
513 return;
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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
516 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
517 }
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 void playlist_jump(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
520 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
521 gint i;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
522
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
523 if (argc < 3)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
524 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
525 g_print("%s: invalid parameters for playlist-jump.\n", argv[0]);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
526 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
527 return;
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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
530 i = atoi(argv[2]);
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 if (i < 1 || i > xmms_remote_get_playlist_length(session))
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 g_print("%s: invalid playlist position %d\n", argv[0], i);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
535 return;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
536 }
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 xmms_remote_set_playlist_pos(session, i - 1);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
539 }
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 void playlist_clear(gint session, gint argc, gchar **argv)
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 xmms_remote_playlist_clear(session);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
544 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
545
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
546 void playlist_repeat_status(gint session, gint argc, gchar **argv)
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 if (xmms_remote_is_repeat(session))
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
549 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
550 g_print("on\n");
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
551 return;
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 else
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 g_print("off\n");
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
556 return;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
557 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
558 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
559
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
560 void playlist_repeat_toggle(gint session, gint argc, gchar **argv)
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 xmms_remote_toggle_repeat(session);
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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
565 void playlist_shuffle_status(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
566 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
567 if (xmms_remote_is_shuffle(session))
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 g_print("on\n");
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
570 return;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
571 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
572 else
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
573 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
574 g_print("off\n");
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
575 return;
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 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
578
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
579 void playlist_shuffle_toggle(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
580 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
581 xmms_remote_toggle_shuffle(session);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
582 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
583
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
584 void playqueue_add(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
585 {
1204
76e6b66fb859 [svn] - compiles warningless inside the audacious buildsystem now
nenolod
parents: 1203
diff changeset
586 gint i;
1200
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
587
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
588 if (argc < 3)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
589 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
590 g_print("%s: invalid parameters for playqueue-add.\n", argv[0]);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
591 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
592 return;
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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
595 i = atoi(argv[2]);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
596
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
597 if (i < 1 || i > xmms_remote_get_playlist_length(session))
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 g_print("%s: invalid playlist position %d\n", argv[0], i);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
600 return;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
601 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
602
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
603 if (!(xmms_remote_playqueue_is_queued(session, i - 1)))
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
604 xmms_remote_playqueue_add(session, i - 1);
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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
607 void playqueue_remove(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
608 {
1204
76e6b66fb859 [svn] - compiles warningless inside the audacious buildsystem now
nenolod
parents: 1203
diff changeset
609 gint i;
1200
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
610
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
611 if (argc < 3)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
612 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
613 g_print("%s: invalid parameters for playqueue-remove.\n", argv[0]);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
614 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
615 return;
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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
618 i = atoi(argv[2]);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
619
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
620 if (i < 1 || i > xmms_remote_get_playlist_length(session))
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 g_print("%s: invalid playlist position %d\n", argv[0], i);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
623 return;
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 if (xmms_remote_playqueue_is_queued(session, i - 1))
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
627 xmms_remote_playqueue_remove(session, i - 1);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
628 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
629
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
630 void playqueue_is_queued(gint session, gint argc, gchar **argv)
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 gint i;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
633
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
634 if (argc < 3)
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 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
637 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
638 return;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
639 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
640
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
641 i = atoi(argv[2]);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
642
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
643 if (i < 1 || i > xmms_remote_get_playlist_length(session))
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
644 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
645 g_print("%s: invalid playlist position %d\n", argv[0], i);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
646 return;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
647 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
648
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
649 exit(!(xmms_remote_playqueue_is_queued(session, i - 1)));
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
650 }
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 void playqueue_get_position(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
653 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
654 gint i, pos;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
655
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
656 if (argc < 3)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
657 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
658 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
659 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
660 return;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
661 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
662
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
663 i = atoi(argv[2]);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
664
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
665 if (i < 1 || i > xmms_remote_get_playlist_length(session))
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
666 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
667 g_print("%s: invalid playlist position %d\n", argv[0], i);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
668 return;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
669 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
670
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
671 pos = xmms_remote_get_playqueue_position(session, i - 1) + 1;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
672
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
673 if (pos < 1)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
674 return;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
675
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
676 g_print("%d\n", pos);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
677 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
678
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
679 void playqueue_get_qposition(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
680 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
681 gint i, pos;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
682
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
683 if (argc < 3)
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 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
686 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
687 return;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
688 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
689
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
690 i = atoi(argv[2]);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
691
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
692 if (i < 1 || i > xmms_remote_get_playqueue_length(session))
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
693 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
694 g_print("%s: invalid playlist position %d\n", argv[0], i);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
695 return;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
696 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
697
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
698 pos = xmms_remote_get_playqueue_queue_position(session, i - 1) + 1;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
699
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
700 if (pos < 1)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
701 return;
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("%d\n", pos);
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_display(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, ii, position, frames, length, total;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
709 gchar *songname;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
710
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
711 i = xmms_remote_get_playqueue_length(session);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
712
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
713 g_print("%d queued tracks.\n", i);
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 total = 0;
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 for (ii = 0; ii < i; ii++)
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 position = xmms_remote_get_playqueue_queue_position(session, ii);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
720 songname = xmms_remote_get_playlist_title(session, position);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
721 frames = xmms_remote_get_playlist_time(session, position);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
722 length = frames / 1000;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
723 total += length;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
724
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
725 g_print("%4d | %4d | %-60s | %d:%.2d\n",
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
726 ii + 1, position + 1, songname, length / 60, length % 60);
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 g_print("Total length: %d:%.2d\n", total / 60, total % 60);
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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
732 void playqueue_length(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
733 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
734 gint i;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
735
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
736 i = xmms_remote_get_playqueue_length(session);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
737
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
738 g_print("%d\n", i);
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
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
741 void playqueue_clear(gint session, gint argc, gchar **argv)
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 xmms_remote_playqueue_clear(session);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
744 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
745
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
746 void get_volume(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
747 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
748 gint i;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
749
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
750 i = xmms_remote_get_main_volume(session);
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 g_print("%d\n", 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 set_volume(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 gint i, current_volume;
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 if (argc < 3)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
760 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
761 g_print("%s: invalid parameters for set-volume.\n", argv[0]);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
762 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
763 return;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
764 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
765
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
766 current_volume = xmms_remote_get_main_volume(session);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
767 switch (argv[2][0])
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 case '+':
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
770 case '-':
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
771 i = current_volume + atoi(argv[2]);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
772 break;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
773 default:
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
774 i = atoi(argv[2]);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
775 break;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
776 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
777
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
778 xmms_remote_set_main_volume(session, i);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
779 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
780
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
781 void show_preferences_window(gint session, gint argc, gchar **argv)
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 xmms_remote_show_prefs_box(session);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
784 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
785
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
786 void show_jtf_window(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
787 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
788 xmms_remote_show_jtf_box(session);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
789 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
790
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
791 void shutdown_audacious_server(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
792 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
793 xmms_remote_quit(session);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
794 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
795
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
796 void get_handlers_list(gint session, gint argc, gchar **argv)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
797 {
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
798 gint i;
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
799
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
800 for (i = 0; handlers[i].name != NULL; i++)
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
801 {
1203
a09393433f83 [svn] - OMKize Makefile (examples not installed yet)
nenolod
parents: 1200
diff changeset
802 if (!g_strcasecmp("<sep>", handlers[i].name))
1316
276cc2ce63b7 [svn] - category titles
nenolod
parents: 1225
diff changeset
803 g_print("%s%s:\n", i == 0 ? "" : "\n", handlers[i].desc);
1200
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
804 else
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
805 g_print(" %-34s - %s\n", handlers[i].name, handlers[i].desc);
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
806 }
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
807
6af3f8fb2ed0 [svn] - prepare to ship audtool with audacious SVN
nenolod
parents:
diff changeset
808 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
809 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
810 }