Wednesday, November 15, 2006

Stability issues w/ xlobby

I've been busy at work so I haven't had much time to play around. I've been fighting some stability issues and it seems to be related to xlobby and most likely the xAP plugin. One thing I have changed is in starCOM, I'm issuing xPL messages for every X10/AI/DI/timer/flag change. This was mainly to keep Floorplan in sync with sC. Those xPL messages also get converted to xAP by Floorplan and must be killing the xAP plugin for xlobby. It is already known to have memory leak issues and the large increase in xAP traffic must be causing it problems. So for now, xlobby is no longer running on my system. It's been 2 days since I shut it down and things are much more stable.

On a side note, one of the case fans in my HA server seems to have died. I have two fans in the front of the case blowing air over 3 of the 4 HDs in the system, and this morning one of them was squealing like crazy so I had to take it offline. The server is in our office and it turned out to be the warmest room in the house, so I need to make an extra effort to keep things in the server cool.

I monitor the drive temps in the system and graph them over time. The cooler they are the less likely they are to fail. Here's what the graphs look like (I'll talk about how I make them in a later post):

Wednesday, November 8, 2006

Voice controlled music players

Lately I've been contemplating how to voice control our audio players. The VR part will be HAL. The link from HAL will be scripts that issue xPL commands to the Rio Receivers and SliMP3s/Squeezebox. I will write a script to build the voice commands for playlists/artists/etc, but I have two options to use. I can build them into HAL tasks using my scripts, or build the commands into Tell Me, a HALi app. I think it might be easier to build and update the Tell Me database, but I'm not sure how stable the app is.

One of the problems I'm grappling with will be the size of the command database. I won't be voice activating every artist/album/track/playlist/genre, just the ones we use the most. With 7 players, we have 7 zones and I can easily see the number of voice commands exploding ("Play Metallica in the garage", "Play Metallica in the family room", etc). If I have 1000 playlists/albums/artists then there would be 7000 recognition phrases, but this would be the easiest to generate and requires no logic at all. Which would make it perfect to put in Tell Me, but would it bog down with that many commands?

Or, I can create some tasks to set a zone ("Set zone to garage", etc.) and then issue the play command ("Play Angels & Airwaves"). Then, I'd have 7 zone commands and 1000 playlist/album/artist commands. That's a lot less, but I'd need to keep track of the zone for the subsequent play command. That seems like it would be better suited for HAL since Tell Me can't access variables, and the zone would probably be stored in a variable. However, HAL cannot issue shell commands with variables as parameters, so I would need to link to starCOM via HALi and have sC issue the commands to the music players.

Decisions, decisions... I need to spend some time experimenting with Tell Me.

Monday, November 6, 2006

Perl script to autogenerate playlists from mp3s

I wrote this perl script to autogenerate playlist files (.m3u) for each CD we have. Some servers don't play the songs in CD order, but they will with a playlist.

# assumes mp3 directory structure of g:/mp3/artist/album/tracks.mp3
# generates playlist of format: g:/m3u/artist-album.m3u


opendir(ARTIST, $mp3dir);
@dir = grep !/^\.\.?$/, readdir ARTIST;
foreach $artist (@dir) {
print "\nartist: $artist\n";
@album = grep !/^\.\.?$/, readdir ALBUM;

foreach $album (@album) {
print " album: $album\n";

@track=grep /\.mp3/,readdir TRACK;
foreach $track (@track) {
print " track: $track\n";
closedir TRACK;

# create playlist
$m3u_name=~s/\\ /_/g;
print " m3u: $m3u_name\n\n";
print A $playlist;
closedir ALBUM;

Sunday, November 5, 2006

xAPping my xPL stuff

I've been busy the past few days migrating my scripts from xPLHAL to xAP FLoorplan. Almost 3 years ago, I stumbled upon xPL while looking for an alternative server for our Rio Receivers. I've been using xPL heavily ever since with xPLHAL as my scripting engine. Lately, I've been finding lots of useful xAP applications and many of the xPL ones have become unsupported. Plus, lately I've been running into some crash/CPU utilization problems with xPLHAL. I started using Floorplan to do some scripting for xAP stuff and have slowly migrated some of my xPL stuff over. This weekend, I decided to just move it all over. No need to have 2 scripting engines bridging between the 2 protocols. Now it's just Floorplan.

I still use some xPL apps:
  • xPL Phone - There is no xAP equivalent for internal modems. there is only support for serial modems.
  • xPL command line sender - The xAP one seems slow and this one is more intuitive to me. I'll just rely on floorplan to translate to xAP if I need to send xAP.
  • xPL support in SlimServer - This is rock solid and I don't want swap it out yet. Plus, since I contributed some code changes in this to SlimServer, I have a pretty good understanding how it works and can tweak it if I want.
  • xPL ActiveX object - I can instantiate this in starCOM so I don't have to call the command line sender ( xPL = new ActiveXObject("xPL.xPLCtl"); ). There is no xAP equivalent.
  • MediaNet - It has built in xPL support that works great. I'm not giving up MediaNet.
  • xPL TTS - I haven't played around the xAP one but this has been solid so don't need to switch it out.
I just finished the last of the script conversions this morning and turned off xPLHAL.

Friday, November 3, 2006

xAP Ping script

I use xAP Ping to monitor my servers. I also have it monitor my network enabled amp. Since the amp sits in a closed cabinet, it can build up heat while it's running. To help with ventilation, I put a PC case fan into the cabinet and have that turn on when the amp is powered on. This amp doesn't have switched outlets on it, so I can't rely on that to power up the fan.

' pingamp.txt
Sub Main()
ping=xap.getfromraw(rawmessage, "ping.results,ping_amp")
if GetGlobal("PingAmp") <> "Fail" and ping = "Fail" then
' this is my starCOM task to turn on X10 devices
ExecuteX10Appl "AmpFan",0
SetGlobal "PingAmp", ping
elseif GetGlobal("PingAmp") <> "Success" and ping = "Success" then
ExecuteX10Appl "AmpFan",1
SetGlobal "PingAmp", ping
end if
End Sub

Create a Floorplan raw device for Ping:
  • alias = Amp
  • source =
  • class = ping.status
  • section = ping.results
  • item = ping_amp
  • script to run on update = pingamp

Don't forget to create a device called ping_amp in xAP Ping.

Thursday, November 2, 2006

First attempt at integrating HALi & starCOM

I recently found out that in HAL, I cannot pass variable names as arguments to launching a program. Yet more limitations! To get around this, I'm calling HALi from sC:

// instantiate hali object
var HAL = new ActiveXObject("HALiContol.HAli");
while(HAL.Init()==false) {

Then when I need to launch something, I have HAL execute a VBScript calling sC and setting a flag. Then sC goes in a grabs the info it needs:

function Devices::FlagUpdate(Index) {
with (Devices.Flags) {
case dsOn:
if (Item(Index).Name=="HALFlag") {
HALZone = HAL.Sensors.ItemByName("ZONE").State;
HALPlaylist = HAL.Sensors.ItemByName("PLAYLIST").State;
ShellCmd.Run("perl " + HALZone + " " + HALPlaylist);