/* $Id$ * $URL$ * * XMMS-Plugin for LCD4Linux * Copyright (C) 2003 Markus Keil * * 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. * */ /* * exported functions: * * int plugin_init_xmms (void) * adds parser for /tmp/xmms-info * */ /* * 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 "config.h" #include #include #include #include "hash.h" #include "debug.h" #include "plugin.h" static HASH xmms; static int parse_xmms_info(void) { int age; FILE *xmms_stream; char zeile[200]; /* reread every 100msec only */ age = hash_age(&xmms, NULL); if (age >= 0 && age <= 200) return 0; /* Open Filestream for '/tmp/xmms-info' */ xmms_stream = fopen("/tmp/xmms-info", "r"); /* Check for File */ if (!xmms_stream) { error("Error: Cannot open XMMS-Info Stream! Is XMMS started?"); return -1; } /* Read Lines from the Stream */ while (fgets(zeile, sizeof(zeile), xmms_stream)) { char *c, *key, *val; c = strchr(zeile, ':'); if (c == NULL) continue; key = zeile; val = c + 1; /* strip leading blanks from key */ while (isspace(*key)) *key++ = '\0'; /* strip trailing blanks from key */ do *c = '\0'; while (isspace(*--c)); /* strip leading blanks from value */ while (isspace(*val)) *val++ = '\0'; /* strip trailing blanks from value */ for (c = val; *c != '\0'; c++); while (isspace(*--c)) *c = '\0'; hash_put(&xmms, key, val); } fclose(xmms_stream); return 0; } static void my_xmms(RESULT * result, RESULT * arg1) { char *key, *val; if (parse_xmms_info() < 0) { SetResult(&result, R_STRING, ""); return; } key = R2S(arg1); val = hash_get(&xmms, key, NULL); if (val == NULL) val = ""; SetResult(&result, R_STRING, val); } int plugin_init_xmms(void) { hash_create(&xmms); /* register xmms info */ AddFunction("xmms", 1, my_xmms); return 0; } void plugin_exit_xmms(void) { hash_destroy(&xmms); } t'> added serdisplib driver 2005-05-08[lcd4linux @ 2005-05-08 04:32:43 by reinelt]reinelt94-15305/+16121 CodingStyle added and applied 2005-05-06[lcd4linux @ 2005-05-06 06:41:53 by reinelt]reinelt1-1/+1 python2.4 added to python.m4 2005-05-06[lcd4linux @ 2005-05-06 06:37:34 by reinelt]reinelt3-31/+112 hollow bar patch from geronet 2005-05-06[lcd4linux @ 2005-05-06 05:40:02 by reinelt]reinelt20-2167/+0 remove documentation pass#2 2005-05-06[lcd4linux @ 2005-05-06 05:36:58 by reinelt]reinelt6-238/+0 removed documentation again :-( 2005-05-05[lcd4linux @ 2005-05-05 08:36:12 by reinelt]reinelt6-15/+34 changed SELECT to SLCTIN 2005-05-04[lcd4linux @ 2005-05-04 07:18:44 by obconseil]obconseil1-36/+84 Driver modified according to Michels's recommendations : - Suppressed linux/parport.h depandancy. It was not needed anyway. - Compile-time disable the wait_busy polling function, replaced with a time wait. - Replaced the hardwire_* calls by their wire_* equivalent, to adapt other wirings. - Created a "Models" structure, containing parameters for the display. - Other cleanups, to remove compile-time warnings. 2005-05-04[lcd4linux @ 2005-05-04 06:13:05 by reinelt]reinelt2-12/+77 parport_wire_status() added 2005-05-04[lcd4linux @ 2005-05-04 05:42:37 by reinelt]reinelt7-23/+398 Noritake driver added 2005-05-04[lcd4linux @ 2005-05-04 05:22:12 by reinelt]reinelt1-28/+31 * replaced fprintf(stderr,... with error() * corrected a "dangling reference" memory problem * removed some PyErr_Print() spam * fixed a segmentation fault that occured when python module was not found * improved error messages 2005-05-03[lcd4linux @ 2005-05-03 11:13:23 by reinelt]reinelt6-30/+122 rearranged autoconf a bit, libX11 will be linked only if really needed (i.e. when the X11 driver has been selected) plugin_python filled with life 2005-05-02[lcd4linux @ 2005-05-02 10:29:20 by reinelt]reinelt9-30/+636 preparations for python bindings and python plugin 2005-05-02[lcd4linux @ 2005-05-02 05:15:46 by reinelt]reinelt4-9/+51 make busy-flag checking configurable for LCD-Linux driver 2005-04-30[lcd4linux @ 2005-04-30 06:02:09 by reinelt]reinelt3-15/+44 LCD-Linux display size set up from lcd4linux.conf 2005-04-24[lcd4linux @ 2005-04-24 05:27:09 by reinelt]reinelt2-7/+38 Trefon Backlight added 2005-04-24[lcd4linux @ 2005-04-24 04:41:28 by reinelt]reinelt1-0/+68 Changelog updated 2005-04-24[lcd4linux @ 2005-04-24 04:33:46 by reinelt]reinelt9-10/+444 driver for TREFON USB LCD's added 2005-04-20[lcd4linux @ 2005-04-20 05:49:21 by reinelt]reinelt1-44/+125 Changed the code to add some VT100-compatible control sequences (see the comments above). A configfile boolean option 'VT100_Support' (default to 1) indicate if the display in used support these control-sequences or not. 2005-04-09[lcd4linux @ 2005-04-09 07:36:42 by reinelt]reinelt2-17/+99 updated LCD-Linux driver to version 0.8.8 2005-04-05[lcd4linux @ 2005-04-05 06:57:39 by reinelt]reinelt3-34/+34 AC_CHECK_HEADERS corrected 2005-04-05[lcd4linux @ 2005-04-05 05:12:48 by reinelt]reinelt4-407/+33 i2c patch from Paul (still does not work here :-( 2005-04-05[lcd4linux @ 2005-04-05 04:46:06 by reinelt]reinelt1-1/+20 ceil/floor patch from Maxime 2005-04-04[lcd4linux @ 2005-04-04 20:11:14 by nicowallmeier]nicowallmeier1-2/+6 to be compatible with gcc 2.95 2005-04-03[lcd4linux @ 2005-04-03 07:07:43 by reinelt]reinelt8-9/+152 added statfs plugin 2005-04-02[lcd4linux @ 2005-04-02 05:28:58 by reinelt]reinelt3-19/+27 fixed gcc4 warnings about signed/unsigned mismatches 2005-04-01[lcd4linux @ 2005-04-01 05:16:04 by reinelt]reinelt5-584/+694 moved plugin init stuff to a seperate function called on first use 2005-03-30[lcd4linux @ 2005-03-30 04:57:50 by reinelt]reinelt3-23/+67 Evaluator speedup: use bsearch for finding functions and variables 2005-03-28[lcd4linux @ 2005-03-28 22:29:23 by reinelt]reinelt1-250/+346 HD44780 multiple displays patch from geronet 2005-03-28[lcd4linux @ 2005-03-28 19:39:14 by reinelt]reinelt9-256/+1147 HD44780/I2C patch from Luis merged (still does not work for me) 2005-03-25[lcd4linux @ 2005-03-25 15:44:43 by reinelt]reinelt1-2/+5 HD44780 Backlight fixed (thanks to geronet) 2005-03-23[lcd4linux @ 2005-03-23 12:23:35 by reinelt]reinelt1-27/+32 fixed some signed/unsigned char mismatches in the Crystalfontz driver (ticket #12) 2005-02-24[lcd4linux @ 2005-02-24 07:07:55 by reinelt]reinelt1-0/+53 ChangeLog 2005-02-24[lcd4linux @ 2005-02-24 07:06:45 by reinelt]reinelt11-28/+347 SimpleLCD driver added 2005-02-24[lcd4linux @ 2005-02-24 06:51:40 by reinelt]reinelt1-4/+5 LCD-Linux driver GOTO_COST corrected 2005-01-30[lcd4linux @ 2005-01-30 06:43:22 by reinelt]reinelt4-69/+95 driver for LCD-Linux finished 2005-01-29[lcd4linux @ 2005-01-29 09:30:56 by reinelt]reinelt1-8/+11 minor HD44780 cleanups 2005-01-22[lcd4linux @ 2005-01-22 22:57:57 by reinelt]reinelt9-47/+382 LCD-Linux driver added 2005-01-22[lcd4linux @ 2005-01-22 12:44:41 by reinelt]reinelt1-3/+6 MatrixOrbital backlight micro-fix 2005-01-18[lcd4linux @ 2005-01-18 06:30:21 by reinelt]reinelt89-261/+603 added (C) to all copyright statements 2005-01-17[lcd4linux @ 2005-01-17 06:38:48 by reinelt]reinelt1-1/+6 info about backlight and brightness 2005-01-17[lcd4linux @ 2005-01-17 06:29:24 by reinelt]reinelt3-33/+85 added software-controlled backlight support to HD44780