<rss version="2.0">
  <channel>
    <title>Freezerpants.com - Posts Tagged with cron</title>
    <link>http://freezerpants.com/category/cron/</link>
    <description>A logahead powered blog</description>
    <language>en</language>
    <lastBuildDate>Fri, 21 Nov 2008 21:48:54 +0000</lastBuildDate>
<item><title>toledo 0.0.4.2</title><link>http://freezerpants.com/2008/04/12/toledo_0042</link><description>&lt;p&gt;I don&amp;#039;t know that this is going to warrant a blog post every time I &quot;update&quot; toledo...but..&lt;/p&gt;

&lt;p&gt;I&amp;#039;ve updated toledo to &lt;a href=&quot;http://freezerpants.com/toledo/&quot;&gt;0.0.4.2&lt;/a&gt; . It&amp;#039;s far from &quot;perfect&quot;, but it&amp;#039;s rock solid and works completely.&lt;/p&gt;

&lt;p&gt;While working, I&amp;#039;ve actually been using toledo to update my &lt;span class=&quot;caps&quot;&gt;LED &lt;/span&gt;sign with my current iTunes track. I put it on the &quot;B&quot; page, then linked pages &quot;A&quot; and &quot;B&quot;. In short it alternates between displaying data on the &quot;A&quot; page and the current song on the &quot;B&quot; page. &lt;/p&gt;

&lt;p&gt;As I test the software I am writing, I just use the &quot;A&quot; page so the music page continues to alternate through with no issues.&lt;/p&gt;

&lt;p&gt;So how, you might ask, am I getting the iTunes track info, exactly?&lt;br /&gt;
Glad you asked. &lt;/p&gt;

&lt;p&gt;Here is a quick&amp;#039;n&amp;#039;dirty applescript to do exactly what you need.&lt;/p&gt;

&lt;p&gt;tunesled.app&lt;br /&gt;
&lt;code&gt;tell application &amp;quot;System Events&amp;quot; to set doit to (exists process &amp;quot;iTunes&amp;quot;)&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;tell application &amp;quot;iTunes&amp;quot; to set doit to doit and (player state is playing)&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;if doit then&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;tell application &amp;quot;iTunes&amp;quot;&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;set trk_arts to the artist of the current track&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;set trk_name to the name of the current track&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;set trk_albm to the album of the current track&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;end tell&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;set trk_desc to quoted form of (trk_arts &amp;amp;amp; &amp;quot; | &amp;quot; &amp;amp;amp; trk_name)&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;set the_command to &amp;quot;/Path/To/toledo.py --page=\&amp;quot;B\&amp;quot; --speed=\&amp;quot;4\&amp;quot; --line=\&amp;quot;2\&amp;quot; --message=\&amp;quot;&amp;quot; &amp;amp;amp; trk_desc &amp;amp;amp; &amp;quot;\&amp;quot; --output&amp;quot;&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;end if&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Save this as an app, then in terminal, add this to your crontab&lt;br /&gt;
&lt;code&gt;*/2 * * * * osascript /Path/To/tunesled.app&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;And TaDa!&lt;/p&gt;

&lt;p&gt;*Special note:&lt;br /&gt;
Leopard users, you will see your console fill with &lt;code&gt;Could not setup Mach task special port 9:(os/kern) no access&lt;/code&gt;&lt;br /&gt;
To fix this, see &lt;a href=&quot;http://macosx.com/forums/mac-os-x-system-mac-software/296344-leopard-user-crontab-2.html&quot;&gt;here&lt;/a&gt;&lt;/p&gt;</description><pubDate>Sat, 12 Apr 2008 23:33:00 +0000</pubDate></item>  </channel>
</rss>