Mercurial > audlegacy
annotate src/audtool/audtool_handlers_vitals.c @ 4451:539f3cb7b1e8
Fix relative paths in construct_uri() function. (Bugzilla #246)
author | Paul Marks <paul@pmarks.net> |
---|---|
date | Sat, 12 Apr 2008 23:06:54 -0500 |
parents | ea194fd79267 |
children | 0a2255b9e80b |
rev | line source |
---|---|
2926
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
1 /* |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
2 * Audtool2 |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
3 * Copyright (c) 2007 Audacious development team |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
4 * |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
5 * Redistribution and use in source and binary forms, with or without |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
6 * modification, are permitted provided that the following conditions are |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
7 * met: |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
8 * |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
9 * 1. Redistributions of source code must retain the above copyright notice, |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
10 * this list of conditions and the following disclaimer. |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
11 * |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
12 * 2. Redistributions in binary form must reproduce the above copyright |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
13 * notice, this list of conditions and the following disclaimer in the |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
14 * documentation and/or other materials provided with the distribution. |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
15 * |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
16 * 3. The name of the author may not be used to endorse or promote products |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
17 * derived from this software without specific prior written permission. |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
18 * |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
22 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
23 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
25 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
27 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
28 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
29 * POSSIBILITY OF SUCH DAMAGE. |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
30 */ |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
31 |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
32 #include <stdlib.h> |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
33 #include <string.h> |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
34 #include <glib.h> |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
35 #include <mowgli.h> |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
36 #include <locale.h> |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
37 #include "libaudclient/audctrl.h" |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
38 #include "audtool.h" |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
39 |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
40 void get_current_song(gint argc, gchar **argv) |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
41 { |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
42 gint playpos = audacious_remote_get_playlist_pos(dbus_proxy); |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
43 gchar *song = audacious_remote_get_playlist_title(dbus_proxy, playpos); |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
44 |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
45 if (!song) |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
46 { |
2931
b36261c942f8
Transition to audtool_report()/audtool_whine().
William Pitcock <nenolod@atheme.org>
parents:
2926
diff
changeset
|
47 audtool_report("No song playing."); |
2926
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
48 return; |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
49 } |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
50 |
2931
b36261c942f8
Transition to audtool_report()/audtool_whine().
William Pitcock <nenolod@atheme.org>
parents:
2926
diff
changeset
|
51 audtool_report("%s", song); |
2926
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
52 } |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
53 |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
54 void get_current_song_filename(gint argc, gchar **argv) |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
55 { |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
56 gint playpos = audacious_remote_get_playlist_pos(dbus_proxy); |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
57 gchar *file = audacious_remote_get_playlist_file(dbus_proxy, playpos); |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
58 |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
59 if (!file) |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
60 { |
2931
b36261c942f8
Transition to audtool_report()/audtool_whine().
William Pitcock <nenolod@atheme.org>
parents:
2926
diff
changeset
|
61 audtool_report("No song playing."); |
2926
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
62 return; |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
63 } |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
64 |
2931
b36261c942f8
Transition to audtool_report()/audtool_whine().
William Pitcock <nenolod@atheme.org>
parents:
2926
diff
changeset
|
65 audtool_report("%s", file); |
2926
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
66 } |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
67 |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
68 void get_current_song_output_length(gint argc, gchar **argv) |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
69 { |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
70 gint frames = audacious_remote_get_output_time(dbus_proxy); |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
71 gint length = frames / 1000; |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
72 |
2931
b36261c942f8
Transition to audtool_report()/audtool_whine().
William Pitcock <nenolod@atheme.org>
parents:
2926
diff
changeset
|
73 audtool_report("%d:%.2d", length / 60, length % 60); |
2926
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
74 } |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
75 |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
76 void get_current_song_output_length_seconds(gint argc, gchar **argv) |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
77 { |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
78 gint frames = audacious_remote_get_output_time(dbus_proxy); |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
79 gint length = frames / 1000; |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
80 |
2931
b36261c942f8
Transition to audtool_report()/audtool_whine().
William Pitcock <nenolod@atheme.org>
parents:
2926
diff
changeset
|
81 audtool_report("%d", length); |
2926
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
82 } |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
83 |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
84 void get_current_song_output_length_frames(gint argc, gchar **argv) |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
85 { |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
86 gint frames = audacious_remote_get_output_time(dbus_proxy); |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
87 |
2931
b36261c942f8
Transition to audtool_report()/audtool_whine().
William Pitcock <nenolod@atheme.org>
parents:
2926
diff
changeset
|
88 audtool_report("%d", frames); |
2926
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
89 } |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
90 |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
91 void get_current_song_length(gint argc, gchar **argv) |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
92 { |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
93 gint playpos = audacious_remote_get_playlist_pos(dbus_proxy); |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
94 gint frames = audacious_remote_get_playlist_time(dbus_proxy, playpos); |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
95 gint length = frames / 1000; |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
96 |
2931
b36261c942f8
Transition to audtool_report()/audtool_whine().
William Pitcock <nenolod@atheme.org>
parents:
2926
diff
changeset
|
97 audtool_report("%d:%.2d", length / 60, length % 60); |
2926
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
98 } |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
99 |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
100 void get_current_song_length_seconds(gint argc, gchar **argv) |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
101 { |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
102 gint playpos = audacious_remote_get_playlist_pos(dbus_proxy); |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
103 gint frames = audacious_remote_get_playlist_time(dbus_proxy, playpos); |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
104 gint length = frames / 1000; |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
105 |
2931
b36261c942f8
Transition to audtool_report()/audtool_whine().
William Pitcock <nenolod@atheme.org>
parents:
2926
diff
changeset
|
106 audtool_report("%d", length); |
2926
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
107 } |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
108 |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
109 void get_current_song_length_frames(gint argc, gchar **argv) |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
110 { |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
111 gint playpos = audacious_remote_get_playlist_pos(dbus_proxy); |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
112 gint frames = audacious_remote_get_playlist_time(dbus_proxy, playpos); |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
113 |
2931
b36261c942f8
Transition to audtool_report()/audtool_whine().
William Pitcock <nenolod@atheme.org>
parents:
2926
diff
changeset
|
114 audtool_report("%d", frames); |
2926
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
115 } |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
116 |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
117 void get_current_song_bitrate(gint argc, gchar **argv) |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
118 { |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
119 gint rate, freq, nch; |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
120 |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
121 audacious_remote_get_info(dbus_proxy, &rate, &freq, &nch); |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
122 |
2931
b36261c942f8
Transition to audtool_report()/audtool_whine().
William Pitcock <nenolod@atheme.org>
parents:
2926
diff
changeset
|
123 audtool_report("%d", rate); |
2926
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
124 } |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
125 |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
126 void get_current_song_bitrate_kbps(gint argc, gchar **argv) |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
127 { |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
128 gint rate, freq, nch; |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
129 |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
130 audacious_remote_get_info(dbus_proxy, &rate, &freq, &nch); |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
131 |
2931
b36261c942f8
Transition to audtool_report()/audtool_whine().
William Pitcock <nenolod@atheme.org>
parents:
2926
diff
changeset
|
132 audtool_report("%d", rate / 1000); |
2926
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
133 } |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
134 |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
135 void get_current_song_frequency(gint argc, gchar **argv) |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
136 { |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
137 gint rate, freq, nch; |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
138 |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
139 audacious_remote_get_info(dbus_proxy, &rate, &freq, &nch); |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
140 |
2931
b36261c942f8
Transition to audtool_report()/audtool_whine().
William Pitcock <nenolod@atheme.org>
parents:
2926
diff
changeset
|
141 audtool_report("%d", freq); |
2926
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
142 } |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
143 |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
144 void get_current_song_frequency_khz(gint argc, gchar **argv) |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
145 { |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
146 gint rate, freq, nch; |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
147 |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
148 audacious_remote_get_info(dbus_proxy, &rate, &freq, &nch); |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
149 |
2931
b36261c942f8
Transition to audtool_report()/audtool_whine().
William Pitcock <nenolod@atheme.org>
parents:
2926
diff
changeset
|
150 audtool_report("%0.1f", (gfloat) freq / 1000); |
2926
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
151 } |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
152 |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
153 void get_current_song_channels(gint argc, gchar **argv) |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
154 { |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
155 gint rate, freq, nch; |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
156 |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
157 audacious_remote_get_info(dbus_proxy, &rate, &freq, &nch); |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
158 |
2931
b36261c942f8
Transition to audtool_report()/audtool_whine().
William Pitcock <nenolod@atheme.org>
parents:
2926
diff
changeset
|
159 audtool_report("%d", nch); |
2926
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
160 } |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
161 |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
162 void get_current_song_tuple_field_data(gint argc, gchar **argv) |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
163 { |
3902
1792ab581321
fix improper rendering of data
William Pitcock <nenolod@atheme.org>
parents:
3873
diff
changeset
|
164 gchar *data; |
2926
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
165 |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
166 if (argc < 2) |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
167 { |
2931
b36261c942f8
Transition to audtool_report()/audtool_whine().
William Pitcock <nenolod@atheme.org>
parents:
2926
diff
changeset
|
168 audtool_whine("invalid parameters for %s.", argv[0]); |
b36261c942f8
Transition to audtool_report()/audtool_whine().
William Pitcock <nenolod@atheme.org>
parents:
2926
diff
changeset
|
169 audtool_whine("syntax: %s <fieldname>", argv[0]); |
3903
134cc28dc468
update tuple field suggestions
William Pitcock <nenolod@atheme.org>
parents:
3902
diff
changeset
|
170 audtool_whine(" - fieldname example choices include but are not limited to:"); |
134cc28dc468
update tuple field suggestions
William Pitcock <nenolod@atheme.org>
parents:
3902
diff
changeset
|
171 audtool_whine(" artist, album, title, track_number, year, date,"); |
134cc28dc468
update tuple field suggestions
William Pitcock <nenolod@atheme.org>
parents:
3902
diff
changeset
|
172 audtool_whine(" genre, comment, file_name, file_ext, file_path,"); |
134cc28dc468
update tuple field suggestions
William Pitcock <nenolod@atheme.org>
parents:
3902
diff
changeset
|
173 audtool_whine(" length, formatter, custom, mtime"); |
3873
f3341c2d6b9e
audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2939
diff
changeset
|
174 exit(1); |
2926
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
175 } |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
176 |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
177 if (!(data = audacious_get_tuple_field_data(dbus_proxy, argv[1], audacious_remote_get_playlist_pos(dbus_proxy)))) |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
178 { |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
179 return; |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
180 } |
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
181 |
3902
1792ab581321
fix improper rendering of data
William Pitcock <nenolod@atheme.org>
parents:
3873
diff
changeset
|
182 audtool_report("%s", data); |
2926
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
183 |
3902
1792ab581321
fix improper rendering of data
William Pitcock <nenolod@atheme.org>
parents:
3873
diff
changeset
|
184 g_free(data); |
2926
f5ce83fdbf3e
Split out vital information category into seperate source file.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
185 } |
4074 | 186 |
187 void get_current_song_info(gint argc, gchar **argv) | |
188 { | |
189 gint rate, freq, nch; | |
190 | |
191 audacious_remote_get_info(dbus_proxy, &rate, &freq, &nch); | |
192 audtool_report("rate = %d freq = %d nch = %d", rate, freq, nch); | |
193 } | |
194 |