2 * collectd - src/xmms.c
3 * Copyright (C) 2007 Florian octo Forster
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; only version 2 of the License is applicable.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 * Florian octo Forster <octo at verplant.org>
26 #include <xmms/xmmsctrl.h>
28 static gint xmms_session;
30 static void cxmms_submit (const char *type, gauge_t value)
33 value_list_t vl = VALUE_LIST_INIT;
35 values[0].gauge = value;
39 sstrncpy (vl.host, hostname_g, sizeof (vl.host));
40 sstrncpy (vl.plugin, "xmms", sizeof (vl.plugin));
41 sstrncpy (vl.type, type, sizeof (vl.type));
43 plugin_dispatch_values (&vl);
44 } /* void cxmms_submit */
52 if (!xmms_remote_is_running (xmms_session))
55 xmms_remote_get_info (xmms_session, &rate, &freq, &nch);
57 if ((freq == 0) || (nch == 0))
60 cxmms_submit ("bitrate", rate);
61 cxmms_submit ("frequency", freq);
66 void module_register (void)
68 plugin_register_read ("xmms", cxmms_read);
69 } /* void module_register */
72 * vim: shiftwidth=2:softtabstop=2:textwidth=78