Friday, January 19, 2007

ImageMagick, command line thumbnails and more

Part of the security camera feature of our system is to take a snapshot of motion in a zone. The snapshot is then shown on our camera control page, showing the last 10 events captured. To ease the loading of these images across the Internet, I needed to automatically generate thumbnails of the pictures. I found an image manipulation package called ImageMagick that has just what I need.

I call one of their apps, convert, from a perl script (in this case, resizing the image to 25% of its original size):

convert -sample 25%x25% image_in.jpg image_out.jpg

Thursday, January 18, 2007

Checking Gmail with xAP Mail Monitor

xAP Mail Monitor can't authenticate over SSL, so by itself it can't check Gmail. Like the previous post, Stunnel can fix that. I changed my stunnel.conf file as follows:

accept =
connect =

I had to leave the POP3 port as 110 since you can't specify the port in Mail Monitor. Re-start Stunnel and start Mail Monitor. Add the account by clicking File > Properties and selecting "Mailbox and Logins" under "Mail Monitor Configuration." Add an address, setting email address to, mail server as localhost, login username your_gmail_address and set your Gmail password. That's it.

This will also work with most other mail apps that need SSL support. Just fill out the POP settings as above.

Wednesday, January 17, 2007

Command line emailing via Gmail's POP3 interface

Gmail has a POP3 interface which lets you use your own email client. This opens up a lot of possibilities. One thing I use a lot is the command line email tool Blat, but it can't deal with Gmail's SSL requirement. That's where Stunnel comes in. It will wrap the TCP connections from Blat inside SSL.

After installing Stunnel, edit the config file stunnel.conf. I made the following changes:

; Use it for client mode
client = yes

accept =
connect =

Save the changes and start Stunnel. This makes it look like you have an SMTP server running on your local machine at port 465. Next, just point blat to this local smtp server.

blat -install 1 465 - your_user_name your_password

That's it. You can now send email from scripts and batch files using Gmail's SMTP server.

You can also point other mail apps to this port if they don't support SSL for sending mail.

Wednesday, January 10, 2007

Slim Devices rocks!

I found a deal on an original Slim Devices Squeezebox ($10!!!), but it had a broken screen and IR receiver. I contacted Slim Devices' tech support to see if they offered replacements. I had fully expected them to charge for the parts. Instead, they offered the IR daughterboard and screen assembly for free! Since their office is nearby, I was able to drive over during lunch and pick up the parts. I have to say, that is amazing customer support!

Now, I've got 2 fully functional Squeezebox 1s to go along with 2 of the original SliMP3s.

Tuesday, January 9, 2007

Script to create playlists of VOB files

We have a D-Link DSM-320 media player and we use TVersity as its media server. We use it mainly to watch movies across our network. One thing we can do is watch the original VOB files ripped from a DVD, but the problem is there are multiple VOB files for a movie and after each one ends, the next one has to be manually started. (You can merge to VOBs into one, but the DSM-320 has a 4GB file limit.) One solution is to create a playlist for each movie, containing all movie's VOB files.

I wrote this Perl script to do just that. (It is similar to the script I wrote to auto-generate music playlists.) It traverses a directory and creates playlists for all subdirectories containing VOB files.

Just set $path (source) and $dest (playlist directory) in the script and then run it. It assumes the folder containing the VOBs will be named after the movie and it uses that folder name as the playlist name.

Wednesday, January 3, 2007

Using RRDtool to graph CPU temps

I mentioned that I use RRDtool to chart temperatures of my server components. RRDtool works on Windows and Linux.

I'm using Speedfan to monitor temps, and I wrote a perl script to parse the Speedfan logfile, extract the data I want and run RRDtool to update the database and create these graphs:

48 hours




Click here for my sample perl script.