<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>flashbake/plugins/current_track.scpt</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -14,14 +14,19 @@
 #
 #    You should have received a copy of the GNU General Public License
 #    along with flashbake.  If not, see &lt;http://www.gnu.org/licenses/&gt;.
+#
+# the iTunes class is based on the itunes.py by Andrew Wheiss, originally
+# licensed under an MIT License
 
 '''  music.py - Plugin for gathering last played tracks from music player. '''
 
-import sqlite3
-import os.path
+from flashbake.plugins import AbstractMessagePlugin, AbstractMessagePlugin
 import logging
+import os
+import os.path
+import sqlite3
+import string
 import time
-from flashbake.plugins import AbstractMessagePlugin
 
 
 
@@ -66,3 +71,37 @@ limit %d&quot;&quot;&quot;
             conn.close()
 
         return True
+
+
+class iTunes(AbstractMessagePlugin):
+    ''' Based on Andrew Wheiss' plugin which is MIT licensed which should be compatible. '''
+    def __init__(self):
+        self.define_property('osascript')
+        
+    def init(self, config):
+        if self.osascript is None:
+            self.osascript = flashbake.findexecutable('osascript')
+            
+    def addcontext(self, message_file, config):
+        &quot;&quot;&quot; Get the track info and write it to the commit message &quot;&quot;&quot;
+        info = self.trackinfo()
+
+        if info is None:
+            message_file.write('Couldn\'t get current track.\n')
+        else:
+            message_file.write('%s' % info)
+
+        return True
+
+    def trackinfo():
+        ''' Call the AppleScript file. '''
+        if self.osascript is None:
+            return None
+        directory = os.path.dirname(__file__)
+        script_path = os.path.join(directory, 'current_track.scpt')
+        
+        args = [self.osascript, script_path]
+        proc = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
+                             close_fds = True)
+        
+        return proc.communicate()[0]</diff>
      <filename>flashbake/plugins/music.py</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>eaede976e8ef3e2e43d2056316f5429952747fb6</id>
    </parent>
  </parents>
  <author>
    <name>Thomas Gideon</name>
    <email>cmdln@thecommandline.net</email>
  </author>
  <url>http://github.com/commandline/flashbake/commit/d9b3cbdea5322de596f435dcb30fba8c0156a5fd</url>
  <id>d9b3cbdea5322de596f435dcb30fba8c0156a5fd</id>
  <committed-date>2009-11-06T12:02:03-08:00</committed-date>
  <authored-date>2009-11-06T12:02:03-08:00</authored-date>
  <message>Merged in iTunes script.</message>
  <tree>dd7c72df8bc669be9a31d8be1894f7efb04ea363</tree>
  <committer>
    <name>Thomas Gideon</name>
    <email>cmdln@thecommandline.net</email>
  </committer>
</commit>
