diff options
-rw-r--r-- | Makefile.am | 1 | ||||
-rw-r--r-- | Makefile.in | 15 | ||||
-rw-r--r-- | plugin.c | 7 | ||||
-rw-r--r-- | plugin_xmms.c | 104 |
4 files changed, 119 insertions, 8 deletions
diff --git a/Makefile.am b/Makefile.am index 42e82ce..76dfc64 100644 --- a/Makefile.am +++ b/Makefile.am @@ -21,6 +21,7 @@ evaluator.c evaluator.h \ plugin.c plugin.h \ plugin_math.c \ plugin_string.c \ +plugin_xmms.c \ system.c system.h \ isdn.c isdn.h \ wifi.c wifi.h \ diff --git a/Makefile.in b/Makefile.in index 25c32fb..18a9643 100644 --- a/Makefile.in +++ b/Makefile.in @@ -101,7 +101,7 @@ AM_CFLAGS = $(X_CFLAGS) -D_GNU_SOURCE -Wall lcd4linux_LDFLAGS = $(X_LIBS) lcd4linux_LDADD = liblcd4linux.la @DRVLIBS@ -lcd4linux_SOURCES = lcd4linux.c pid.c pid.h parser.c parser.h processor.c processor.h evaluator.c evaluator.h plugin.c plugin.h plugin_math.c plugin_string.c system.c system.h isdn.c isdn.h wifi.c wifi.h mail.c mail.h seti.c seti.h battery.c battery.h dvb.c dvb.h filter.c filter.h widget.c widget.h exec.c exec.h mail2.c socket.c socket.h imon.c imon.h +lcd4linux_SOURCES = lcd4linux.c pid.c pid.h parser.c parser.h processor.c processor.h evaluator.c evaluator.h plugin.c plugin.h plugin_math.c plugin_string.c plugin_xmms.c system.c system.h isdn.c isdn.h wifi.c wifi.h mail.c mail.h seti.c seti.h battery.c battery.h dvb.c dvb.h filter.c filter.h widget.c widget.h exec.c exec.h mail2.c socket.c socket.h imon.c imon.h liblcd4linux_la_DEPENDENCIES = @DRIVERS@ @@ -138,10 +138,11 @@ PROGRAMS = $(bin_PROGRAMS) lcd4linux_OBJECTS = lcd4linux.$(OBJEXT) pid.$(OBJEXT) parser.$(OBJEXT) \ processor.$(OBJEXT) evaluator.$(OBJEXT) plugin.$(OBJEXT) \ -plugin_math.$(OBJEXT) plugin_string.$(OBJEXT) system.$(OBJEXT) \ -isdn.$(OBJEXT) wifi.$(OBJEXT) mail.$(OBJEXT) seti.$(OBJEXT) \ -battery.$(OBJEXT) dvb.$(OBJEXT) filter.$(OBJEXT) widget.$(OBJEXT) \ -exec.$(OBJEXT) mail2.$(OBJEXT) socket.$(OBJEXT) imon.$(OBJEXT) +plugin_math.$(OBJEXT) plugin_string.$(OBJEXT) plugin_xmms.$(OBJEXT) \ +system.$(OBJEXT) isdn.$(OBJEXT) wifi.$(OBJEXT) mail.$(OBJEXT) \ +seti.$(OBJEXT) battery.$(OBJEXT) dvb.$(OBJEXT) filter.$(OBJEXT) \ +widget.$(OBJEXT) exec.$(OBJEXT) mail2.$(OBJEXT) socket.$(OBJEXT) \ +imon.$(OBJEXT) lcd4linux_DEPENDENCIES = liblcd4linux.la CFLAGS = @CFLAGS@ COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) @@ -168,8 +169,8 @@ DEP_FILES = .deps/BeckmannEgle.P .deps/Crystalfontz.P .deps/Cwlinux.P \ .deps/lcd4linux.P .deps/lock.P .deps/mail.P .deps/mail2.P \ .deps/parport.P .deps/parser.P .deps/pid.P .deps/pixmap.P \ .deps/plugin.P .deps/plugin_math.P .deps/plugin_string.P \ -.deps/processor.P .deps/seti.P .deps/socket.P .deps/system.P \ -.deps/udelay.P .deps/widget.P .deps/wifi.P +.deps/plugin_xmms.P .deps/processor.P .deps/seti.P .deps/socket.P \ +.deps/system.P .deps/udelay.P .deps/widget.P .deps/wifi.P SOURCES = $(liblcd4linux_la_SOURCES) $(lcd4linux_SOURCES) $(EXTRA_lcd4linux_SOURCES) OBJECTS = $(liblcd4linux_la_OBJECTS) $(lcd4linux_OBJECTS) @@ -1,4 +1,4 @@ -/* $Id: plugin.c,v 1.2 2003/12/19 05:49:23 reinelt Exp $ +/* $Id: plugin.c,v 1.3 2003/12/19 06:27:33 reinelt Exp $ * * plugin handler for the Evaluator * @@ -22,6 +22,9 @@ * * * $Log: plugin.c,v $ + * Revision 1.3 2003/12/19 06:27:33 reinelt + * added XMMS plugin from Markus Keil + * * Revision 1.2 2003/12/19 05:49:23 reinelt * extracted plugin_math and plugin_string into extra files * @@ -66,6 +69,7 @@ int plugin_init_math (void); int plugin_init_string (void); +int plugin_init_xmms (void); int plugin_init (void) @@ -73,6 +77,7 @@ int plugin_init (void) // math plugin plugin_init_math(); plugin_init_string(); + plugin_init_xmms(); return 0; diff --git a/plugin_xmms.c b/plugin_xmms.c new file mode 100644 index 0000000..72d2438 --- /dev/null +++ b/plugin_xmms.c @@ -0,0 +1,104 @@ +/* $Id: plugin_xmms.c,v 1.1 2003/12/19 06:27:33 reinelt Exp $ + * + * XMMS-Plugin for LCD4Linux + * written by Markus Keil <markus_keil@t-online.de> + * + * This file is part of LCD4Linux. + * + * LCD4Linux is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * LCD4Linux is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * + * $Log: plugin_xmms.c,v $ + * Revision 1.1 2003/12/19 06:27:33 reinelt + * added XMMS plugin from Markus Keil + * + */ + +/* + * exported functions: + * + * int plugin_init_xmms (void) + * adds parser for /tmp/xmms-info + * + */ + + +/* + * + * ATTENTION: This is a convert of my Plugin that i wrote in C++! It might by very buggy! + * + * The Argument 'arg1' must be one of these Things (without brackets): + * + * 'Title' - The title of the current song + * 'Status' - The status of XMMS (playing, pause, ...) + * 'Tunes in playlist' - How many entries are in the playlist + * 'Currently playing' - which playlist-entry is playing + * 'uSecPosition' - The position of the title in seconds (usefull for bargraphs ;-) ) + * 'Position' - The position of the title in mm:ss + * 'uSecTime' - The length of the current title in seconds + * 'Time' - The length of the current title in mm:ss + * 'Current bitrate' - The current bitrate in bit + * 'Samping Frequency' - The current samplingfreqency in Hz + * 'Channels' - The current number of audiochannels + * 'File' - The full path of the current file + * + * These arguments are case-sensitive + */ + + +#include <string.h> +#include <stdio.h> + +#include "debug.h" +#include "plugin.h" + +static void my_xmms (RESULT *result, RESULT *arg1) +{ + FILE *xmms; + char zeile[200]; + char *key=R2S(arg1); + int len=strlen(key); + + //Open Filestream for '/tmp/xmms-info' + xmms = fopen("/tmp/xmms-info","r"); + + //Check for File + if( !xmms ) { + error("Error: Cannot open XMMS-Info Stream! Is XMMS started?"); + SetResult(&result, R_STRING, ""); + return; + } + + //Read Lines from the Stream + while(fgets(zeile,200,xmms)) { + if (strncmp(key, zeile, len)==0 && zeile[len]==':') { + // remove trailing newline + zeile[strlen(zeile)-1]='\0'; + SetResult(&result, R_STRING, zeile+len+2); + return; + } + } + SetResult(&result, R_STRING, ""); +} + + +int plugin_init_xmms (void) +{ + + // register xmms info + AddFunction ("xmms", 1, my_xmms); + + return 0; +} |