/* xmms-tool.c * Print minimal info about current song playing in xmms. * Inspired by XMMS-Announcer, but the output is designed to be parsed * by a script, not human read. * Compile with "gcc -o xmms-tool `glib-config --cflags` -lxmms xmms-tool.c" */ #include #include int main(int argc, char *argv[]) { int session = 0; int pos = -1; int songposition = -1; int songlength = -1; char *file; char *title; gint rate, freq, nch; if ( xmms_remote_is_running(session) == 0) { printf("XMMS is not currently running.\n"); return 10; } else { pos = xmms_remote_get_playlist_pos(session); file = xmms_remote_get_playlist_file(session, pos); title = xmms_remote_get_playlist_title(session, pos); songposition = xmms_remote_get_output_time(session); songlength = xmms_remote_get_playlist_time(session, pos); xmms_remote_get_info(session, &rate, &freq, &nch); printf("%s;%s;%d;%d;%d;", file, title, songposition, songlength, rate); if ( xmms_remote_is_playing(session) == 0 ) { printf("stopped"); } else if ( xmms_remote_is_paused(session) == 1 ) { printf("paused"); } else { printf("playing"); } printf("\n"); return 0; } }