<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Christopher Kampmeier&#039;s Blog</title>
	<atom:link href="http://kampmeier.com/chris/blog/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://kampmeier.com/chris/blog</link>
	<description>Home Projects and Genealogy</description>
	<lastBuildDate>Mon, 09 Jul 2012 01:59:56 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.2</generator>
		<item>
		<title>QNAP TS-119P II and NFS</title>
		<link>http://kampmeier.com/chris/blog/?p=804</link>
		<comments>http://kampmeier.com/chris/blog/?p=804#comments</comments>
		<pubDate>Mon, 09 Jul 2012 01:55:24 +0000</pubDate>
		<dc:creator>ckamps</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://kampmeier.com/chris/blog/?p=804</guid>
		<description><![CDATA[I recently upgraded our relatively old QNAP TS-109 Pro NAS server to their newer TS-119P II model. Although I&#8217;ve encountered severe issues with Q-RAID 1 on the 119, I&#8217;ll cover that topic in another post. In this post I wanted to address a tweak to how our Ubuntu server is mounting NFS shares from the [...]]]></description>
			<content:encoded><![CDATA[<p>I recently upgraded our relatively old QNAP TS-109 Pro NAS server to their newer TS-119P II model. Although I&#8217;ve encountered severe issues with Q-RAID 1 on the 119, I&#8217;ll cover that topic in another post.  In this post I wanted to address a tweak to how our Ubuntu server is mounting NFS shares from the TS-119.  Previously, the client&#8217;s /etc/fstab had entries along these lines:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">network-disk:/share/HDA_DATA/photos &nbsp; &nbsp; /mnt/network-disk/photos &nbsp; &nbsp; nfs _netdev,defaults 0 0</div></div>
<p>However, I noticed recently that the wrong share for the NFS server would get mounted on the client.  Getting the wrong share mapped to a local mountpoint really messed up the operation of apps on the client. </p>
<p>While I didn&#8217;t find this exact problem being discussed, I noticed that some people have been taking a slightly different approach to specifying the NFS shares:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">network-disk:/photos &nbsp; &nbsp; /mnt/network-disk/photos &nbsp; &nbsp; nfs _netdev,defaults 0 0</div></div>
<p>Note the absence of the &#8220;/share/HDA_DATA&#8221; portion of the share name.  Since I had not attempted this approach for quite some time, I thought I&#8217;d try it.  </p>
<p>So far, so good. I&#8217;ll report back if this approach as fixed the issue. I also plan to update our Mac OS X clients to take this same approach. Simpler is better.</p>
]]></content:encoded>
			<wfw:commentRss>http://kampmeier.com/chris/blog/?feed=rss2&#038;p=804</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>2013 Facelift B8 Avant Tails: Wiring Fog Lights</title>
		<link>http://kampmeier.com/chris/blog/?p=772</link>
		<comments>http://kampmeier.com/chris/blog/?p=772#comments</comments>
		<pubDate>Wed, 02 May 2012 02:18:26 +0000</pubDate>
		<dc:creator>ckamps</dc:creator>
				<category><![CDATA[Car Stuff]]></category>

		<guid isPermaLink="false">http://kampmeier.com/chris/blog/?p=772</guid>
		<description><![CDATA[Last month I was able to get a new pair of euro 2013 facelift B8 Avant tail lights installed on my 2010 Avant s-line. With the help of Cory, Alex of Europrice and David, the research, ordering and coding was very smooth. Thanks to those guys for their help. This post addresses how I routed [...]]]></description>
			<content:encoded><![CDATA[<p>Last month I was able to get a new pair of euro 2013 facelift B8 Avant tail lights installed on my 2010 Avant s-line.  With the help of <a href="http://www.audizine.com/forum/member.php/39491-cory_can">Cory</a>, Alex of <a href="http://www.europrice.us/">Europrice</a> and <a href="http://audienthusiasts.com/">David</a>, the research, ordering and coding was very smooth.  Thanks to those guys for their help.</p>
<p>This post addresses how I routed the fog lights. After installation and coding, here are the very bright fog lights in action:</p>
<p><a href="http://kampmeier.com/chris/blog/wp-content/uploads/2012/05/IMG_6530.jpg"><img src="http://kampmeier.com/chris/blog/wp-content/uploads/2012/05/IMG_6530-300x225.jpg" alt="" title="IMG_6530" width="300" height="225" class="alignnone size-medium wp-image-786" /></a></p>
<p><span id="more-772"></span></p>
<p><strong>Removing Trim Parts</strong><br />
The instructions supplied by Europrice were very clear and sufficiently addressed how to remove the rear side interior trim panels to access the vents for routing an extra wire from each outer unit and to route the drivers side extra wire under the rear load trim section over to the passengers side and the BCM unit.</p>
<p>I had read in various forum posts about routing the extra wire from each outer unit through a grommet in the rear body panel, but using the body vents seemed to be a lot easier route that probably won&#8217;t have any adverse impact.</p>
<p>Several photos of routing the outer lights&#8217; extra wires through the body vents.<br />
<a href="http://kampmeier.com/chris/blog/wp-content/uploads/2012/04/IMG_6428.jpg"><img src="http://kampmeier.com/chris/blog/wp-content/uploads/2012/04/IMG_6428-300x225.jpg" alt="" title="IMG_6428" width="300" height="225" class="alignnone size-medium wp-image-740" /></a></p>
<p><a href="http://kampmeier.com/chris/blog/wp-content/uploads/2012/04/IMG_6427.jpg"><img src="http://kampmeier.com/chris/blog/wp-content/uploads/2012/04/IMG_6427-300x225.jpg" alt="" title="IMG_6427" width="300" height="225" class="alignnone size-medium wp-image-739" /></a></p>
<p>Two mistakes I made:</p>
<ol>
<li>I removed the metal sill protector trim even though it appears that I only needed to remove the underlying plastic part.</li>
<li>Since I did not wear gloves when removing the metal trim stip, I cut my finger. Doh!</li>
</ol>
<p>In the following photo, the metal sill protector is shown removed (ignore the blood).  I believe I could have just removed the entire black plastic still on the sill without removing the metal sill protector.</p>
<div id="attachment_777" class="wp-caption alignnone" style="width: 310px"><a href="http://kampmeier.com/chris/blog/wp-content/uploads/2012/05/IMG_6429.jpg"><img src="http://kampmeier.com/chris/blog/wp-content/uploads/2012/05/IMG_6429-300x225.jpg" alt="" title="IMG_6429" width="300" height="225" class="size-medium wp-image-777" /></a><p class="wp-caption-text">The sharp edged metal load protector </p></div>
<div id="attachment_743" class="wp-caption alignnone" style="width: 310px"><a href="http://kampmeier.com/chris/blog/wp-content/uploads/2012/04/IMG_6437.jpg"><img src="http://kampmeier.com/chris/blog/wp-content/uploads/2012/04/IMG_6437-300x225.jpg" alt="" title="IMG_6437" width="300" height="225" class="size-medium wp-image-743" /></a><p class="wp-caption-text">Routing outer left wire under sill trim</p></div>
<p>The underside of the load trim after I reinstalled the metal sill plate.</p>
<p><a href="http://kampmeier.com/chris/blog/wp-content/uploads/2012/05/IMG_6436.jpg"><img src="http://kampmeier.com/chris/blog/wp-content/uploads/2012/05/IMG_6436-300x225.jpg" alt="" title="IMG_6436" width="300" height="225" class="alignnone size-medium wp-image-779" /></a></p>
<p><strong>Fog Light Wires</strong><br />
Although wiring the fogs is optional and I am not often driving in conditions to warrant using the rear fog lights, I figured it would be best to ensure they worked and that I didn&#8217;t end up with a dead switch on the dash.</p>
<p>The good news is that removal of the rear hatch plastic trim and some additional trim pieces went off without a hitch.  As is often the case with interior trim removal, the lower rear hatch trim required quite a bit of force to remove it. Being relatively new to the disassembly process, I was pretty concerned about breaking parts.</p>
<p>I fished the longer of the two loose fog wires from the left side inner tail light area around the rear wiper motor and joined it up with the shorter loose wire on the right side.  Then I routed the two wires together along the existing wire harness running up the right side of the rear hatch. I was concerned about the skinny trim piece being able to cover the extra wires, but it worked fine.</p>
<div id="attachment_745" class="wp-caption alignnone" style="width: 310px"><a href="http://kampmeier.com/chris/blog/wp-content/uploads/2012/04/IMG_6439.jpg"><img src="http://kampmeier.com/chris/blog/wp-content/uploads/2012/04/IMG_6439-300x225.jpg" alt="" title="IMG_6439" width="300" height="225" class="size-medium wp-image-745" /></a><p class="wp-caption-text">Yellow wire is extra required for fog light</p></div>
<p><a href="http://kampmeier.com/chris/blog/wp-content/uploads/2012/04/IMG_6440.jpg"><img src="http://kampmeier.com/chris/blog/wp-content/uploads/2012/04/IMG_6440-300x225.jpg" alt="" title="IMG_6440" width="300" height="225" class="alignnone size-medium wp-image-746" /></a></p>
<p><a href="http://kampmeier.com/chris/blog/wp-content/uploads/2012/04/IMG_6441.jpg"><img src="http://kampmeier.com/chris/blog/wp-content/uploads/2012/04/IMG_6441-300x225.jpg" alt="" title="IMG_6441" width="300" height="225" class="alignnone size-medium wp-image-747" /></a></p>
<p><a href="http://kampmeier.com/chris/blog/wp-content/uploads/2012/04/IMG_6442.jpg"><img src="http://kampmeier.com/chris/blog/wp-content/uploads/2012/04/IMG_6442-300x225.jpg" alt="" title="IMG_6442" width="300" height="225" class="alignnone size-medium wp-image-748" /></a></p>
<p><a href="http://kampmeier.com/chris/blog/wp-content/uploads/2012/04/IMG_6443.jpg"><img src="http://kampmeier.com/chris/blog/wp-content/uploads/2012/04/IMG_6443-300x225.jpg" alt="" title="IMG_6443" width="300" height="225" class="alignnone size-medium wp-image-749" /></a></p>
<p>I didn&#8217;t have instructions for removing the next set of trim pieces, but it was relatively easy to figure out.  First, I popped off the trim from the right side hatch hinge.  Next, I determined that I needed to remove the lateral trim piece at the rearmost portion of the headliner.  This trim simply pops off from the rear.  Its removal exposes the rear hatch motors.</p>
<p>The following photo shows the lateral rear headliner trim removed, but it was taken during reinstallation of the trim. Note the yellow fog light wires already installed.</p>
<p><a href="http://kampmeier.com/chris/blog/wp-content/uploads/2012/04/IMG_6450.jpg"><img src="http://kampmeier.com/chris/blog/wp-content/uploads/2012/04/IMG_6450-300x225.jpg" alt="" title="IMG_6450" width="300" height="225" class="alignnone size-medium wp-image-756" /></a></p>
<p>Once this lateral trim is exposed, you&#8217;ll see a screw holding a portion of the D panel trim in place.  In addition to this screw, I believe I removed at least one, perhaps two, additional screws from the sides of the D panel trim such that I could bend the D panel trim and fish the wires back down to the BCM area where the connections are made. The nice part of this approach was that I did not need to remove the entire D panel.</p>
<p><a href="http://kampmeier.com/chris/blog/wp-content/uploads/2012/04/IMG_6444.jpg"><img src="http://kampmeier.com/chris/blog/wp-content/uploads/2012/04/IMG_6444-300x225.jpg" alt="" title="IMG_6444" width="300" height="225" class="alignnone size-medium wp-image-750" /></a></p>
<p><a href="http://kampmeier.com/chris/blog/wp-content/uploads/2012/04/IMG_6445.jpg"><img src="http://kampmeier.com/chris/blog/wp-content/uploads/2012/04/IMG_6445-300x225.jpg" alt="" title="IMG_6445" width="300" height="225" class="alignnone size-medium wp-image-751" /></a></p>
<p>The following photos are looking down on top of the partially removed D pillar trim.  The fog light wires are fished from left to right toward the BCM/fuse box location.</p>
<p><a href="http://kampmeier.com/chris/blog/wp-content/uploads/2012/04/IMG_6446.jpg"><img src="http://kampmeier.com/chris/blog/wp-content/uploads/2012/04/IMG_6446-300x225.jpg" alt="" title="IMG_6446" width="300" height="225" class="alignnone size-medium wp-image-752" /></a></p>
<p><a href="http://kampmeier.com/chris/blog/wp-content/uploads/2012/04/IMG_6447.jpg"><img src="http://kampmeier.com/chris/blog/wp-content/uploads/2012/04/IMG_6447-300x225.jpg" alt="" title="IMG_6447" width="300" height="225" class="alignnone size-medium wp-image-753" /></a></p>
<p><a href="http://kampmeier.com/chris/blog/wp-content/uploads/2012/04/IMG_6448.jpg"><img src="http://kampmeier.com/chris/blog/wp-content/uploads/2012/04/IMG_6448-300x225.jpg" alt="" title="IMG_6448" width="300" height="225" class="alignnone size-medium wp-image-754" /></a></p>
<p>The following photos show how I ran the fog light wires through the bottom legs of the large u-shaped hatch trim.<br />
<a href="http://kampmeier.com/chris/blog/wp-content/uploads/2012/04/IMG_6453.jpg"><img src="http://kampmeier.com/chris/blog/wp-content/uploads/2012/04/IMG_6453-300x225.jpg" alt="" title="IMG_6453" width="300" height="225" class="alignnone size-medium wp-image-759" /></a></p>
<p><a href="http://kampmeier.com/chris/blog/wp-content/uploads/2012/04/IMG_6451.jpg"><img src="http://kampmeier.com/chris/blog/wp-content/uploads/2012/04/IMG_6451-300x225.jpg" alt="" title="IMG_6451" width="300" height="225" class="alignnone size-medium wp-image-757" /></a></p>
<p><strong>Few More After Pics</strong></p>
<p>Very bright fogs!</p>
<p><a href="http://kampmeier.com/chris/blog/wp-content/uploads/2012/04/IMG_64661.jpg"><img src="http://kampmeier.com/chris/blog/wp-content/uploads/2012/04/IMG_64661-300x225.jpg" alt="" title="IMG_6466" width="300" height="225" class="alignnone size-medium wp-image-765" /></a></p>
<p>Close up of left fog:</p>
<p><a href="http://kampmeier.com/chris/blog/wp-content/uploads/2012/04/IMG_64671.jpg"><img src="http://kampmeier.com/chris/blog/wp-content/uploads/2012/04/IMG_64671-300x225.jpg" alt="" title="IMG_6467" width="300" height="225" class="alignnone size-medium wp-image-766" /></a></p>
<p>Running lights (David coded them to act as DRLs):</p>
<p><a href="http://kampmeier.com/chris/blog/wp-content/uploads/2012/04/IMG_64651.jpg"><img src="http://kampmeier.com/chris/blog/wp-content/uploads/2012/04/IMG_64651-300x225.jpg" alt="" title="IMG_6465" width="300" height="225" class="alignnone size-medium wp-image-764" /></a></p>
<p><a href="http://kampmeier.com/chris/blog/wp-content/uploads/2012/04/IMG_64641.jpg"><img src="http://kampmeier.com/chris/blog/wp-content/uploads/2012/04/IMG_64641-300x225.jpg" alt="" title="IMG_6464" width="300" height="225" class="alignnone size-medium wp-image-763" /></a></p>
<p><a href="http://kampmeier.com/chris/blog/wp-content/uploads/2012/04/IMG_64631.jpg"><img src="http://kampmeier.com/chris/blog/wp-content/uploads/2012/04/IMG_64631-300x225.jpg" alt="" title="IMG_6463" width="300" height="225" class="alignnone size-medium wp-image-762" /></a></p>
<p><a href="http://kampmeier.com/chris/blog/wp-content/uploads/2012/05/IMG_6534.jpg"><img src="http://kampmeier.com/chris/blog/wp-content/uploads/2012/05/IMG_6534-300x225.jpg" alt="" title="IMG_6534" width="300" height="225" class="alignnone size-medium wp-image-787" /></a></p>
<p>Colors are washed out, but turn signal (top), brake (middle) and running light:</p>
<p><a href="http://kampmeier.com/chris/blog/wp-content/uploads/2012/05/IMG_6538.jpg"><img src="http://kampmeier.com/chris/blog/wp-content/uploads/2012/05/IMG_6538-300x225.jpg" alt="" title="IMG_6538" width="300" height="225" class="alignnone size-medium wp-image-788" /></a></p>
<p>Brake, reverse and running lights:</p>
<p><a href="http://kampmeier.com/chris/blog/wp-content/uploads/2012/05/IMG_6540.jpg"><img src="http://kampmeier.com/chris/blog/wp-content/uploads/2012/05/IMG_6540-300x225.jpg" alt="" title="IMG_6540" width="300" height="225" class="alignnone size-medium wp-image-789" /></a></p>
<p><a href="http://kampmeier.com/chris/blog/wp-content/uploads/2012/05/IMG_6541.jpg"><img src="http://kampmeier.com/chris/blog/wp-content/uploads/2012/05/IMG_6541-300x225.jpg" alt="" title="IMG_6541" width="300" height="225" class="alignnone size-medium wp-image-790" /></a></p>
<p>Note reflector on inner portion of outer light unit. OEM 2010 US lights did not have this reflector.</p>
<p><a href="http://kampmeier.com/chris/blog/wp-content/uploads/2012/05/IMG_6545.jpg"><img src="http://kampmeier.com/chris/blog/wp-content/uploads/2012/05/IMG_6545-300x225.jpg" alt="" title="IMG_6545" width="300" height="225" class="alignnone size-medium wp-image-791" /></a></p>
<p>Man, I am really liking these lights!</p>
<p><a href="http://kampmeier.com/chris/blog/wp-content/uploads/2012/05/IMG_6551.jpg"><img src="http://kampmeier.com/chris/blog/wp-content/uploads/2012/05/IMG_6551-300x225.jpg" alt="" title="IMG_6551" width="300" height="225" class="alignnone size-medium wp-image-792" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://kampmeier.com/chris/blog/?feed=rss2&#038;p=772</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Announcing Current Weather Conditions</title>
		<link>http://kampmeier.com/chris/blog/?p=717</link>
		<comments>http://kampmeier.com/chris/blog/?p=717#comments</comments>
		<pubDate>Mon, 04 Jul 2011 16:35:04 +0000</pubDate>
		<dc:creator>ckamps</dc:creator>
				<category><![CDATA[Home Audio/Video]]></category>
		<category><![CDATA[Home Automation]]></category>
		<category><![CDATA[cepstral]]></category>
		<category><![CDATA[thermd]]></category>
		<category><![CDATA[TTS]]></category>
		<category><![CDATA[weather]]></category>

		<guid isPermaLink="false">http://kampmeier.com/chris/blog/?p=717</guid>
		<description><![CDATA[Last year I promised to post the scripts used to obtain and announce the current and forecasted weather conditions over our home speakers. We have a couple of key fobs in various locations of the house that can be used to trigger announcing of the current and forecasted weather conditions. Those key fobs use RF [...]]]></description>
			<content:encoded><![CDATA[<p>Last year I promised to post the scripts used to obtain and announce the <a href="http://kampmeier.com/chris/blog/?p=108">current and forecasted weather conditions</a> over our home speakers.  We have a couple of key fobs in various locations of the house that can be used to trigger announcing of the current and forecasted weather conditions.  Those key fobs use RF signals to trigger X-10 commands which are then used to execute the script below.  The Cepstral Text to Speech (TTS) utility is used to announce the current conditions and forecast over our home speakers.  Here&#8217;s an <a href="http://kampmeier.com/chris/blog/wp-content/uploads/2010/03/weather-conditions.wav">example of an announcement</a>.<img src="http://www.freewebs.com/pinkwall/weather_icon.jpg" alt="icon" align="right"/></p>
<p>Read more to see the Perl script.<br />
<span id="more-717"></span><br />
The Perl script is included below.  Overall, it relies on two source of current conditions data:</p>
<ul>
<li>Data obtained from a MySQL database populated by thermd.</li>
<li>Forecast data from the National Weather Service for our specific location.</li>
</ul>
<div class="codecolorer-container perl default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="perl codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">#!/usr/bin/perl</span><br />
<br />
<span style="color: #000000; font-weight: bold;">use</span> DBI<span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">use</span> POSIX <a href="http://perldoc.perl.org/functions/qw.html"><span style="color: #000066;">qw</span></a><span style="color: #009900;">&#40;</span>ceil<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">use</span> XML<span style="color: #339933;">::</span><span style="color: #006600;">Simple</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">use</span> LWP<span style="color: #339933;">::</span><span style="color: #006600;">Simple</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">use</span> Data<span style="color: #339933;">::</span><span style="color: #006600;">Dumper</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #0000ff;">$lockfile</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">'/tmp/lock.heyu.weather_conditions'</span><span style="color: #339933;">;</span><br />
<span style="color: #0000ff;">$beep</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">'/home/automate/audio/beep-1.wav'</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!-</span>e <span style="color: #0000ff;">$lockfile</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #ff0000;">`/usr/bin/touch $lockfile`</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #0000ff;">$db_host</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">'home-server'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">$db_database</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">'thermd'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">$db_user</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">'secret'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">$db_password</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">'secret'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">$dbh</span> <span style="color: #339933;">=</span> DBI<span style="color: #339933;">-&gt;</span><a href="http://perldoc.perl.org/functions/connect.html"><span style="color: #000066;">connect</span></a><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">'dbi:mysql:'</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">$db_database</span> <span style="color: #339933;">.</span> <span style="color: #ff0000;">';'</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">$db_host</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$db_user</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$db_password</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <a href="http://perldoc.perl.org/functions/die.html"><span style="color: #000066;">die</span></a> <span style="color: #ff0000;">&quot;connect error<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$text</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;&lt;audio src='$beep'&gt;&lt;break time='1s'/&gt;&lt;prosody volume='+20%' rate='.90'&gt;&quot;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$humidity_outside</span> &nbsp; &nbsp;<span style="color: #339933;">=</span> <span style="color: #0000ff;">$dbh</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">selectrow_array</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;SELECT value FROM current WHERE log_name = 'C1000000A68BCF26.1<span style="color: #000099; font-weight: bold;">\@</span>HA7Net'&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$temp_outside</span> &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #339933;">=</span> <span style="color: #0000ff;">$dbh</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">selectrow_array</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;SELECT value FROM current WHERE log_name = 'C1000000A68BCF26<span style="color: #000099; font-weight: bold;">\@</span>HA7Net'&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #0000ff;">$humidity_outside</span> &nbsp; &nbsp;<span style="color: #339933;">=</span> ceil <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$humidity_outside</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">$temp_outside</span> <span style="color: #339933;">=</span> &nbsp;ceil <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">9</span><span style="color: #339933;">/</span><span style="color: #cc66cc;">5</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> <span style="color: #0000ff;">$temp_outside</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #cc66cc;">32</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #0000ff;">$text</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$text</span> <span style="color: #339933;">.</span> <span style="color: #ff0000;">&quot;Outside temperature is $temp_outside degrees; humidity is $humidity_outside %.&lt;break strength='strong'/&gt;&quot;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$xmlcontent</span> <span style="color: #339933;">=</span> get<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;http://forecast.weather.gov/MapClick.php?lat=38.63300&amp;lon=-90.78300&amp;FcstType=dwml&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <a href="http://perldoc.perl.org/functions/die.html"><span style="color: #000066;">die</span></a> <span style="color: #ff0000;">&quot;Couldn't get it!&quot;</span> <span style="color: #b1b100;">unless</span> <a href="http://perldoc.perl.org/functions/defined.html"><span style="color: #000066;">defined</span></a> <span style="color: #0000ff;">$xmlcontent</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">$xmlcontent</span> <span style="color: #339933;">=~</span> <span style="color: #009966; font-style: italic;">s/&amp;/{amp}/g</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$xs</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> XML<span style="color: #339933;">::</span><span style="color: #006600;">Simple</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$ref</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$xs</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">XMLin</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$xmlcontent</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$period</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$forecast</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #0000ff;">$layout_key</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$ref</span><span style="color: #339933;">-&gt;</span><span style="color: #009900;">&#123;</span><span style="color: #ff0000;">'data'</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">-&gt;</span><span style="color: #009900;">&#123;</span><span style="color: #ff0000;">'parameters'</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">-&gt;</span><span style="color: #009900;">&#123;</span><span style="color: #ff0000;">'wordedForecast'</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">-&gt;</span><span style="color: #009900;">&#123;</span><span style="color: #ff0000;">'time-layout'</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$index</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #0000ff;">$index</span> <span style="color: #339933;">&lt;=</span> <span style="color: #0000ff;">$#</span><span style="color: #009900;">&#123;</span> <span style="color: #0000ff;">$ref</span><span style="color: #339933;">-&gt;</span><span style="color: #009900;">&#123;</span><span style="color: #ff0000;">'data'</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">-&gt;</span><span style="color: #009900;">&#123;</span><span style="color: #ff0000;">'time-layout'</span><span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span> <span style="color: #0000ff;">$index</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$ref</span><span style="color: #339933;">-&gt;</span><span style="color: #009900;">&#123;</span><span style="color: #ff0000;">'data'</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">-&gt;</span><span style="color: #009900;">&#123;</span><span style="color: #ff0000;">'time-layout'</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">-&gt;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">$index</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span><span style="color: #009900;">&#123;</span><span style="color: #ff0000;">'layout-key'</span><span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">eq</span> <span style="color: #0000ff;">$layout_key</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$time_layout_index</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$index</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">last</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$index</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #0000ff;">$index</span> <span style="color: #339933;">&lt;=</span> <span style="color: #cc66cc;">2</span><span style="color: #339933;">;</span> <span style="color: #0000ff;">$index</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$period</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$ref</span><span style="color: #339933;">-&gt;</span><span style="color: #009900;">&#123;</span><span style="color: #ff0000;">'data'</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">-&gt;</span><span style="color: #009900;">&#123;</span><span style="color: #ff0000;">'time-layout'</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">-&gt;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">$time_layout_index</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span><span style="color: #009900;">&#123;</span><span style="color: #ff0000;">'start-valid-time'</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">-&gt;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">$index</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span><span style="color: #009900;">&#123;</span><span style="color: #ff0000;">'period-name'</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$forecast</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$ref</span><span style="color: #339933;">-&gt;</span><span style="color: #009900;">&#123;</span><span style="color: #ff0000;">'data'</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">-&gt;</span><span style="color: #009900;">&#123;</span><span style="color: #ff0000;">'parameters'</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">-&gt;</span><span style="color: #009900;">&#123;</span><span style="color: #ff0000;">'wordedForecast'</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">-&gt;</span><span style="color: #009900;">&#123;</span><span style="color: #ff0000;">'text'</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">-&gt;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">$index</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$forecast</span> <span style="color: #339933;">=~</span> <span style="color: #009966; font-style: italic;">s/ mph/ miles per hour/g</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$forecast</span> <span style="color: #339933;">=~</span> <span style="color: #009966; font-style: italic;">s/ wind/ \&lt;phoneme ph='w ih1 n d'&gt;wind&lt;\/phoneme&gt;/g</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$text</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$text</span> <span style="color: #339933;">.</span> <span style="color: #ff0000;">&quot;Forecast for $period, &nbsp; $forecast &lt;break strength='strong'/&gt;&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">$text</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$text</span> <span style="color: #339933;">.</span> <span style="color: #ff0000;">&quot;Thank you for listening to this update.&lt;break strength='strong'/&gt;&lt;/prosody&gt;&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #ff0000;">`/usr/bin/aoss /usr/local/bin/swift &quot;$text&quot;`</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #ff0000;">`/bin/rm $lockfile`</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></div>
<p>You can also download the <a href="http://kampmeier.com/chris/files/audio-samples/beep-1.wav">attention getting beep</a> file.</p>
]]></content:encoded>
			<wfw:commentRss>http://kampmeier.com/chris/blog/?feed=rss2&#038;p=717</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://kampmeier.com/chris/blog/wp-content/uploads/2010/03/weather-conditions.wav" length="1268262" type="audio/wav" />
<enclosure url="http://kampmeier.com/chris/files/audio-samples/beep-1.wav" length="63128" type="audio/wav" />
		</item>
		<item>
		<title>Broadcasting Severe Weather Alerts Through Home Speakers</title>
		<link>http://kampmeier.com/chris/blog/?p=696</link>
		<comments>http://kampmeier.com/chris/blog/?p=696#comments</comments>
		<pubDate>Mon, 04 Jul 2011 16:04:34 +0000</pubDate>
		<dc:creator>ckamps</dc:creator>
				<category><![CDATA[Home Audio/Video]]></category>
		<category><![CDATA[Home Automation]]></category>
		<category><![CDATA[Home Monitoring]]></category>
		<category><![CDATA[cepstral]]></category>
		<category><![CDATA[TTS]]></category>
		<category><![CDATA[weather]]></category>

		<guid isPermaLink="false">http://kampmeier.com/chris/blog/?p=696</guid>
		<description><![CDATA[Last year I hacked away at some scripts to report on current weather conditions and to announce caller ID information through our home ceiling speakers.  I had also hacked away at an initial script to poll the US National Weather Service for severe weather alerts associated with our area. Although the severe weather alert script [...]]]></description>
			<content:encoded><![CDATA[<p>Last year I hacked away at some scripts to <a href="http://kampmeier.com/chris/blog/?p=108">report on current weather conditions</a> and to <a href="http://kampmeier.com/chris/blog/?p=177">announce caller ID information</a> through our home ceiling speakers.  I had also hacked away at an initial script to poll the US National Weather Service for severe weather alerts associated with our area.<br />
<img src="http://upload.wikimedia.org/wikipedia/commons/thumb/0/0d/Cloud_storm_icon.svg/113px-Cloud_storm_icon.svg.png" alt="tstorm" align="right"/><br />
Although the severe weather alert script seemed to be reliable, my family &#8211; including the dog &#8211; weren&#8217;t too pleased about hearing an emergency buzzer and alert broadcast every few minutes while a severe weather alert was in effect.  To keep the family and dog in harmony, I did some more hacking to:</p>
<ul>
<li>Announce the weather alert twice and then be quiet for a period of time</li>
<li>Override the quiet period when a more severe alert occurs</li>
</ul>
<p>I&#8217;ve also published the current source code for people to leverage.<br />
<span id="more-696"></span></p>
<h1>Updated Logic</h1>
<p>Here&#8217;s how the latest version of the script works:</p>
<ul>
<li>Given the <a href="http://alerts.weather.gov/cap/wwaatmget.php?x=MOC183">severe weather alert feed for our area</a>, it grabs the latest feed data.</li>
<li>Loops through all items in the feed looking for either thunderstorm or tornado warning alerts. Since we don&#8217;t care about bothering the occupants with watch announcements, we ignore feed entries for watches.</li>
<li>When it finds a warning alert of interest:
<ul>
<li>Check whether we think an alert is already in progress. We simply use two files in /tmp as flags.</li>
<li>If an alert was already seen, determine whether the previous alert needs to be downgraded or upgraded
<ul>
<li>If so, get rid of the old alert</li>
</ul>
</li>
<li>Else, check to see if the quiet interval (30 minutes for thunderstorm warning and 15 minutes for tornado warning) has elapsed
<ul>
<li>If quiet period has elapsed, get rid of the old warning alert</li>
<li>If the quiet time has not elapsed, exit the script</li>
</ul>
</li>
<li>Record the alert type for future reference (as a file in /tmp)</li>
<li>Build the alert text that will be read over the ceiling speakers
<ul>
<li>Note the tweaking for certain text strings.  These are done to improve the quality of the spoken announcement.  Through experience, we found that some edits made a big difference.</li>
</ul>
</li>
<li>Announce the alert twice</li>
</ul>
</li>
</ul>
<p>In addition to announcing the alert over our ceiling speakers, it would probably be useful to send a text message to our mobile phones.  For example, when we&#8217;re away from home, it would be useful to be alerted that our area is under threat.  Since we have other apps sending texts to our mobile phones, I can probably tackle that aspect with a few more minutes of hacking.</p>
<h1>The Script</h1>
<p>Since I am a Python newbie, don&#8217;t be too hard on me for the quality of the following script.</p>
<div class="codecolorer-container python default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="python codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #808080; font-style: italic;">#!/usr/bin/python</span><br />
<span style="color: #ff7700;font-weight:bold;">import</span> feedparser<br />
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">sys</span><br />
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">os</span><br />
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">time</span><br />
<br />
<span style="color: #808080; font-style: italic;"># amixer set Master 15</span><br />
<br />
beep <span style="color: #66cc66;">=</span> <span style="color: #483d8b;">'/home/automate/audio/beep-1.wav'</span><br />
warning_tone <span style="color: #66cc66;">=</span> <span style="color: #483d8b;">'/home/automate/audio/warningtone.wav'</span><br />
feed_url <span style="color: #66cc66;">=</span> <span style="color: #483d8b;">'http://alerts.weather.gov/cap/wwaatmget.php?x=MOC183'</span><br />
<br />
alert_tstorm <span style="color: #66cc66;">=</span> <span style="color: #483d8b;">'/tmp/weather.alert.tstorm'</span><br />
alert_tornado <span style="color: #66cc66;">=</span> <span style="color: #483d8b;">'/tmp/weather.alert.tornado'</span><br />
<br />
quiet_interval_tornado <span style="color: #66cc66;">=</span> <span style="color: #ff4500;">900</span><br />
quiet_interval_tstorm <span style="color: #66cc66;">=</span> <span style="color: #ff4500;">1800</span><br />
<br />
leadin <span style="color: #66cc66;">=</span> <span style="color: #483d8b;">'&lt;audio src=<span style="color: #000099; font-weight: bold;">\'</span>'</span> + beep + <span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\'</span>&gt;&lt;break time=<span style="color: #000099; font-weight: bold;">\'</span>1s<span style="color: #000099; font-weight: bold;">\'</span>/&gt;&lt;audio src=<span style="color: #000099; font-weight: bold;">\'</span>'</span> + warning_tone + <span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\'</span>&gt;'</span><br />
command <span style="color: #66cc66;">=</span> <span style="color: #483d8b;">'/usr/bin/aoss /usr/local/bin/swift'</span><br />
<br />
feed <span style="color: #66cc66;">=</span> feedparser.<span style="color: black;">parse</span><span style="color: black;">&#40;</span>feed_url<span style="color: black;">&#41;</span><br />
<span style="color: #ff7700;font-weight:bold;">for</span> item <span style="color: #ff7700;font-weight:bold;">in</span> feed.<span style="color: black;">entries</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">print</span> item.<span style="color: black;">title</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">print</span> item.<span style="color: black;">summary</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #483d8b;">'Tornado'</span> <span style="color: #ff7700;font-weight:bold;">in</span> item.<span style="color: black;">title</span> <span style="color: #ff7700;font-weight:bold;">or</span> <span style="color: #483d8b;">'Thunderstorm'</span> <span style="color: #ff7700;font-weight:bold;">in</span> item.<span style="color: black;">title</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #483d8b;">'Warning'</span> <span style="color: #ff7700;font-weight:bold;">in</span> item.<span style="color: black;">title</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">exists</span><span style="color: black;">&#40;</span>alert_tstorm<span style="color: black;">&#41;</span> <span style="color: #ff7700;font-weight:bold;">or</span> <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">exists</span><span style="color: black;">&#40;</span>alert_tornado<span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">exists</span><span style="color: black;">&#40;</span>alert_tstorm<span style="color: black;">&#41;</span> <span style="color: #ff7700;font-weight:bold;">and</span> <span style="color: #483d8b;">'Tornado'</span> <span style="color: #ff7700;font-weight:bold;">in</span> item.<span style="color: black;">title</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #dc143c;">os</span>.<span style="color: black;">remove</span><span style="color: black;">&#40;</span>alert_tstorm<span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">elif</span> <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">exists</span><span style="color: black;">&#40;</span>alert_tornado<span style="color: black;">&#41;</span> <span style="color: #ff7700;font-weight:bold;">and</span> <span style="color: #483d8b;">'Thunderstorm'</span> <span style="color: #ff7700;font-weight:bold;">in</span> item.<span style="color: black;">title</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #dc143c;">os</span>.<span style="color: black;">remove</span><span style="color: black;">&#40;</span>alert_tornado<span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">else</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">exists</span><span style="color: black;">&#40;</span>alert_tstorm<span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; alert <span style="color: #66cc66;">=</span> alert_tstorm<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; quiet_interval <span style="color: #66cc66;">=</span> quiet_interval_tstorm<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">else</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; alert <span style="color: #66cc66;">=</span> alert_tornado<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; quiet_interval <span style="color: #66cc66;">=</span> quiet_interval_tornado<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; current_time <span style="color: #66cc66;">=</span> <span style="color: #dc143c;">time</span>.<span style="color: black;">localtime</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; file_time <span style="color: #66cc66;">=</span> <span style="color: #dc143c;">time</span>.<span style="color: black;">localtime</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">getmtime</span><span style="color: black;">&#40;</span>alert<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; current_epoch<span style="color: #66cc66;">=</span><span style="color: #dc143c;">time</span>.<span style="color: black;">mktime</span><span style="color: black;">&#40;</span>current_time<span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; file_epoch <span style="color: #66cc66;">=</span> <span style="color: #dc143c;">time</span>.<span style="color: black;">mktime</span><span style="color: black;">&#40;</span>file_time<span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: black;">&#40;</span>current_epoch - file_epoch<span style="color: black;">&#41;</span> <span style="color: #66cc66;">&lt;</span> quiet_interval:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #dc143c;">sys</span>.<span style="color: black;">exit</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">else</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #dc143c;">os</span>.<span style="color: black;">remove</span><span style="color: black;">&#40;</span>alert<span style="color: black;">&#41;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #483d8b;">'Tornado'</span> <span style="color: #ff7700;font-weight:bold;">in</span> item.<span style="color: black;">title</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;alert <span style="color: #66cc66;">=</span> alert_tornado<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">else</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;alert <span style="color: #66cc66;">=</span> alert_tstorm<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; alert_file <span style="color: #66cc66;">=</span> <span style="color: #008000;">open</span><span style="color: black;">&#40;</span>alert<span style="color: #66cc66;">,</span> <span style="color: #483d8b;">'w'</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; alert_file.<span style="color: black;">close</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; index <span style="color: #66cc66;">=</span> item.<span style="color: black;">title</span>.<span style="color: black;">find</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;by NWS&quot;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; alert_title <span style="color: #66cc66;">=</span> &nbsp;item.<span style="color: black;">title</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span>:index<span style="color: black;">&#93;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; alert_title <span style="color: #66cc66;">=</span> alert_title.<span style="color: black;">replace</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'Warning'</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">'Warning &lt;break strength=<span style="color: #000099; font-weight: bold;">\'</span>strong<span style="color: #000099; font-weight: bold;">\'</span>/&gt;'</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; alert_title <span style="color: #66cc66;">=</span> alert_title.<span style="color: black;">replace</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'Watch'</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">'Watch &lt;break strength=<span style="color: #000099; font-weight: bold;">\'</span>strong<span style="color: #000099; font-weight: bold;">\'</span>/&gt;'</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; alert_title <span style="color: #66cc66;">=</span> alert_title.<span style="color: black;">replace</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'expiring'</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">'&lt;break strength=<span style="color: #000099; font-weight: bold;">\'</span>strong<span style="color: #000099; font-weight: bold;">\'</span>/&gt; expiring'</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; alert_title <span style="color: #66cc66;">=</span> alert_title.<span style="color: black;">replace</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'CDT'</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">''</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; alert_title <span style="color: #66cc66;">=</span> alert_title.<span style="color: black;">replace</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'CST'</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">''</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; alert_title <span style="color: #66cc66;">=</span> alert_title.<span style="color: black;">replace</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'PM'</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">' PM'</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; alert_title <span style="color: #66cc66;">=</span> alert_title.<span style="color: black;">replace</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'AM'</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">' AM'</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; alert_title <span style="color: #66cc66;">=</span> <span style="color: #483d8b;">'&lt;prosody volume=<span style="color: #000099; font-weight: bold;">\'</span>+30%<span style="color: #000099; font-weight: bold;">\'</span> rate=<span style="color: #000099; font-weight: bold;">\'</span>.80<span style="color: #000099; font-weight: bold;">\'</span>&gt;'</span> + <span style="color: #483d8b;">'Severe weather alert: &lt;break strength=<span style="color: #000099; font-weight: bold;">\'</span>strong<span style="color: #000099; font-weight: bold;">\'</span>/&gt; '</span> + alert_title + <span style="color: #483d8b;">'&lt;/prosody&gt;'</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; summary <span style="color: #66cc66;">=</span> item.<span style="color: black;">summary</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; summary <span style="color: #66cc66;">=</span> summary.<span style="color: black;">replace</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">' * '</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">''</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; summary <span style="color: #66cc66;">=</span> summary.<span style="color: black;">replace</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'...'</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">'&lt;break strength=<span style="color: #000099; font-weight: bold;">\'</span>strong<span style="color: #000099; font-weight: bold;">\'</span>/&gt;'</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; summary <span style="color: #66cc66;">=</span> summary.<span style="color: black;">replace</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'CDT'</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">''</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; summary <span style="color: #66cc66;">=</span> summary.<span style="color: black;">replace</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'CST'</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">''</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; summary <span style="color: #66cc66;">=</span> summary.<span style="color: black;">replace</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'PM'</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">' PM'</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; summary <span style="color: #66cc66;">=</span> summary.<span style="color: black;">replace</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'AM'</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">' AM'</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; summary <span style="color: #66cc66;">=</span> summary.<span style="color: black;">replace</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">' MO '</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">''</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; summary <span style="color: #66cc66;">=</span> summary.<span style="color: black;">replace</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">' LOCATIONS'</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">' LOCATIONS &lt;break strength=<span style="color: #000099; font-weight: bold;">\'</span>strong<span style="color: #000099; font-weight: bold;">\'</span>/&gt;'</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; summary <span style="color: #66cc66;">=</span> summary.<span style="color: black;">replace</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">' INCLUDED ARE'</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">' INCLUDED ARE &lt;break strength=<span style="color: #000099; font-weight: bold;">\'</span>strong<span style="color: #000099; font-weight: bold;">\'</span>/&gt;'</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; summary <span style="color: #66cc66;">=</span> <span style="color: #483d8b;">'&lt;prosody volume=<span style="color: #000099; font-weight: bold;">\'</span>+30%<span style="color: #000099; font-weight: bold;">\'</span> rate=<span style="color: #000099; font-weight: bold;">\'</span>.80<span style="color: #000099; font-weight: bold;">\'</span>&gt;'</span> + summary + <span style="color: #483d8b;">'&lt;break strength=<span style="color: #000099; font-weight: bold;">\'</span>strong<span style="color: #000099; font-weight: bold;">\'</span>/&gt;&lt;/prosody&gt;'</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">print</span> item.<span style="color: black;">title</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">print</span> item.<span style="color: black;">summary</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">for</span> i <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">range</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span><span style="color: #66cc66;">,</span> <span style="color: #ff4500;">3</span><span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #dc143c;">os</span>.<span style="color: black;">system</span><span style="color: black;">&#40;</span>command + <span style="color: #483d8b;">' &quot;'</span> + leadin + <span style="color: #483d8b;">'&quot;'</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #dc143c;">os</span>.<span style="color: black;">system</span><span style="color: black;">&#40;</span>command + <span style="color: #483d8b;">' &quot;'</span> + alert_title + <span style="color: #483d8b;">'&quot;'</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #dc143c;">os</span>.<span style="color: black;">system</span><span style="color: black;">&#40;</span>command + <span style="color: #483d8b;">' &quot;'</span> + summary + <span style="color: #483d8b;">'&quot;'</span><span style="color: black;">&#41;</span></div></div>
<p>And the associated crontab entry which calls the script to poll the NWS every two minutes:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">*/2 * * * * /home/automate/bin/weather-alerts.py &nbsp; &gt;/home/automate/crontab-weather-alerts.out 2&gt;/home/automate/crontab-weather-alerts.err</div></div>
<h1>The Ingredients</h1>
<p>There are two audio files representing the initial <a href="http://kampmeier.com/chris/files/audio-samples/beep-1.wav">attention getting beep</a> following by the <a href="http://kampmeier.com/chris/files/audio-samples/warningtone.wav">standard severe warning alert</a> sound.</p>
<p>As you&#8217;ll see in the script above, we&#8217;re using the swift command line tool from the Cepstral text-to-speech package.  See my earlier posts referenced above for more information on that package.</p>
]]></content:encoded>
			<wfw:commentRss>http://kampmeier.com/chris/blog/?feed=rss2&#038;p=696</wfw:commentRss>
		<slash:comments>4</slash:comments>
<enclosure url="http://kampmeier.com/chris/files/audio-samples/beep-1.wav" length="63128" type="audio/wav" />
<enclosure url="http://kampmeier.com/chris/files/audio-samples/warningtone.wav" length="2293244" type="audio/wav" />
		</item>
		<item>
		<title>Fun with EyeTV and AppleScript</title>
		<link>http://kampmeier.com/chris/blog/?p=451</link>
		<comments>http://kampmeier.com/chris/blog/?p=451#comments</comments>
		<pubDate>Sun, 27 Feb 2011 17:07:45 +0000</pubDate>
		<dc:creator>ckamps</dc:creator>
				<category><![CDATA[Home Audio/Video]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[AppleScript]]></category>
		<category><![CDATA[AppleTV]]></category>
		<category><![CDATA[DLNA]]></category>
		<category><![CDATA[EyeTV]]></category>
		<category><![CDATA[MacOS]]></category>
		<category><![CDATA[MediaTomb]]></category>
		<category><![CDATA[NAS]]></category>
		<category><![CDATA[QNAP]]></category>
		<category><![CDATA[UPnP]]></category>

		<guid isPermaLink="false">http://kampmeier.com/chris/blog/?p=451</guid>
		<description><![CDATA[Since we recently ditched satellite TV (the subject of another post), I bought an EyeTV One dongle for our iMac to record over the air (OTA) TV broadcasts. Fortunately, the St Louis metropolitan area has 16 or so OTA channels available. After trial and error, I was able to successfully automate the process of converting [...]]]></description>
			<content:encoded><![CDATA[<p>Since we recently ditched satellite TV (the subject of another post), I bought an <a href="http://www.elgato.com/elgato/na/mainmenu/products/EyeTV-One/product1.en.html">EyeTV One</a> dongle for our iMac to record <a href="http://en.wikipedia.org/wiki/Over-the-air_programming">over the air (OTA) TV broadcasts</a>. Fortunately, the St Louis metropolitan area has 16 or so OTA channels available. After trial and error, I was able to successfully automate the process of converting and publishing recorded shows such that various devices in our home can easily access the recordings. </p>
<p><a href="http://kampmeier.com/chris/blog/wp-content/uploads/2011/02/eyetvone_headgraphic_overview.jpg"><img class="alignnone size-medium wp-image-608" title="eyetvone_headgraphic_overview" src="http://kampmeier.com/chris/blog/wp-content/uploads/2011/02/eyetvone_headgraphic_overview-300x142.jpg" alt="" width="300" height="142" /></a></p>
<p><span id="more-451"></span></p>
<h1>Update</h1>
<p>Since we recently replaced our 24&#8243; iMac with a newer 27&#8243; model, I had to migrate EyeTV to the new system. In doing so, I encountered a few issues that my original instructions didn&#8217;t address.  These are:</p>
<ul>
<li><b>Hard disk name:</b> Our previous iMac had a hard drive name of &#8220;HDD&#8221;, but the standard name on Mac OS X is &#8220;Macinstosh HD&#8221;. Since the RecordingDone-called.scpt makes a reference to the hard disk, you might also need to make this adjustment. I&#8217;ve updated the code below to reflect the more standard name.</li>
<li><b>VLC:</b> This time around, I installed VLC for Mac.  I believe you will also need to do so in order to get the proper codecs installed.</li>
<li><b>EyeTV Archive folder:</b> By default, EyeTV appears to place it under your Documents folder.  In my case and in the scripts here, I went into to the Preferences of EyeTV and reset the archive location to just under &#8220;Macintosh HD&#8221; or &#8220;/EyeTV Archive&#8221;.</li>
<li><b>Transcoded folder:</b> I manually created this folder under the &#8220;EyeTV Archive&#8221; folder.</li>
</ul>
<h1>EyeTV</h1>
<p>Although Mac nerds have been using EyeTV for years, I hadn&#8217;t been very aware of it since we already had satellite TV service and a digital video recorder (DVR).  At about $90 USD, the EyeTV One product is a great combination of a simple USB-based device and a companion application called EyeTV.  In our case, since we don&#8217;t expect to watch much live TV, and certainly not on our iMac in the kitchen, the best part is that the app enables you to write custom scripts to process recordings.  This was a key feature for us because once a show was recorded, we wanted the recording to automatically become available to a variety of devices.</p>
<p><a href="http://kampmeier.com/chris/blog/wp-content/uploads/2011/02/Screen-shot-2011-02-26-at-8.45.47-PM.png"><img src="http://kampmeier.com/chris/blog/wp-content/uploads/2011/02/Screen-shot-2011-02-26-at-8.45.47-PM-300x179.png" alt="" title="Screen shot 2011-02-26 at 8.45.47 PM" width="300" height="179" class="alignnone size-medium wp-image-614" /></a></p>
<p>The EyeTV One dongle has a USB connector on one end and a threaded F connector for standard coaxial cable on the other.  You simply connect your OTA antenna lead and plug the dongle into a USB port on your Mac.  (Similar devices exist for Windows PCs).  Once the EyeTV software is loaded up and you configure the channel guide, you&#8217;ve got yourself a relatively inexpensive DVR.  By default, the EyeTV software records videos in broadcast or &#8220;lossless&#8221; quality (often 720p) to fairly large .mpg files.  Although it&#8217;s easy to configure the EyeTV app to automatically add recorded shows to iTunes, we didn&#8217;t depend on this feature due to the following issues:</p>
<ol>
<li><strong>Location of video files: </strong>Both the original large .mpg files and the transcoded files remained on the local drive.  My goal was to get the transcoded files to our NAS server.  I could have configured the EyeTV app to save both the original and transcoded files on our NAS server, but then both the recording and transcoding steps would have occurred over our network.  Not a desirable situation given the processing overhead and size of the files.</li>
<li><strong>Lack of control over transcoding: </strong>You don&#8217;t have much control over the built-in transcoding process. I wanted to ensure that the resulting videos looked good when displayed via Apple TV 2 on a large screen TV.</li>
</ol>
<h1>The Challenge</h1>
<p>My challenge was to take recordings made through the EyeTV software and make them available on a variety of devices: iPad, Apple TV 2, and several UPnP/DLNA-capable devices such as a Sony PS3 and a Samsung BD-C5500 Blu-Ray disc player. I knew that we wouldn&#8217;t necessarily watch recordings on all of these devices, but, as you&#8217;ll see, the solution described below made it pretty easy to do so.</p>
<p>Beyond the manual scheduling of show recordings via the EyeTV app, my requirement was to have the following post recording steps taken care of automatically:</p>
<ul>
<li><strong>Transcode video files: </strong>On the iMac, transcode the fairly large lossless .mpg files created by EyeTV to smaller sized .mp4 files with H.264 encoding.</li>
<li><strong>Move to NAS server: </strong>Move the transcoded .mp4 files to our NAS server thereby saving space on our iMac and making it easy to share the video files via a variety of devices.</li>
<li><strong>Add to iTunes library: </strong>Add the .mp4 files to our main iTunes library so as to enable easy access from our Apple TV 2 and to ease loading videos on the iPad for road trips. When adding videos to iTunes, include metadata such as show title, episode and description whenever feasible.
<li><strong>Make available via UPnP server: </strong>Ensure the .mp4 files are added to our UPnP media server so as to enable easy access from UPnP-capable apps and devices such as our Samsung Blu-ray player, Sony PS3 and the AirPlayer app on the iPad.</li>
</ul>
<p>The result of adding shows to an iTunes library would look something like the following screenshot.  Only one or two shows in the screenshot have description metadata because I recently added that feature.</p>
<p><a href="http://kampmeier.com/chris/blog/wp-content/uploads/2011/02/Screen-shot-2011-02-27-at-9.33.47-AM.png"><img src="http://kampmeier.com/chris/blog/wp-content/uploads/2011/02/Screen-shot-2011-02-27-at-9.33.47-AM-300x169.png" alt="" title="Screen shot 2011-02-27 at 9.33.47 AM" width="300" height="169" class="alignnone size-medium wp-image-650" /></a></p>
<h1>The Approach</h1>
<p>The key to the solution was to insert the right custom scripts into the EyeTV TriggeredScripts directory such that EyeTV would execute my code whenever a recording completes:  </p>
<p>Library/Application Support/EyeTV/Scripts/TriggeredScripts/</p>
<p>As long as the script file names conform to the names known to the EyeTV app, the scripts will automatically be called at certain points in the scheduling and recording process.  In my case, I was only interested in the RecordingDone stage of processing.  Hence the presence of a RecordingDone.scpt file in the screenshot below.  </p>
<p>The second file shown below, RecordingDone-called.scpt, is not invoked by EyeTV.  Rather, my custom RecordingDone.scpt calls this helper script. I&#8217;ll explain why this is done shortly.</p>
<p>Both of these scripts are written in the <a href="http://en.wikipedia.org/wiki/AppleScript">AppleScript</a> scripting language. AppleScript was new to me, but given my technical and development background, it was pretty easy to learn enough about it to complete these scripts. I was especially impressed by how easy it is for AppleScript developers to interact with apps.  As you&#8217;ll see in the example below, it was simple to interact with the EyeTV, Finder and iTunes apps.</p>
<p><a href="http://kampmeier.com/chris/blog/wp-content/uploads/2011/02/Screen-shot-2011-02-27-at-9.22.23-AM.png"><img src="http://kampmeier.com/chris/blog/wp-content/uploads/2011/02/Screen-shot-2011-02-27-at-9.22.23-AM-300x212.png" alt="" title="Screen shot 2011-02-27 at 9.22.23 AM" width="300" height="212" class="alignnone size-medium wp-image-645" /></a></p>
<h1>Role of HandBrake</h1>
<p>Since transcoding the large .mpg files into more manageable sized files was a key interest, I once again turned to the popular <a href="http://handbrake.fr/">HandBrake</a> application for transcoding work. I was already familiar with using the HandBrake GUI based on my recent <a href="http://kampmeier.com/chris/blog/?p=438">DVD ripping project</a>.  This time around I also installed the HandBrakeCLI wrapper such that I could easily invoke HandBrake from the command line within AppleScript.</p>
<h1>Hurdles</h1>
<p>Transcoding lossless .mpg files can take a long time.  Especially when using a 2-year old iMac.  Given that transcoding may take more than an hour, it wouldn&#8217;t be uncommon for multiple recordings to be in the queue or being processed at the same time.  So that was one problem: How to avoid hanging up the EyeTV app&#8217;s thread that calls the RecordingDone script while potentially multiple transcodings might be outstanding.</p>
<p>Another problem was with the time it takes in our environment to copy 1-4+ GB files from our iMac to our NAS server.  Depending on the circumstances, this could take at least several minutes.</p>
<p><strong>Asynchronous Transcoding and Copying</strong><br />
I addressed the first problem by having the RecordingDone script call the RecordingDone-called script in a non-blocking manner.  This means that the RecordingDone script will complete almost immediately and return control to the EyeTV app while the RecordingDone-called script does all of the heavy lifting: transcoding using HandBrake and copying the resulting .mp4 file to our NAS server.  The result is that multiple executions of the RecordingDone-called script can be running at once.</p>
<p>This was a little bit tricky because I was new to AppleScript and wasn&#8217;t sure how to call an AppleScript from the command line and pass the necessary arguments.  But it turned out to be pretty straightforward.</p>
<p><strong>AppleScript Timeouts</strong><br />
After having addressed the blocking issue, I ran into AppleScript timeouts during both the transcoding and copying steps.  A bit of digging led me to understand how to manually set timeouts for sections of AppleScript code.  Once I put in some reasonable caps, the timeout issues went away.</p>
<h1>The AppleScript Files</h1>
<p><strong>RecordingDone.scpt</strong></p>
<p>Here&#8217;s the script that is called by EyeTV whenever a recording completes.  This is a pretty simple script that calls the RecordingDone-called script in a non-blocking fashion.  The use of the &#8220;&#038;&#8221; at the end of the command is the magic that makes it a non-blocking execution.  The recording ID passed from EyeTV is sent along to the RecordingDone-called script as a command line argument.  This ID enables the called script to interact with the EyeTV app later on to obtain more information about the recorded show.  e.g. the location of the original lossless recording, show title, episode, description, etc. </p>
<p>If you would like to unit test the RecordingDone script, you can rename it, make several recordings and then call the renamed script directly from a terminal window like this:</p>
<p>$ osascript RecordingDoneTest.scpt 2</p>
<p>Where &#8220;2&#8243; represents the second recording in your list.</p>
<div class="codecolorer-container applescript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="applescript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #ff0033; font-weight: bold;">on</span> RecordingDone<span style="color: #000000;">&#40;</span>recordingID<span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #0066ff;">do shell script</span> <span style="color: #009900;">&quot;echo <span style="color: #000000; font-weight: bold;">\&quot;</span>recordingID = &quot;</span> <span style="color: #000000;">&amp;</span> recordingID <span style="color: #000000;">&amp;</span> <span style="color: #009900;">&quot;<span style="color: #000000; font-weight: bold;">\&quot;</span> &gt; /EyeTV<span style="color: #000000; font-weight: bold;">\\</span> Archive/osascript.log&quot;</span><br />
&nbsp; &nbsp; <span style="color: #0066ff;">do shell script</span> <span style="color: #009900;">&quot;nohup osascript /Library/Application<span style="color: #000000; font-weight: bold;">\\</span> Support/EyeTV/Scripts/TriggeredScripts/RecordingDone-called.scpt &quot;</span> <span style="color: #000000;">&amp;</span> recordingID <span style="color: #000000;">&amp;</span> <span style="color: #009900;">&quot; &gt;&gt; /EyeTV<span style="color: #000000; font-weight: bold;">\\</span> Archive/osascript.log 2&gt;&amp;1 &amp;&quot;</span><br />
<span style="color: #ff0033; font-weight: bold;">end</span> RecordingDone<br />
<br />
<span style="color: #ff0033; font-weight: bold;">on</span> <span style="color: #0066ff;">run</span> argv<br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> myItem <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">item</span> <span style="color: #000000;">1</span> <span style="color: #ff0033; font-weight: bold;">of</span> argv <span style="color: #ff0033;">as</span> <span style="color: #0066ff;">integer</span><br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">application</span> <span style="color: #009900;">&quot;EyeTV&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> rec <span style="color: #ff0033; font-weight: bold;">to</span> unique <span style="color: #0066ff;">ID</span> <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #0066ff;">item</span> myItem <span style="color: #ff0033; font-weight: bold;">of</span> recordings<br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span><br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">my</span> RecordingDone<span style="color: #000000;">&#40;</span>rec<span style="color: #000000;">&#41;</span><br />
<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #0066ff;">run</span></div></div>
<p><strong>RecordingDone-called.scpt</strong></p>
<p>This where the real action occurs.  The key steps are:</p>
<ul>
<li>Transcode from lossless .mpg to .mp4</li>
<li>Copy to NAS server and remove original lossless and local .mp4 copy, then empty Trash</li>
<li>Add to local iTunes library</li>
</ul>
<p>A few highlights of the code:</p>
<ul>
<li><strong>HandBrake preset: </strong>Learning from our earlier experience with HandBrake, we again chose to use the &#8220;Apple TV 2&#8243; transcoding preset.</li>
<li><strong>Dealing with empty episode strings: </strong>Since not all shows have episodes, the script checks whether the episode info is empty. If it is, then we use the recording date as a qualifier in the .mp4 file name.  Otherwise, recordings without episode information would overwrite one another.</li>
<li><strong>Special characters in file name: </strong>When building the .mp4 file name, we call a function that cleans up any special characters so as to avoid incompatible characters in file names and to generally make the file names more friendly.  See the Credits section at the end for the source of the clean function.</li>
<li><strong>Timeout settings:</strong> I may have gone overboard in some of the settings, but they&#8217;ve been working well.</li>
<li><strong>Hard to understand path names: </strong>I still don&#8217;t have a great handle on how the path names related to our mounted folder from our NAS server are working in the Finder section, but they work!</li>
<li><strong>Proper M4V attribute: </strong>Learning from <a href="http://kampmeier.com/chris/blog/?p=458">our past experience</a> with the subtle attribute settings for video files and how they&#8217;re important to iTunes, we use Finder to set the proper attribute.</li>
</ul>
<div class="codecolorer-container applescript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="applescript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #ff0033; font-weight: bold;">property</span> HANDBRAKE_CLI : <span style="color: #009900;">&quot;/Applications/HandBrakeCLI&quot;</span><br />
<span style="color: #ff0033; font-weight: bold;">property</span> HANDBRAKE_PARAMETERS : <span style="color: #009900;">&quot; -f mp4 --preset=<span style="color: #000000; font-weight: bold;">\&quot;</span>AppleTV 2<span style="color: #000000; font-weight: bold;">\&quot;</span> &quot;</span><br />
<span style="color: #ff0033; font-weight: bold;">property</span> TARGET_PATH : <span style="color: #009900;">&quot;/EyeTV Archive/Transcoded/&quot;</span><br />
<span style="color: #ff0033; font-weight: bold;">property</span> TARGET_TYPE : <span style="color: #009900;">&quot;.mp4&quot;</span><br />
<span style="color: #ff0033; font-weight: bold;">property</span> SOURCE_TYPE : <span style="color: #009900;">&quot;.mpg&quot;</span><br />
<span style="color: #ff0033; font-weight: bold;">property</span> SHELL_SCRIPT_SUFFIX : <span style="color: #009900;">&quot; &gt; /EyeTV<span style="color: #000000; font-weight: bold;">\\</span> Archive/HandBrakeCLI-export.log 2&gt;&amp;1 &quot;</span><br />
<br />
<span style="color: #808080; font-style: italic;">-- Properties for clean_filename() routine:</span><br />
<br />
<span style="color: #808080; font-style: italic;">-- Set the list of characters you want to replace</span><br />
<span style="color: #808080; font-style: italic;">-- DisallowedChars will be replaced with the replacementChar</span><br />
<span style="color: #ff0033; font-weight: bold;">property</span> CLEAN_FILENAME_DISALLOWED_CHARS : <span style="color: #009900;">&quot;;/|!@#$%^&amp;*()+&quot;</span><br />
<br />
<span style="color: #808080; font-style: italic;">-- Anything in disallowedChars2 will be removed altogether</span><br />
<span style="color: #ff0033; font-weight: bold;">property</span> CLEAN_FILENAME_DISALLOWED_CHARS2 : <span style="color: #009900;">&quot;:,'&quot;</span><br />
<br />
<span style="color: #808080; font-style: italic;">-- Set the character you'd like to use to replace the invalid </span><br />
<span style="color: #808080; font-style: italic;">-- characters specified in disallowedChars</span><br />
<span style="color: #ff0033; font-weight: bold;">property</span> CLEAN_FILENAME_REPLACEMENT : <span style="color: #009900;">&quot;_&quot;</span><br />
<br />
<span style="color: #ff0033; font-weight: bold;">on</span> <span style="color: #0066ff;">run</span> argv<br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> recordingID <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">item</span> <span style="color: #000000;">1</span> <span style="color: #ff0033; font-weight: bold;">of</span> argv<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">-- Obtain some show information from EyeTV</span><br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">-- Transcode recorded video to conform to desired format</span><br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">-- Delete original EyeTV recording</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">with</span> <span style="color: #ff0033; font-weight: bold;">timeout</span> <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">480</span> <span style="color: #000000;">*</span> <span style="color: #000000;">60</span><span style="color: #000000;">&#41;</span> seconds<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">application</span> <span style="color: #009900;">&quot;EyeTV&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> myid <span style="color: #ff0033; font-weight: bold;">to</span> recordingID <span style="color: #ff0033;">as</span> <span style="color: #0066ff;">integer</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> show_title <span style="color: #ff0033; font-weight: bold;">to</span> title <span style="color: #ff0033; font-weight: bold;">of</span> recording <span style="color: #0066ff;">id</span> myid <span style="color: #ff0033;">as</span> <span style="color: #0066ff;">text</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> show_episode <span style="color: #ff0033; font-weight: bold;">to</span> episode <span style="color: #ff0033; font-weight: bold;">of</span> recording <span style="color: #0066ff;">id</span> myid <span style="color: #ff0033;">as</span> <span style="color: #0066ff;">text</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">if</span> show_episode <span style="color: #000000;">=</span> <span style="color: #009900;">&quot;&quot;</span> <span style="color: #ff0033; font-weight: bold;">then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> show_episode <span style="color: #ff0033; font-weight: bold;">to</span> start time <span style="color: #ff0033; font-weight: bold;">of</span> recording <span style="color: #0066ff;">id</span> myid <span style="color: #ff0033;">as</span> <span style="color: #0066ff;">text</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">if</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> show_description <span style="color: #ff0033; font-weight: bold;">to</span> description <span style="color: #ff0033; font-weight: bold;">of</span> recording <span style="color: #0066ff;">id</span> myid <span style="color: #ff0033;">as</span> <span style="color: #0066ff;">text</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> recording_location <span style="color: #ff0033; font-weight: bold;">to</span> location <span style="color: #ff0033; font-weight: bold;">of</span> recording <span style="color: #0066ff;">id</span> myid <span style="color: #ff0033;">as</span> <span style="color: #0066ff;">text</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> AppleScript<span style="">'</span>s <span style="color: #0066ff;">text</span> <span style="color: #0066ff;">item</span> <span style="color: #0066ff;">delimiters</span> <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;.&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> recording_path <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">text</span> <span style="color: #0066ff;">items</span> <span style="color: #000000;">1</span> <span style="color: #ff0033;">through</span> <span style="color: #000000;">-</span><span style="color: #000000;">2</span> <span style="color: #ff0033; font-weight: bold;">of</span> recording_location <span style="color: #ff0033;">as</span> <span style="color: #0066ff;">string</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> AppleScript<span style="">'</span>s <span style="color: #0066ff;">text</span> <span style="color: #0066ff;">item</span> <span style="color: #0066ff;">delimiters</span> <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> recording_path <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">POSIX path</span> <span style="color: #ff0033; font-weight: bold;">of</span> recording_path<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> input_file <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #000000;">&#40;</span>recording_path <span style="color: #000000;">&amp;</span> SOURCE_TYPE<span style="color: #000000;">&#41;</span> <span style="color: #ff0033;">as</span> <span style="color: #0066ff;">string</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> show_filename <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #000000;">&#40;</span><span style="color: #ff0033; font-weight: bold;">my</span> clean_filename<span style="color: #000000;">&#40;</span>show_title <span style="color: #000000;">&amp;</span> <span style="color: #009900;">&quot; - &quot;</span> <span style="color: #000000;">&amp;</span> show_episode<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&amp;</span> TARGET_TYPE<span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> transcoded_file <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #000000;">&#40;</span>TARGET_PATH <span style="color: #000000;">&amp;</span> show_filename<span style="color: #000000;">&#41;</span> <span style="color: #ff0033;">as</span> <span style="color: #0066ff;">string</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> cmd <span style="color: #ff0033; font-weight: bold;">to</span> HANDBRAKE_CLI <span style="color: #000000;">&amp;</span> <span style="color: #009900;">&quot; -i &quot;</span> <span style="color: #000000;">&amp;</span> <span style="color: #0066ff;">quoted form</span> <span style="color: #ff0033; font-weight: bold;">of</span> input_file <span style="color: #000000;">&amp;</span> <span style="color: #009900;">&quot; -o &nbsp;&quot;</span> <span style="color: #000000;">&amp;</span> <span style="color: #0066ff;">quoted form</span> <span style="color: #ff0033; font-weight: bold;">of</span> transcoded_file <span style="color: #000000;">&amp;</span> HANDBRAKE_PARAMETERS <span style="color: #000000;">&amp;</span> SHELL_SCRIPT_SUFFIX<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066ff;">do shell script</span> <span style="color: #009900;">&quot;echo <span style="color: #000000; font-weight: bold;">\&quot;</span>&quot;</span> <span style="color: #000000;">&amp;</span> cmd <span style="color: #000000;">&amp;</span> <span style="color: #009900;">&quot;<span style="color: #000000; font-weight: bold;">\&quot;</span> &gt; /EyeTV<span style="color: #000000; font-weight: bold;">\\</span> Archive/HandBrakeCLI-command.txt &quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066ff;">do shell script</span> cmd<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066ff;">delete</span> recording <span style="color: #0066ff;">id</span> myid<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span><br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">timeout</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">-- Copy the transcoded video file to the NAS server's videos/tv/ directory</span><br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">-- Make sure the local copy is deleted and empty the trash folder</span><br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">-- Set the file type such that iTunes recognizes it as a video file</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">with</span> <span style="color: #ff0033; font-weight: bold;">timeout</span> <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">40</span> <span style="color: #000000;">*</span> <span style="color: #000000;">60</span><span style="color: #000000;">&#41;</span> seconds<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">application</span> <span style="color: #009900;">&quot;Finder&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> transcoding_folder <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #000000;">&#40;</span><span style="color: #009900;">&quot;Macintosh HD:EyeTV Archive:Transcoded:&quot;</span><span style="color: #000000;">&#41;</span> <span style="color: #ff0033;">as</span> <span style="color: #0066ff;">string</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">-- Our NAS server's video folder is mounted under /Volumes/network/videos</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">-- It is not clear to me why the following relative (?) reference works, but I had</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">-- to use it in support of the add method for iTunes later on.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">-- The target of the copy is /Volumes/network/videos/tv/.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> repo_folder <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #000000;">&#40;</span><span style="color: #009900;">&quot;videos:tv:&quot;</span><span style="color: #000000;">&#41;</span> <span style="color: #ff0033;">as</span> <span style="color: #0066ff;">string</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> full_path <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #000000;">&#40;</span>transcoding_folder <span style="color: #000000;">&amp;</span> show_filename<span style="color: #000000;">&#41;</span> <span style="color: #ff0033;">as</span> <span style="color: #0066ff;">string</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066ff;">move</span> full_path <span style="color: #ff0033; font-weight: bold;">to</span> repo_folder <span style="color: #ff0033; font-weight: bold;">with</span> replacing<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066ff;">do shell script</span> <span style="color: #009900;">&quot;/bin/rm -f&quot;</span> <span style="color: #000000;">&amp;</span> <span style="color: #0066ff;">space</span> <span style="color: #000000;">&amp;</span> <span style="color: #0066ff;">quoted form</span> <span style="color: #ff0033; font-weight: bold;">of</span> transcoded_file<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> repo_file <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #000000;">&#40;</span>repo_folder <span style="color: #000000;">&amp;</span> show_filename<span style="color: #000000;">&#41;</span> <span style="color: #ff0033;">as</span> <span style="color: #0066ff;">string</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> <span style="color: #0066ff;">file</span> type <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #0066ff;">file</span> repo_file <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;M4V &quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span><br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">timeout</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">-- Add the video file as it resides on the NAS server to the </span><br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">-- iTunes library as a TV show.</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">application</span> <span style="color: #009900;">&quot;iTunes&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> newShow <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #000000;">&#40;</span>add <span style="color: #000000;">&#40;</span>repo_folder <span style="color: #000000;">&amp;</span> show_filename<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> video kind <span style="color: #ff0033; font-weight: bold;">of</span> newShow <span style="color: #ff0033; font-weight: bold;">to</span> TV show<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> show <span style="color: #ff0033; font-weight: bold;">of</span> newShow <span style="color: #ff0033; font-weight: bold;">to</span> show_title<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> episode <span style="color: #0066ff;">ID</span> <span style="color: #ff0033; font-weight: bold;">of</span> newShow <span style="color: #ff0033; font-weight: bold;">to</span> show_episode<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> description <span style="color: #ff0033; font-weight: bold;">of</span> newShow <span style="color: #ff0033; font-weight: bold;">to</span> show_description<br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span><br />
<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #0066ff;">run</span><br />
<br />
<span style="color: #ff0033; font-weight: bold;">on</span> clean_filename<span style="color: #000000;">&#40;</span>theName<span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> newName <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;&quot;</span><br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">repeat</span> <span style="color: #ff0033; font-weight: bold;">with</span> i <span style="color: #ff0033; font-weight: bold;">from</span> <span style="color: #000000;">1</span> <span style="color: #ff0033; font-weight: bold;">to</span> length <span style="color: #ff0033; font-weight: bold;">of</span> theName<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">-- check if the character is in CLEAN_FILENAME_DISALLOWED_CHARS</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">-- replace it with the CLEAN_FILENAME_REPLACEMENT if it is</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>character i <span style="color: #ff0033; font-weight: bold;">of</span> theName<span style="color: #000000;">&#41;</span> <span style="color: #ff0033; font-weight: bold;">is</span> <span style="color: #ff0033; font-weight: bold;">in</span> CLEAN_FILENAME_DISALLOWED_CHARS<span style="color: #000000;">&#41;</span> <span style="color: #ff0033; font-weight: bold;">then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> newName <span style="color: #ff0033; font-weight: bold;">to</span> newName <span style="color: #000000;">&amp;</span> CLEAN_FILENAME_REPLACEMENT<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">-- check if the character is in CLEAN_FILENAME_DISALLOWED_CHARS2</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">-- remove it completely if it is</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">else</span> <span style="color: #ff0033; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>character i <span style="color: #ff0033; font-weight: bold;">of</span> theName<span style="color: #000000;">&#41;</span> <span style="color: #ff0033; font-weight: bold;">is</span> <span style="color: #ff0033; font-weight: bold;">in</span> CLEAN_FILENAME_DISALLOWED_CHARS2<span style="color: #000000;">&#41;</span> <span style="color: #ff0033; font-weight: bold;">then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> newName <span style="color: #ff0033; font-weight: bold;">to</span> newName <span style="color: #000000;">&amp;</span> <span style="color: #009900;">&quot;&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">-- if the character is not in either CLEAN_FILENAME_DISALLOWED_CHARS or</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">-- CLEAN_FILENAME_DISALLOWED_CHARS2, keep it in the file name</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">else</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> newName <span style="color: #ff0033; font-weight: bold;">to</span> newName <span style="color: #000000;">&amp;</span> character i <span style="color: #ff0033; font-weight: bold;">of</span> theName<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">if</span><br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">repeat</span><br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">return</span> newName<br />
<span style="color: #ff0033; font-weight: bold;">end</span> clean_filename</div></div>
<h1>End Result</h1>
<p>It&#8217;s actually pretty cool and useful to have recorded shows be made available automatically across a wide range of devices.  With the typically closed and proprietary DVRs from satellite companies, we&#8217;d never have this degree of freedom. Being able easily watch a show with the family in the living room or choose to watch the same show on the iPad or one of the other UPnP-capable devices is quite useful.  Although we haven&#8217;t been on any road trips since I set up this process, I expect that we&#8217;ll be loading a few shows and movies directly to the iPad for trips</p>
<p>On the technology front, earlier versions of these scripts have been running for a little over a month.  With the most recent tweaks to add show metadata, I think the process is pretty stable and should not require much care and feeding.  The main thing I&#8217;ll have to work out is how we can easily remove shows that have already been watched and we don&#8217;t need to retain.  However, since we recently expanded our NAS server&#8217;s storage capacity, removing shows is less of an issue.</p>
<p>Since I tackled playing of .mp4 movie files from our home server&#8217;s MediaTomb UPnP server as part of the DVD ripping project, the .mp4 show files resulting from this EyeTV project play without issues via our UPnP-compatible devices including the AirPlayer app on the iPad, the Sony PS3 and the Samsung BD-C5500 Blu-ray player.  Even XBMC on our hacked Apple TV 2 can plays the videos through MediaTomb.</p>
<p>Here are a few screenshots of the TV shows being made available on the Apple TV 2 device.</p>
<p>First, the overall Apple TV 2 screen showing the shared iTunes library on the right.  Our kitchen iMac is serving up this library.</p>
<p><a href="http://kampmeier.com/chris/blog/wp-content/uploads/2011/02/IMG_1498.jpg"><img src="http://kampmeier.com/chris/blog/wp-content/uploads/2011/02/IMG_1498-300x225.jpg" alt="" title="IMG_1498" width="300" height="225" class="alignnone size-medium wp-image-663" /></a></p>
<p>Next, the types of media served up by the iTunes library:</p>
<p><a href="http://kampmeier.com/chris/blog/wp-content/uploads/2011/02/IMG_1499.jpg"><img src="http://kampmeier.com/chris/blog/wp-content/uploads/2011/02/IMG_1499-300x225.jpg" alt="" title="IMG_1499" width="300" height="225" class="alignnone size-medium wp-image-664" /></a></p>
<p>Finally, a specific show with description metadata:</p>
<p><a href="http://kampmeier.com/chris/blog/wp-content/uploads/2011/02/IMG_1500.jpg"><img src="http://kampmeier.com/chris/blog/wp-content/uploads/2011/02/IMG_1500-300x225.jpg" alt="" title="IMG_1500" width="300" height="225" class="alignnone size-medium wp-image-665" /></a></p>
<h1>Next Steps</h1>
<ul>
<li>Clean up debug and output file handling. Currently, execution of multiple jobs will overwrite previous job&#8217;s file.</li>
<li> Consider integrating <a href="http://code.google.com/p/etv-comskip/">CommSkipper</a> or similar commercial skipping features such that commercials are automatically removed from show recordings.  Tried it once briefly, but ran into issues.  Might try it again.</li>
</ul>
<h1>Credits</h1>
<ul>
<li>Some initial thoughts came from this <a href="http://forums.mactalk.com.au/20/70076-my-second-applescript-add-tv-shows-itunes.html">forum post</a>. </li>
<li><a href="http://techierambles.blogspot.com/2009/04/applescript-to-automatically-replace.html">Cleaning up file names</a>.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://kampmeier.com/chris/blog/?feed=rss2&#038;p=451</wfw:commentRss>
		<slash:comments>30</slash:comments>
		</item>
		<item>
		<title>Hack Our Car</title>
		<link>http://kampmeier.com/chris/blog/?p=475</link>
		<comments>http://kampmeier.com/chris/blog/?p=475#comments</comments>
		<pubDate>Thu, 24 Feb 2011 02:34:07 +0000</pubDate>
		<dc:creator>ckamps</dc:creator>
				<category><![CDATA[Car Stuff]]></category>
		<category><![CDATA[A4]]></category>
		<category><![CDATA[Audi]]></category>
		<category><![CDATA[VAGCOM]]></category>
		<category><![CDATA[Windows7]]></category>

		<guid isPermaLink="false">http://kampmeier.com/chris/blog/?p=475</guid>
		<description><![CDATA[My son and I had some fun tweaking our 2010 Audi A4 using a $30 cable.  None of the changes affect the performance of the vehicle; they&#8217;re more geared toward entertainment, exterior lighting and window controls.  All we had to do was install VCDS, the program that came with the cable, connect the cable to [...]]]></description>
			<content:encoded><![CDATA[<p>My son and I had some fun tweaking our 2010 Audi A4 using a <a href="http://www.gadgettown.com/VW-AUDI-VAG-908-Vagcom-Updated-ODX-Data.html">$30 cable</a>.  None of the changes affect the performance of the vehicle; they&#8217;re more geared toward entertainment, exterior lighting and window controls.  All we had to do was install VCDS, the program that came with the cable, connect the cable to the diagnostic port under the dash and start modifying the configuration.  Some of the tips came from <a href="http://audienthusiasts.com/VagCom.html">AudiEnthusiasts.com</a>, a great collection of information.</p>
<p>Overall, it was a pretty simple process and relatively inexpensive.</p>
<p><a href="http://kampmeier.com/chris/blog/wp-content/uploads/2011/02/IMG_1450.jpg"><img src="http://kampmeier.com/chris/blog/wp-content/uploads/2011/02/IMG_1450-300x225.jpg" alt="" title="IMG_1450" width="300" height="225" class="alignnone size-medium wp-image-587" /></a></p>
<p><span id="more-475"></span></p>
<p>Since the VCDS program only supports Windows, we used an installation of Windows 7 64-bit in the bootcamp partition of our MacBook Pro to install and run the application. The one hiccup was that the version of VCDS that came with the cable did not include a 64-bit Windows 7 driver for the cable.  After resolving that problem by using the <a href="http://www.7-zip.org/">7-Zip</a> utility to extract the driver file from a newer version of the installation .exe file, everything worked fine.</p>
<p>The few customizations we made are outlined below.  The steps reflect the menus and settings in the VCDS program.</p>
<p>The car in the following video isn&#8217;t ours, but it shows the before and after behaviors of some of the mods listed below.</p>
<p><object width="500" height="306"><param name="movie" value="http://www.youtube.com/e/EMTCTJgMVBQ"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/e/EMTCTJgMVBQ" type="application/x-shockwave-flash" width="500" height="306" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p><strong>Daytime Running Lights (DRLs)<br />
</strong></p>
<p>This one simply keeps the LED daytime running lights (DRLs) lit when either turn signal is active. From the factory, the LEDs will &#8220;wink&#8221; or be turned off on the side on which a turn signal is activated.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">09 – Cent. Elect.<br />
<br />
Coding - 07<br />
<br />
Long Coding Helper<br />
<br />
Byte 3 Bit 7<br />
<br />
Change 1 to 0</div></div>
<p><strong>Operate Windows and Sunroof From Key Fob</strong></p>
<p>Makes it possible to open and close the windows and tilt the sunroof by continually pressing the unlock and lock buttons of the key fobs.  This mod might be useful to air out the car when walking out to the car on a hot Summer day. Once the following code is set, you have to go into the <a href="http://en.wikipedia.org/wiki/Multi_Media_Interface">MMI </a>menu for the Car settings and enable the window down capability on the windows of interest.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">46 - Cent. Conv.<br />
<br />
Coding - 07<br />
<br />
Long Coding Helper<br />
<br />
Check &quot;Comfort Operation: Remote Control active&quot;</div></div>
<p><strong>Ambient Interior Lighting</strong></p>
<p>This one is a <a href="http://www.audienthusiasts.com/VagComINLight.html">bit more involved</a>, but it&#8217;s pretty cool to have adjustable footwell lighting that is controllable through the MMI screen. Again, courtesy of AudiEnthusiasts.com.</p>
<p><strong>Emergency Blinking Brake Lights</strong></p>
<p>When brakes are applied heavily, brake lights will blink at a high rate. We have not yet tested this change. <img src='http://kampmeier.com/chris/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">46 - Comfort System<br />
<br />
Coding - 07<br />
<br />
Long Coding Helper<br />
<br />
Byte 8:<br />
<br />
Bit 1 – Emergency Brake Flashing via Brake Lights active (1 = active)</div></div>
<p><strong>Gear Indicator in Drive and Sport Modes</strong></p>
<p>Normally, only D or S is shown in the driver&#8217;s information area, but with this modification, the gear number will also be displayed.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">02 – Auto Trans<br />
<br />
Adaptation – 10<br />
<br />
Select “Single Gear Display” from top channel drop down menu<br />
<br />
Select “D on/S on” from New value drop down menu</div></div>
<p><strong>Gauge Needle Sweep</strong></p>
<p>Just a cool eye candy feature. Again, the following video is from another owner&#8217;s car, but it shows both this feature and the next one, the lap timer and oil temperature display.</p>
<p><object width="500" height="306"><param name="movie" value="http://www.youtube.com/e/PUB-fsaCEbg"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/e/PUB-fsaCEbg" type="application/x-shockwave-flash" width="500" height="306" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">17 - Instruments<br />
<br />
Coding - 07<br />
<br />
Long Coding Helper<br />
<br />
Byte 1 Bit<br />
<br />
0 Change 0 to 1<br />
<br />
Check the box for &quot;Gauge Test/Needle Sweep active&quot;</div></div>
<p><strong>Lap Timer and Oil Temperature<br />
</strong></p>
<p>We might not use this feature much, but it will allow us to have a <a href="http://www.audienthusiasts.com/Articles_LapTimer.html">stopwatch</a> readily available if and when we ever need one.  The oil temp gauge might be nice to check the temp on really warm days.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">17 - Instruments<br />
<br />
Coding - 07<br />
<br />
Long Coding Helper<br />
<br />
Byte 1 Bit 3 change from 0 to 1<br />
<br />
Check the box for &quot;Lap Timer active&quot; if available.</div></div>
<p><strong>Front Fog Lights Remain On With High Beams</strong></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">09 – Cent. Elect.<br />
<br />
Coding - 07<br />
<br />
Long Coding Helper<br />
<br />
Byte 4 Bit 1<br />
<br />
Change 1 to 0</div></div>
<p><strong>Video in Motion</strong></p>
<p>A more involved hack, but it enables playing a DVD when the car is in motion. From the factory, you can only play a video when the transmission is in park.  We haven&#8217;t tried this on a road trip just yet, but I am skeptical as to whether our son will be able to see the screen well enough from the back seat.<br />
<a href="http://kampmeier.com/chris/blog/wp-content/uploads/2011/02/IMG_1450.jpg"><img src="http://kampmeier.com/chris/blog/wp-content/uploads/2011/02/IMG_1450-300x225.jpg" alt="" title="IMG_1450" width="300" height="225" class="alignnone size-medium wp-image-587" /></a></p>
<p>Instructions are <a href="http://audienthusiasts.com/Articles_VIM.html">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://kampmeier.com/chris/blog/?feed=rss2&#038;p=475</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>A Rippin&#8217; Good Time</title>
		<link>http://kampmeier.com/chris/blog/?p=438</link>
		<comments>http://kampmeier.com/chris/blog/?p=438#comments</comments>
		<pubDate>Wed, 23 Feb 2011 02:19:36 +0000</pubDate>
		<dc:creator>ckamps</dc:creator>
				<category><![CDATA[Home Audio/Video]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[AppleTV]]></category>
		<category><![CDATA[iTunes]]></category>
		<category><![CDATA[MacOS]]></category>
		<category><![CDATA[NAS]]></category>
		<category><![CDATA[QNAP]]></category>

		<guid isPermaLink="false">http://kampmeier.com/chris/blog/?p=438</guid>
		<description><![CDATA[Now that we have an Apple TV 2 hooked up to our main level TV and have moved our Samsung Blu-Ray DVD BDP-C5500 player to another room, it made sense to see how we could back up our DVDs to our NAS server such that we could load the movies on our iPad for road [...]]]></description>
			<content:encoded><![CDATA[<p>Now that we have an Apple TV 2 hooked up to our main level TV and have moved our Samsung Blu-Ray DVD BDP-C5500 player to another room, it made sense to see how we could back up our DVDs to our NAS server such that we could load the movies on our iPad for road trips and stream them on TVs via the Apple TV, our Samsung Blu-Ray player and a Sony PS3 in the basement.<a href="http://kampmeier.com/chris/blog/wp-content/uploads/2011/02/Screen-shot-2011-02-21-at-7.13.01-PM.png"><img class="size-medium wp-image-528 alignright" title="Screen shot 2011-02-21 at 7.13.01 PM" src="http://kampmeier.com/chris/blog/wp-content/uploads/2011/02/Screen-shot-2011-02-21-at-7.13.01-PM-261x300.png" alt="" width="209" height="240" /></a></p>
<p>Many tech savvy people have been doing this sort of thing for years, but I&#8217;m glad that I finally got around to trying it for myself.  The results have been worth it: Not only are we able to easily access our 70 odd videos from all of the devices mentioned above, it helped set the stage for our use of EyeTV to record over the air (OTA) digital TV broadcasts and store them on our NAS server.</p>
<p><span id="more-438"></span></p>
<h2>The Ingredients</h2>
<p>After several hours of research and trial and error, I arrived at the following solution using tools on Mac OS X:</p>
<ul>
<li><a href="http://thelittleappfactory.com/ripit/">RipIt</a> to make a descrambled backup of the DVDs to a filesystem (~$22USD)</li>
<li><a href="http://handbrake.fr/">Handbrake</a> to encode the ripped DVD content to m4v format files (free)</li>
<li><a href="http://www.kerstetter.net/index.php/projects/software/metax">MetaX</a> and <a href="http://www.tagchimp.com/">tagChimp</a> to add cover art and other metadata to the m4v files (free)</li>
<li>iTunes to make the movies available to iOS devices including Apple TV and iPad</li>
</ul>
<p>We also use Ubuntu Linux, but it was so much easier finding the necessary ripping and encoding tools for Mac OS X.</p>
<p>We&#8217;re using <a href="http://mediatomb.cc/">MediaTomb</a> on our Ubuntu-based home server to act as a DLNA/UPnP player for the non-iOS devices. On our iPad we&#8217;ve installed the <a href="http://itunes.apple.com/us/app/airplayer/id369713694?mt=8">AirPlayer</a> app to stream content directly from our home server.</p>
<h2>Storage Strategy</h2>
<p>Even encoded and compressed video files can take up a lot of space: depending on the resolution selected, it&#8217;s not uncommon for a movie to consume 1-4 GB of storage. Consequently, this exercise of backing up our DVD collection caused us to <a href="http://kampmeier.com/chris/blog/?p=490">expand the overall capacity of our NAS server</a>.</p>
<p>Since the ripping, encoding and metadata tagging processes are so disk and CPU intensive, it made sense for us to perform all of these operations on our relatively recent MacBook Pro and then copy the finished files over to our NAS server for back up and streaming.</p>
<p>On our NAS server, we carved out a new &#8220;videos/&#8221; folder with separate subfolders for &#8220;movies/&#8221; and &#8220;tv/&#8221; to hold the backed up DVDs and any shows we record through the EyeTV OTA dongle on our iMac.</p>
<h2>Making a Back Up and Descrambling</h2>
<p>RipIt was well worth its modest price as compared to my experience in trying to use several Linux tools.  Out of the box, RipIt is simple to use: insert the DVD, quit the Mac OS X DVD player and click &#8220;Rip&#8221; to back up and descramble the content of the DVD. A typical DVD on a fairly recent MacBook Pro might take 20-30 minutes to back up.</p>
<p>The resulting package can be opened in HandBrake for encoding to a smaller footpring .m4v file compatible with Apple iOS devices and devices. RipIt also supports compression, but we opted to use the more feature rich HandBrake tool to encode and compress the video files.</p>
<p>Although we have a handful of Blu-Ray DVDs, we haven&#8217;t yet backed those up because RipIt does not support Blu-Ray and we didn&#8217;t have a Blu-Ray DVD device available.</p>
<h2>Encoding</h2>
<p>The next step is to use HandBrake to encode the backed up DVD images to a more space efficient file format suited for the devices on which we&#8217;ll play the content.</p>
<ul>
<li><strong>Install VLC</strong>: First, I installed <a href="http://www.videolan.org/vlc/download-macosx.html">VLC</a> as a prerequisite for HandBrake.  Among other roles, VLC provides the ability to play the content contained in the ripped DVD images.</li>
<li><strong>Load ripped DVD</strong>: Then I fired up HandBrake and clicked on the Source icon in the toolbar to select the recently ripped DVD image from my desktop.  HandBrake reads all of the titles from the DVD image before allowing you to select which one you&#8217;d like to select.  In almost all cases, I&#8217;ve just used the default selected title.  However, in those situations where multiple videos are stored on one DVD, for example, with the Dune DVDs, you need to select each of the large titles separately to perform to encodings.  You can get a good feel for which title to select by looking at the time duration next to the title number.</li>
<li><strong>Select preset:</strong> I then clicked on the Toggle Presets icon in the toolbar to show the device-oriented presets.  I chose &#8220;AppleTV 2&#8243; because it seemed to have most of the settings of the High Profile preset, but it&#8217;s obviously going to work well for the Apple TV 2 device that we have in our living room. Thus far, the audio and video resolution settings with this preset have offered the best compromise by supporting both large displays such as our TVs and smaller ones such as the iPad.</li>
<li><strong>Add more to queue: </strong>Since the encoding tasks can take an hour or more per DVD, I got into the habit of adding multiple DVDs to the queue and letting HandBrake run over night.</li>
</ul>
<p><a href="http://kampmeier.com/chris/blog/wp-content/uploads/2011/02/Screen-shot-2011-02-21-at-7.19.41-PM.png"><img class="alignnone size-medium wp-image-531" title="Screen shot 2011-02-21 at 7.19.41 PM" src="http://kampmeier.com/chris/blog/wp-content/uploads/2011/02/Screen-shot-2011-02-21-at-7.19.41-PM-300x193.png" alt="" width="300" height="193" /></a></p>
<p><a href="http://kampmeier.com/chris/blog/wp-content/uploads/2011/02/Screen-shot-2011-02-21-at-7.35.47-PM.png"><img class="alignnone size-medium wp-image-534" title="Screen shot 2011-02-21 at 7.35.47 PM" src="http://kampmeier.com/chris/blog/wp-content/uploads/2011/02/Screen-shot-2011-02-21-at-7.35.47-PM-300x133.png" alt="" width="300" height="133" /></a></p>
<p><a href="http://kampmeier.com/chris/blog/wp-content/uploads/2011/02/Screen-shot-2011-02-21-at-9.13.00-PM.png"><img class="alignnone size-medium wp-image-552" title="Screen shot 2011-02-21 at 9.13.00 PM" src="http://kampmeier.com/chris/blog/wp-content/uploads/2011/02/Screen-shot-2011-02-21-at-9.13.00-PM-300x262.png" alt="" width="300" height="262" /></a></p>
<h2>Adding Cover Art and Metadata</h2>
<p>Much like various MP3 encoding tools are able to add metadata (song title, album art, etc) to ripped music files, MetaX can be used to do the same for movie video files.  As with HandBrake, MetaX includes a queuing feature to enable you to add a bunch of video files to a queue and process them automatically one after another.</p>
<p><a href="http://kampmeier.com/chris/blog/wp-content/uploads/2011/02/Screen-shot-2011-02-22-at-5.12.23-AM.png"><img class="size-medium wp-image-556 alignnone" title="Screen shot 2011-02-22 at 5.12.23 AM" src="http://kampmeier.com/chris/blog/wp-content/uploads/2011/02/Screen-shot-2011-02-22-at-5.12.23-AM-300x165.png" alt="" width="300" height="165" /></a></p>
<p>The key hurdle I encountered with MetaX was initially getting black video content after applying metadata.  It turns out that, given the resolution of and resulting size of the backed up video files, I had to select Preferences -&gt; General check &#8220;Enable Support for Large Files&#8221; to address the problem.  Even through most of the video files were under 4 GB in size.</p>
<p>Apart from that issue and its sometime quirky handling of checkboxes (the Toggle button in the toolbar is really useful in this regard), MetaX is pretty easy to use:</p>
<ul>
<li><strong>Select file: </strong>Open up the .m4v or .mp4 file of interest and wait for MetaX to find metadata from the tagChimp online database.</li>
<li><strong>Select and customize metadata: </strong>Select the tagChimp matches and review the metadata to see which one best suits your needs. In some cases, I made the following tweaks:
<ul>
<li>Under the Sorting area, I often overrode the default sort key to ensure that the video was sorted the way we liked it in our video players. For example, I changed the sort key from &#8220;The Dark Night &#8211; Batman&#8221; to &#8220;Batman &#8211; The Dark Night&#8221; such that all of the Batman movies would appear next to one another.</li>
<li>Once in a while, I overrode or added cover art by finding an image on Google image search and dragging it to the cover art area.</li>
<li>On rare occasions, I had to redo or fill in the Chapters information.</li>
</ul>
</li>
<li><strong>Add to queue: </strong>Hit the &#8220;+&#8221; button under the list to add another selection. Don&#8217;t worry, you don&#8217;t have to save your prior track&#8217;s selections.</li>
<li><strong>Write and share the metadata:</strong> Once you&#8217;ve queue up the tracks of interest, hit Write &amp; Share to both add the metadata and share your modifications with the tagChimp database.</li>
<li><strong>Enjoy the cow: </strong>When the queue is finished, MetaX will play a nice cow sound. <img src='http://kampmeier.com/chris/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </li>
</ul>
<h2>Using with iTunes and iOS Devices</h2>
<p>OK, so now that we have all of these .m4v files, how do we share them with Apple iOS devices? Not surprisingly, the key is iTunes.  As long as the movie files are added to an iTunes library, you&#8217;re able to easily load them them on iPads, iPhones, iPod Touches, etc and stream them to Apple TV 2 devices.</p>
<p>As with most homes that have a Mac, we have multiple user accounts that run iTunes. In our case, we selected one account on our kitchen iMac under which we added all of our music tracks and videos to the iTunes library. We can choose to sync various iOS devices to this iTunes library in order to load movies and music. For example, if we&#8217;re going on a road trip, we might chose to load a few movies and TV shows from the iTunes library to the iPad.</p>
<p>Since all of our music tracks and video files are stored on our NAS server, we configured iTunes to NOT copy files to the iTunes media folder when adding content to the library. The library still has an entry for the files of interest, but iTunes will leave the content of the file on the NAS server.</p>
<p><a href="http://kampmeier.com/chris/blog/wp-content/uploads/2011/02/Screen-shot-2011-02-22-at-6.49.05-PM.png"><img class="size-medium wp-image-563 alignnone" title="Screen shot 2011-02-22 at 6.49.05 PM" src="http://kampmeier.com/chris/blog/wp-content/uploads/2011/02/Screen-shot-2011-02-22-at-6.49.05-PM-300x155.png" alt="" width="300" height="155" /></a></p>
<p>Adding a movie file is pretty simple: select File -&gt; Add to  library&#8230; and browse over to the NAS server to select the file of  interest.  As long as the file is compatible with iTunes, you should see  it appear in the Movies section of the library.</p>
<p><a href="http://kampmeier.com/chris/blog/wp-content/uploads/2011/02/Screen-shot-2011-02-22-at-7.37.31-PM.png"><img class="alignnone size-medium wp-image-569" title="Screen shot 2011-02-22 at 7.37.31 PM" src="http://kampmeier.com/chris/blog/wp-content/uploads/2011/02/Screen-shot-2011-02-22-at-7.37.31-PM-300x271.png" alt="" width="300" height="271" /></a></p>
<p>Streaming movies to Apple TV requires iTunes to be running on your network and Home Sharing to be enabled.  Once this is done, the Apple TV device will be able to browse and play all of the movies known to the iTunes library.  Although I&#8217;d rather not have to depend on iTunes to play media from our NAS server, in practice it hasn&#8217;t been much of an issue.</p>
<p><img class="alignnone size-medium wp-image-572" title="IMG_1493" src="http://kampmeier.com/chris/blog/wp-content/uploads/2011/02/IMG_1493-300x225.jpg" alt="" width="300" height="225" /></p>
<h2>Using with non-Apple Devices</h2>
<p>This whole back up business for DVDs got me into the mode of exploring which UPnP/DLNA server would work best for our other players such as a PS3 and Samsung Blu-Ray player.  The goal was to be able to play our movie collection and recorded shows from all of these devices.  Even the iPad has a selection of DLNA-compatible apps such as <a href="http://itunes.apple.com/us/app/airplayer/id369713694?mt=8">AirPlayer</a> that enable one to stream content directly from a server without having to worry about iTunes.</p>
<p>Although I tried multiple UPnP/DLNA players including the built-in TwonkeyMedia player on the QNAP, few of them worked properly with our Samsung Blu-Ray player.  In the end, I had the most luck with installing MediaTomb on our Ubuntu-based home server system which in turn accesses the media content on the NAS server. How we customized the MediaTomb configuration to work with the Samsung Blu-Ray player will be the subject of another blog entry.</p>
<p>Although none of the UPnP compatible media players displays the movie metadata as well as the Apple TV, they are all able to play the content housed on our NAS server.  Chalk one up again for the quality of the proprietary Apple experience, but it&#8217;s also a win in the openness category for the open source-based and standards compliant UPnP/DLNA implementations.</p>
<h2>Next Steps</h2>
<p>After having addressed the DVD back up topic, I was ready to tackle how to automatically load into our NAS server and iTunes library TV shows and movies recorded through an EyeTV OTA dongle attached to our iMac.  My next step is to post a blog entry on that experience.</p>
]]></content:encoded>
			<wfw:commentRss>http://kampmeier.com/chris/blog/?feed=rss2&#038;p=438</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Clonezilla rocks! Image back up and restore for home server</title>
		<link>http://kampmeier.com/chris/blog/?p=539</link>
		<comments>http://kampmeier.com/chris/blog/?p=539#comments</comments>
		<pubDate>Tue, 22 Feb 2011 03:03:13 +0000</pubDate>
		<dc:creator>ckamps</dc:creator>
				<category><![CDATA[Home Network Storage]]></category>
		<category><![CDATA[Home Server]]></category>
		<category><![CDATA[Backup]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://kampmeier.com/chris/blog/?p=539</guid>
		<description><![CDATA[We&#8217;ve had our low power consumption home server running for several years, but I hadn&#8217;t gotten around to performing a full system image back up of the server. Since I have been backing up critical OS and application configuration files and all of our database, web content and other files of importance are stored on [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://kampmeier.com/chris/blog/wp-content/uploads/2011/02/screenshots.php_.png"><img class="size-medium wp-image-541 alignright" title="screenshots.php" src="http://kampmeier.com/chris/blog/wp-content/uploads/2011/02/screenshots.php_-300x225.png" alt="" width="300" height="225" /></a><br />
We&#8217;ve had our <a href="http://kampmeier.com/chris/blog/?p=23">low power consumption home server</a> running for several years, but I hadn&#8217;t gotten around to performing a full system image back up of the server.  Since I have been backing up critical OS and application configuration files and all of our database, web content and other files of importance are stored on our NAS server and accessed via NFS, not having an image back up wasn&#8217;t the end of the world. However, when it came time to replace the internal 8 GB SSD with a 30 GB unit, it was time to bite the bullet and perform a full image back up.  Fortunately, I ran across the excellent and free <a href="http://clonezilla.org/">Clonezilla</a> tool to make this a pretty easy task.</p>
<p><span id="more-539"></span></p>
<h2>The mission</h2>
<p>Take a full image back up of our Ubuntu 10.04 server system that is currently running on an 8 GB SSD.  Replace the 8 GB drive with a 30 GB SSD and restore the image.  Sounds pretty easy, eh?</p>
<h2>Backing up the current disk image</h2>
<p>The Clonezilla site has detailed <a href="http://clonezilla.org/screenshots.php?in_path=/00_Clonezilla">screenshots</a> of most of the following process.  I chose default setting throughout the process.</p>
<ul>
<li>First, I downloaded the Clonezilla Live CD image and burned a live boot CD.</li>
<li>Next, I shut down the Ubuntu server and rebooted it using the live CD.</li>
<li>I choose the Device Image option to back up the entire /dev/sda internal drive.</li>
<li>On the side, I had a 200 GB HDD US drive enclosure at the ready to act as the destination of the back up.</li>
<li>I chose the destination to be a local device (I had tried to point Clonezilla to our NFS-based NAS server, but I didn&#8217;t have a share set up to be compatible with the /home/clonezilla directory requirement).</li>
<li>When prompted to do so, I plugged in the USB drive and Clonezilla recognized it.</li>
<li>I selected the USB drive as the destination and the /dev/sda internal drive of the home server as the source.</li>
<li>Then Clonezilla did its thing by completing the imaging in about 20-30 minutes.</li>
</ul>
<h2>Swapping in the new drive, restoring image</h2>
<p>After Clonezilla completed its back up, I replaced the internal SSD with the larger 30 GB unit and fired up the server with the Clonezilla Live CD. I basically performed the opposite of the back up process above by selecting the restore options.  Again, the process was pretty simple.</p>
<h2>Fixing things up</h2>
<p>After I booted up the server with the reimaged and larger drive, the one thing that as amiss was the size of the root partition.  It was still only 8 GB or so.  I had been expecting it to have grown to 20 something GB.  What to do?  After digging around a bit, it dawned on me that I should be able to boot up using one of the Ubuntu Live CDs and use the Disk Utility or Partition Editor to grow the root partition.  Once I booted up using an older Ubuntu 9.04 Live CD, I was able to delete the swap partition, grow the root partition and create a new swap partition.</p>
<p>After rebooting the server again, the only change I had to make was to update the UUID in /etc/fstab for the newly recreated swap partition. The blkid command helped me determine the UUID for swap under /dev/sda2.  A quick edit of /etc/fstab and another reboot confirmed that all was OK.</p>
<h2>Taking another image</h2>
<p>Once I verified that the server was running as expected, I shut it down, booted up using the Clonezilla Live CD and took an image of the new SDD.  Resulting in two backed up images on our USB drive: one from the 8 GB SSD and this second one from the 30 GB SSD.  However, this time the back up or save image process encountered a lot of read-related errors, but the back up eventually completed.  I have not yet verified whether the backed up image will result in a proper restore.  When I can make some more time, I&#8217;ll dig into the error situation and try another back up.</p>
<h2>Next steps</h2>
<p>Over time, I probably won&#8217;t take image back ups of the server until I make significant changes to the server.  Especially since all of the important data is housed on our NAS server. For example, since we now have a lot more space available on the home server, I&#8217;d  like to apply a wholesale update to 10.04.  As I do this, it will be  nice to know that we have two backups that we can fall back to in case  the update process goes awry.</p>
<p>The other thing I&#8217;d like to do is figure out how to back up to and restore from images housed on our NAS server.  Then we could remove the USB drive from the loop and have the side benefit of the image back ups being backed up to multiple drives in our three-drive rotation scheme.</p>
]]></content:encoded>
			<wfw:commentRss>http://kampmeier.com/chris/blog/?feed=rss2&#038;p=539</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Migrating to QNAP&#8217;s Time Machine Feature</title>
		<link>http://kampmeier.com/chris/blog/?p=435</link>
		<comments>http://kampmeier.com/chris/blog/?p=435#comments</comments>
		<pubDate>Mon, 21 Feb 2011 22:31:52 +0000</pubDate>
		<dc:creator>ckamps</dc:creator>
				<category><![CDATA[Home Network Storage]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Personal Computers]]></category>
		<category><![CDATA[Backup]]></category>
		<category><![CDATA[MacOS]]></category>
		<category><![CDATA[NAS]]></category>
		<category><![CDATA[QNAP]]></category>
		<category><![CDATA[TimeMachine]]></category>

		<guid isPermaLink="false">http://kampmeier.com/chris/blog/?p=435</guid>
		<description><![CDATA[Back in April, 2010 we started using Apple&#8217;s Time Machine feature of Mac OS X to automatically back up the hard drives of our iMac and MacBook Pro computers to our QNAP TS-109 Pro NAS server.  Since earlier versions of the QNAP firmware didn&#8217;t have built-in Time Machine support, we used some command line magic [...]]]></description>
			<content:encoded><![CDATA[<p>Back in April, 2010 we started using Apple&#8217;s Time Machine feature of Mac OS X to automatically back up the hard drives of our iMac and MacBook Pro computers to our QNAP TS-109 Pro NAS server.  Since earlier versions of the QNAP firmware didn&#8217;t have built-in Time Machine support, we used some <a href="http://kampmeier.com/chris/blog/?p=204">command line magic</a> to make it happen. Overall, we were pretty happy with the solution and we were able to demonstrate how we could easily <a href="http://kampmeier.com/chris/blog/?p=393">restore the complete hard drive</a> of our iMac using one of the back ups.</p>
<p><a href="http://kampmeier.com/chris/blog/wp-content/uploads/2011/02/Screen-shot-2011-02-21-at-3.36.32-PM.png"><img class="size-medium wp-image-508 alignright" title="Screen shot 2011-02-21 at 3.36.32 PM" src="http://kampmeier.com/chris/blog/wp-content/uploads/2011/02/Screen-shot-2011-02-21-at-3.36.32-PM-300x148.png" alt="" width="300" height="148" /></a></p>
<p>We have since updated to firmware version 3.3.0 Build 0924T, a version that includes built-in support for Time Machine. I figured why not try out the built-in support and move away from the earlier command line-based approach.</p>
<p><span id="more-435"></span></p>
<p><strong>How We Use Time Machine<br />
</strong></p>
<p>Generally, we don&#8217;t really care about recovering individual files through Time Machine.  We mainly use it as an  insurance policy in case one of the drives fails or in those cases where we opt to upgrade to a larger drive.  We&#8217;ve used it in the latter situation with great results.</p>
<p><strong>Enabling Built-in Support</strong></p>
<p>Compared to the command line magic<strong> </strong>of our earlier use of Time Machine with the QNAP device, the built-in support makes Time Machine set up a breeze. Simply:</p>
<ol>
<li>Access Time Machine under the Backup folder of the web console</li>
<li>Mark the Enable checkbox</li>
<li>Enter a password to use on the client machines</li>
<li>Provide a quota to limit how of much of the NAS server&#8217;s capacity to allocate for Time Machine backups</li>
<li>Hit Apply</li>
</ol>
<p>This process will automatically enable the AFP file sharing protocol service on the QNAP because that&#8217;s the only protocol supported by Time Machine clients.</p>
<p><strong>Client Setup</strong></p>
<p>Simply go into the Time Machine area of  System Preferences and select Select Disk&#8230;  You should see the TMBackup share listed.  Once you select this disk, you&#8217;ll need to enter the password you set when enabling the Time Machine feature on the QNAP. Optionally, click Options&#8230; to exclude certain folders from being backed up. For example, you might want to exclude the Downloads folder of each user&#8217;s account. Finally, move the Time Machine slider to On to activate the Time Machine client.</p>
<p><a href="http://kampmeier.com/chris/blog/wp-content/uploads/2011/02/Screen-shot-2011-02-21-at-3.37.17-PM.png"><img class="alignnone size-medium wp-image-512" title="Screen shot 2011-02-21 at 3.37.17 PM" src="http://kampmeier.com/chris/blog/wp-content/uploads/2011/02/Screen-shot-2011-02-21-at-3.37.17-PM-300x197.png" alt="" width="300" height="197" /></a></p>
<p><a href="http://kampmeier.com/chris/blog/wp-content/uploads/2011/02/Screen-shot-2011-02-21-at-3.46.01-PM.png"><img class="alignnone size-medium wp-image-513" title="Screen shot 2011-02-21 at 3.46.01 PM" src="http://kampmeier.com/chris/blog/wp-content/uploads/2011/02/Screen-shot-2011-02-21-at-3.46.01-PM-300x168.png" alt="" width="300" height="168" /></a></p>
<p><strong>Back Up Now</strong></p>
<p>You can click on the Time Machine icon in the system notification area and select Back Up Now to initiate a backup immediately.</p>
<p><a href="http://kampmeier.com/chris/blog/wp-content/uploads/2011/02/Screen-shot-2011-02-21-at-3.49.53-PM.png"><img class="alignnone size-medium wp-image-514" title="Screen shot 2011-02-21 at 3.49.53 PM" src="http://kampmeier.com/chris/blog/wp-content/uploads/2011/02/Screen-shot-2011-02-21-at-3.49.53-PM-300x112.png" alt="" width="300" height="112" /></a></p>
<p>After you back up for the first time you&#8217;ll see your client&#8217;s back up area appear under the Time Machine portion of the QNAP admin console:</p>
<p><a href="http://kampmeier.com/chris/blog/wp-content/uploads/2011/02/Screen-shot-2011-02-21-at-3.36.23-PM.png"><img class="alignnone size-medium wp-image-511" title="Screen shot 2011-02-21 at 3.36.23 PM" src="http://kampmeier.com/chris/blog/wp-content/uploads/2011/02/Screen-shot-2011-02-21-at-3.36.23-PM-300x124.png" alt="" width="300" height="124" /></a></p>
<p><strong>One Hiccup: Problems Connecting to AFP Share<br />
</strong></p>
<p>After initially configuring the built-in Time Machine support, we encountered periodic error messages when attempting to enter the Time Machine app on the clients. An AFP connection error would occur, but eventually we&#8217;d be able to access the Time Machine app. The scheduled back ups worked fine. Lately, we haven&#8217;t seen this issue reappear.</p>
<p><strong>Restoring Files</strong></p>
<p>Although we don&#8217;t typically use Time Machine to restore specific files, the user interface to do so is pretty cool.  Simply click on the Time Machine icon in the notification area and select Enter Time Machine. You&#8217;ll see a series of Finder windows representing the state of your files at each back up point.  You can right-click any file to restore it from that time.</p>
<p><a href="http://kampmeier.com/chris/blog/wp-content/uploads/2011/02/Screen-shot-2011-02-21-at-4.18.34-PM.png"><img class="alignnone size-medium wp-image-517" title="Screen shot 2011-02-21 at 4.18.34 PM" src="http://kampmeier.com/chris/blog/wp-content/uploads/2011/02/Screen-shot-2011-02-21-at-4.18.34-PM-300x187.png" alt="" width="300" height="187" /></a></p>
<p><strong>Restoring Complete Drive</strong></p>
<p>We&#8217;ve done this at least twice with our iMac: once to ensure that the process worked and once after we replaced the internal SSD with a larger capacity unit. In both cases, the process was simple and worked as expected. The process is pretty straightforward: boot from the Mac OS X install DVD and launch the Disk Utility to perform a restore from a Time Machine share.  Of course, you&#8217;ll have to format a new drive before performing the restore, but otherwise it&#8217;s a straightforward operation.</p>
<p><strong>Adjusting Backup Schedule</strong></p>
<p>Apple&#8217;s Time Machine is hardwired to back up every hour.  This is overkill for our needs. As such, we installed <a href="http://www.klieme.com/TimeMachineScheduler.html">Time Machine Scheduler</a>, a third party program to exert more control over the backup schedule.</p>
<p><a href="http://kampmeier.com/chris/blog/wp-content/uploads/2011/02/Screen-shot-2011-02-21-at-3.37.40-PM.png"><img class="alignnone size-medium wp-image-518" title="Screen shot 2011-02-21 at 3.37.40 PM" src="http://kampmeier.com/chris/blog/wp-content/uploads/2011/02/Screen-shot-2011-02-21-at-3.37.40-PM-300x104.png" alt="" width="300" height="104" /></a></p>
<p><a href="http://kampmeier.com/chris/blog/wp-content/uploads/2011/02/Screen-shot-2011-02-21-at-3.37.51-PM.png"><img class="alignnone size-medium wp-image-519" title="Screen shot 2011-02-21 at 3.37.51 PM" src="http://kampmeier.com/chris/blog/wp-content/uploads/2011/02/Screen-shot-2011-02-21-at-3.37.51-PM-300x207.png" alt="" width="300" height="207" /></a></p>
<p>You can specify the back up interval and periods of the day during which back ups will be skipped. Using this program is a bit confusing as it disables Time Machine and takes over scheduling of the backups.</p>
<p>In four months of using this app, we&#8217;ve had good luck with it.</p>
]]></content:encoded>
			<wfw:commentRss>http://kampmeier.com/chris/blog/?feed=rss2&#038;p=435</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Replacing Internal Drive on QNAP TS-109 Pro</title>
		<link>http://kampmeier.com/chris/blog/?p=490</link>
		<comments>http://kampmeier.com/chris/blog/?p=490#comments</comments>
		<pubDate>Sat, 19 Feb 2011 15:22:04 +0000</pubDate>
		<dc:creator>ckamps</dc:creator>
				<category><![CDATA[Home Network Storage]]></category>
		<category><![CDATA[Backup]]></category>
		<category><![CDATA[NAS]]></category>
		<category><![CDATA[Q-RAID]]></category>

		<guid isPermaLink="false">http://kampmeier.com/chris/blog/?p=490</guid>
		<description><![CDATA[We&#8217;ve been chewing up a lot of space on our NAS server as we&#8217;ve ripped and encoded our DVD collection and began recording over-the-air (OTA) TV shows through a new EyeTV dongle on our iMac. So it was time to increase the NAS&#8217; storage capacity from the original 500 GB to at least 1 TB.  [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;ve been chewing up a lot of space on our NAS server as we&#8217;ve ripped and encoded our DVD collection and began recording over-the-air (OTA) TV shows through a new EyeTV dongle on our iMac. So it was time to increase the NAS&#8217; storage capacity from the original 500 GB to at least 1 TB.  As I&#8217;ve come to expect with administration of the QNAP TS-109 device, the task of swapping out the original drive with a larger unit was pretty simple.</p>
<p><span id="more-490"></span></p>
<p><strong>Original Drives Started to Fail</strong></p>
<p>Since one of the three original 500 GB drives failed late last year, I was also motivated to replace the two remaining three-year old drives in <a href="http://kampmeier.com/chris/blog/?p=13">our three-drive rotation scheme</a>. Given that the two active drives &#8211; one internal and one external &#8211; run 24&#215;7, it didn&#8217;t surprise me that the original drives were starting to have issues.</p>
<p>When one of the original 500 GB drives failed, I opted to purchase a single 1 TB Western Digital WD10EARS-00Z5B1 unit as a relacement.  I chose the &#8220;green&#8221; drive because I knew the TS-109 wasn&#8217;t a blazingly fast device to begin with and I wanted to see if the &#8220;green&#8221; aspect would further reduce power consumption.</p>
<p>Even though I had replaced one of the external 500 GB drivers with a 1 TB unit, our overall NAS server capacity was still limited to 500 GB due to the size of the internal drive.</p>
<p><strong>1.5 TB or 2 TB?</strong></p>
<p>Although the latest TS-109 firmware supports 2 TB drives (we&#8217;re running firmware 3.3.0 Build 0924T), I had read too  many complaints about the 2 TB version of this model line even outside  of the context of using them in QNAP devices. Since the 1 TB WD10EARS drive seemed to work fine for the past several months and seemed to be quite cooler to the touch than the prior drives, I purchased two 1.5 TB WD15EARS-00MVWB0 units at $75 USD each through Amazon.</p>
<p><strong>How About a New and Faster NAS Server?</strong></p>
<p>I briefly considered purchasing a newer NAS server to achieve a dramatic performance boost, but I chose not to bite the bullet now because the QNAP has been so reliable and contains all of the functions we need from a home NAS server.  Yes, performance could be a lot better, but we haven&#8217;t had any issues with streaming videos to various devices around the home.  Large file transfers can take more time than I&#8217;d like, but we rarely perform such tasks in real-time.  Plus, our off-site rotation scheme has worked brilliantly and I&#8217;ve appreciated the flexibility of how we can have diverse drive capacities in our setup as drives inevitably fail and are replaced with newer units with larger capacities.</p>
<p><strong>The Replacement Approach</strong></p>
<p>If you&#8217;re using the Q-RAID 1 quasi RAID feature then task of replacing the internal drive is supposed to be quite simple:</p>
<ul>
<li>Open up the NAS server and remove the internal drive.</li>
<li>Install in the NAS server one of the external drives that had been sync&#8217;d using Q-RAID 1.</li>
<li>Reboot and you&#8217;re done.</li>
</ul>
<p>Since we already had our 1 TB drive attached externally and sync&#8217;d, I opted to start by replacing the 500 GB internal with the 1 TB external.  As advertised, the replacement and reboot went off without a hitch.  Once rebooted, all of the settings and data were intact and our overall capacity was doubled from the earlier 500 GB internal drive.</p>
<p>The next step was to place one of the new 1.5 TB drives into the eSATA drive caddy, format it using the QNAP web console and apply the Q-RAID 1 syncing feature to it.  This process also worked as expected.</p>
<p><strong>Future: Swap 1 TB Internal with 1.5 TB External</strong></p>
<p>Although we doubled our NAS capacity from 500 GB to 1 TB, it will be easy for us to replace the 1 TB internal drive with one of the 1.5 TB drives in the future. However, as we consume more than 1 TB of the internal 1.5 TB drive, we wouldn&#8217;t be able to use the 1 TB as an external drive.</p>
<p><strong>Summary</strong></p>
<p>All in all, this was a great experience that further reinforced my positive impression of the QNAP device and overall quality of their firmware.  I&#8217;ve read about issues concerning various apps and NFS performance, but for the really important basics of backup and restoration functions, I am very pleased with the device.</p>
]]></content:encoded>
			<wfw:commentRss>http://kampmeier.com/chris/blog/?feed=rss2&#038;p=490</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>
