Thursday February 03, 2005
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);
}
}
February 03, 2005 03:27 PM GMT
Permalink
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"
Post a Comment:
Comments are closed for this entry.