<?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>Tyler Clemons &#187; iTunes</title>
	<atom:link href="http://www.tylerclemons.com/category/general/itunes/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.tylerclemons.com</link>
	<description>tylerclemons.com</description>
	<lastBuildDate>Wed, 26 May 2010 18:39:58 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Creating Adium Scripts (iTunes)</title>
		<link>http://www.tylerclemons.com/creating-adium-scripts-itunes/</link>
		<comments>http://www.tylerclemons.com/creating-adium-scripts-itunes/#comments</comments>
		<pubDate>Sun, 31 Aug 2008 01:09:26 +0000</pubDate>
		<dc:creator>Tyler</dc:creator>
				<category><![CDATA[Adium]]></category>
		<category><![CDATA[AppleScript]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[iTunes]]></category>

		<guid isPermaLink="false">http://tylershome.nfshost.com/?p=41</guid>
		<description><![CDATA[I use Adium and iTunes frequently.  One of the cool things about the OS X environment is the integration between applications.  For instance, Adium contacts can be linked to Address Book accounts.  One of my personal favorites is the integration of Adium and iTunes.  Adium can display details of what is [...]]]></description>
			<content:encoded><![CDATA[<p>I use Adium and iTunes frequently.  One of the cool things about the OS X environment is the integration between applications.  For instance, Adium contacts can be linked to Address Book accounts.  One of my personal favorites is the integration of Adium and iTunes.  Adium can display details of what is currently playing on iTunes such as the name of the song and the artist.  The trick is customizing these messages so that they can be presented as suitable away or status messages.<br />
<span id="more-20"></span></p>
<p>The best way to learn these concepts is to open up one.  That is just what I did.  I found a script that formatted iTunes data.  I was not satisfied with all of its features so I modified it.  I left credit to the original authors in the modified script.</p>
<p>First, we need to create a file structure.  Create a folder called <strong>name.AdiumScripts</strong>.  name can be anything you like, just make sure you don&#8217;t forget it.  Then right click(CTLR+click), and click ’show package contents.’  Create a folder called <strong>Contents</strong>.  Inside Contents, create a folder called <strong>Resources</strong>.  The result:</p>
<p>-&gt;name.AdiumScripts<br />
–&gt;Contents<br />
—-&gt;Resources</p>
<p>Enter the contents folder. Click<span style="color: #888888;"> <a title="Info2" href="http://tylershome.nfshost.com/info2.zip" target="_blank">HERE</a></span> for the info.plist file that will direct Adium where to get your script.  Place it in the contents folder.</p>
<p>The following is how the file looks:</p>
<div id="codebox" style="overflow: auto; ">&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;UTF-8&#8243;?&gt;<br />
&lt;!DOCTYPE plist PUBLIC &#8220;-//Apple Computer//DTD PLIST 1.0//EN&#8221; &#8220;http://www.apple.com/DTDs/PropertyList-1.0.dtd&#8221;&gt;<br />
&lt;plist version=&#8221;1.0&#8243;&gt;<br />
&lt;dict&gt;<br />
<span style="padding-left: 10px;">&lt;key&gt;CFBundleDevelopmentRegion&lt;/key&gt;</span><br />
<span style="padding-left: 10px;">&lt;string&gt;English&lt;/string&gt;</span><br />
<span style="padding-left: 10px;">&lt;key&gt;CFBundleExecutable&lt;/key&gt;</span><br />
<span style="padding-left: 10px;">&lt;string&gt;Adium&lt;/string&gt;</span><br />
<span style="padding-left: 10px;">&lt;key&gt;CFBundleGetInfoString&lt;/key&gt;</span><br />
<span style="padding-left: 10px;">&lt;string&gt;Nameit&lt;/string&gt;</span><br />
<span style="padding-left: 10px;">&lt;key&gt;CFBundleIdentifier&lt;/key&gt;</span><br />
<span style="padding-left: 10px;">&lt;string&gt;com.adiumx.iTunes.scripts&lt;/string&gt;</span><br />
<span style="padding-left: 10px;">&lt;key&gt;CFBundleInfoDictionaryVersion&lt;/key&gt;</span><br />
<span style="padding-left: 10px;">&lt;string&gt;1.2&lt;/string&gt;</span><br />
<span style="padding-left: 10px;">&lt;key&gt;CFBundleName&lt;/key&gt;</span><br />
<span style="padding-left: 10px;">&lt;string&gt;<strong>name</strong>&lt;/string&gt;</span><br />
<span style="padding-left: 10px;">&lt;key&gt;CFBundlePackageType&lt;/key&gt;</span><br />
<span style="padding-left: 10px;">&lt;string&gt;AdIM&lt;/string&gt;</span><br />
<span style="padding-left: 10px;">&lt;key&gt;Scripts&lt;/key&gt;</span><br />
<span style="padding-left: 10px;">&lt;array&gt;</span><br />
<span style="padding-left: 20px;">&lt;dict&gt;</span><br />
<span style="padding-left: 30px;">&lt;key&gt;File&lt;/key&gt;</span><br />
<span style="padding-left: 30px;">&lt;string&gt;<span style="color: #ffff00;"><strong>name</strong></span>&lt;/string&gt;</span><br />
<span style="padding-left: 30px;">&lt;key&gt;Keyword&lt;/key&gt;</span><br />
<span style="padding-left: 30px;">&lt;string&gt;<strong>%<span style="color: #ffff00;">_name</span></strong>&lt;/string&gt;</span><br />
<span style="padding-left: 30px;">&lt;key&gt;Prefix Only&lt;/key&gt;</span><br />
<span style="padding-left: 30px;">&lt;false/&gt;</span><br />
<span style="padding-left: 30px;">&lt;key&gt;Requires User Interaction&lt;/key&gt;</span><br />
<span style="padding-left: 30px;">&lt;false/&gt;</span><br />
<span style="padding-left: 30px;">&lt;key&gt;Title&lt;/key&gt;</span><br />
<span style="padding-left: 30px;">&lt;string&gt;Message iTunes data&lt;/string&gt;</span><br />
<span style="padding-left: 20px;">&lt;/dict&gt;</span><br />
<span style="padding-left: 10px;">&lt;/array&gt;</span><br />
<span style="padding-left: 10px;">&lt;key&gt;Set&lt;/key&gt;</span><br />
<span style="padding-left: 10px;">&lt;string&gt;<span style="color: #ffff00;"><strong>Nameit</strong></span>&lt;/string&gt;</span><br />
&lt;/dict&gt;<br />
&lt;/plist&gt;</div>
<p><span style="color: #ffff00;"><strong>name</strong></span> corresponds to the name of your project from earlier.  Under &lt;key&gt;File&lt;/key&gt;, we specify the <span style="color: #ffff00;"><strong>name </strong></span>of the script file that will be called each time <span style="color: #ffff00;"><strong>%_name</strong></span> is called.  Of course, you can change any of these.  It is also possible to create more callable scripts by copying and pasting.</p>
<p>Now enter the <em>Resources</em> folder.  Create a file called <span style="color: #ffff00;"><strong>name</strong></span>, or whatever you may have changed <strong><span style="color: #ffff00;">name</span> </strong>to, with the file extension <em>.scpt.</em> You can either use your favorite text editor or the Script Editor.  This is where we will create our actual script that displays the data.</p>
<p>The following script has the following sample output:</p>
<p>Reading and listening to You Are The Pan<br />
By John Williams<br />
From Hook (Original Motion Picture Soundtrack).</p>
<p>The first line is shows my default action combined with the current song name.  The next lines are the artist, and the album.  If iTunes is not active, whether it is paused or not open, the default action will appear.  In the above example, the default action is Reading.  The modified script can be found by clicking <a title="Sample script" href="http://tylershome.nfshost.com/name.scpt">HERE.</a></p>
<p>The code is pretty simple to follow so I won&#8217;t go into details here.  It is very simple to add more formatting.  It is just a matter of copying and pasting.  The column names found in iTunes are pretty much the same as they are in AppleScript e.g. to access the genre of a track, just use the variable genre.  Adding more substitutions, that is adding more features like %_name, is as simple as expanding the XML tree and placing the new script files in the same directory.</p>
<p>Like always, if you plan on creating a published add-on, be sure to adhere to any current standards.  And that&#8217;s it.  Just click on name.AdiumScripts to install.<br />
<em><span style="text-decoration: underline;"><span style="color: #ff0000;"><br />
Your files will be installed in Library/Application Support/Adium 2.0/Scripts</span></span></em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.tylerclemons.com/creating-adium-scripts-itunes/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>iTunes Scripting with Python</title>
		<link>http://www.tylerclemons.com/itunes-scripting-with-python/</link>
		<comments>http://www.tylerclemons.com/itunes-scripting-with-python/#comments</comments>
		<pubDate>Fri, 29 Aug 2008 23:48:08 +0000</pubDate>
		<dc:creator>Tyler</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[appscript]]></category>
		<category><![CDATA[iTunes]]></category>
		<category><![CDATA[scripting]]></category>

		<guid isPermaLink="false">http://tylershome.nfshost.com/?p=37</guid>
		<description><![CDATA[I ran across scripting for the Mac OSX awhile ago.  I finally decided to take a look at it when I decided to play around with Adium&#8217;s open source code.  The most dominant prescene I observed was Applescript.  Applescript is nice and all, but Python is nicer.  Scripting OSX applications with [...]]]></description>
			<content:encoded><![CDATA[<p>I ran across scripting for the Mac OSX awhile ago.  I finally decided to take a look at it when I decided to play around with Adium&#8217;s open source code.  The most dominant prescene I observed was Applescript.  Applescript is nice and all, but Python is nicer.  Scripting OSX applications with Python has been around for a bit.  Using the easy to install <a title="appscript" href="http://appscript.sourceforge.net/" target="_blank">appscript</a>, scripting can be leveraged by the power of Python and Ruby.</p>
<p><span id="more-17"></span></p>
<p>One of my favorite applications on my Mac is iTunes, so its no surprise this is the first application I turned to for testing.  To start, import the proper library:</p>
<div id="codebox" style="overflow: auto; "><code><span style="color: #ff6600;">from</span> appscript <span style="color: #ff6600;">import </span>*</code></div>
<p>Afterward, we can create a handle to iTunes and tell it to play:</p>
<div id="codebox" style="overflow: auto; "><code>itunes = app(<span style="color: #ff0000;">'itunes'</span>)<br />
itunes.play()</code></div>
<p>Running the above lines will open up the application called iTunes and execute the action play.  It will play the current track and specific tracks can be passed as an argument.  The action .stop() will stop iTunes.  Of course, we can do so much more with appscript.  For instance, we can create a playlist that only plays a specific album.  I wrote a script that does just that.</p>
<p>The script can be found <a title="iTunes Script" href="http://tylershome.nfshost.com/iTunesPlist.zip">HERE</a> in a zipped file.</p>
<p>It is documented and should be easy to follow.  One more thing, it is also possible to assign values to each track as if they were normal data objects.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tylerclemons.com/itunes-scripting-with-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
