What file is playing under xmms

Here's a simple program that determines what file is playing under xmms. Short, sweet and to the point. You need the xmms headers and libintl, but apart form those it should compile just dandily (big ifs of course).
#include <sys/types.h>
#include <xmmsctrl.h>
#include <glib.h>
#include <stdio.h>

int
main(int argc, char \*\*argv)
{
        gint session = 0;
        gchar \*file;
        gint pos;

        if (xmms_remote_get_version(session) == 0) {
                return (0);
        }

        pos = xmms_remote_get_playlist_pos(session);

        file = xmms_remote_get_playlist_file(session, pos);
        if (file != NULL) {
                printf("%s\\n", file);
        }
}
Comments:

I did something similar in python a while ago thought you might be interested. #!/usr/bin/env python import xmms try: isplaying = xmms.is_playing() except: isplaying = 0 if isplaying: print xmms.get_playlist_title(xmms.get_playlist_pos()) else: print "Not playing"

Posted by john on February 04, 2005 at 04:20 AM GMT #

Post a Comment:
Comments are closed for this entry.
About

petesh

Search

Archives
« March 2015
MonTueWedThuFriSatSun
      
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
     
Today