Dangerous Prototypes

Other projects => Past projects => #twatch network LCD backpack => Topic started by: andrew on February 06, 2010, 01:38:55 am

Title: Winamp Status on Twatch (via Python)
Post by: andrew on February 06, 2010, 01:38:55 am
Thread title is pretty self explanitory.
After not being able to find a virtual serial port to get LCD Smartie to work, I decided to have a go at writing my own code to do it.

The bulk of the program is the winamp IPC junk that I stole via google. (Link to original is in source).

It's pretty basic at the moment, but I thought people might like to see. I've got some speakers in my lounge room driven by my computer (long wires), this lets me know what's playing.

It shows artist on row 1, title on row 2, and a test string on row 3. Long stuff scrolls at a rate proportional to its length. The winamp code has hooks to add a play/pause indication, times, and a bunch more. It can also control winamp, but that's not really applicable to this application (unless there's a way to add buttons to the twatch, then it would be).


You'll proably need Python 2.6, and you will need pywin32 (http://http://sourceforge.net/projects/pywin32/files/). I'm running Python 2.6.4, pywin 214, and winamp 5.572.

{Attachment renamed to .txt for forum rules compliance, change it back to .py when you download}

TODOs:
make scrolling more robust
port to Python 3
Title: Re: Winamp Status on Twatch (via Python)
Post by: ian on February 06, 2010, 09:18:35 am
Great job. Thanks! I'll add this to the SVN scripts folder, and post it up in a few day.
Title: Re: Winamp Status on Twatch (via Python)
Post by: andrew on February 06, 2010, 04:31:22 pm
Couple of minor tweaks
- replaced a nasty magic number (20) with its constant (TWATCH_X)
- better scrolling timer method (I think. It's 2:30am, I haven't tested thoroughly)

I'll have a look at this whole SVN thing once I've had some sleep :)
Title: Re: Winamp Status on Twatch (via Python)
Post by: ian on February 10, 2010, 08:38:12 am
Hi andrew - Is it possible to get a picture of your script in action? Thanks!

( ! ) Fatal error: Uncaught exception 'Elk_Exception' with message 'Please try again. If you come back to this error screen, report the error to an administrator.' in /var/www/dangerousprototypes/forum/sources/database/Db-mysql.class.php on line 696
( ! ) Elk_Exception: Please try again. If you come back to this error screen, report the error to an administrator. in /var/www/dangerousprototypes/forum/sources/database/Db-mysql.class.php on line 696
Call Stack
#TimeMemoryFunctionLocation
10.00962061296session_write_close ( )...(null):0
20.00992192888ElkArte\sources\subs\SessionHandler\DatabaseHandler->write( )...(null):0
30.00992193664Database_MySQL->query( ).../DatabaseHandler.php:119
40.05672332392Database_MySQL->error( ).../Db-mysql.class.php:273