Skip to content

Commit

Permalink
Replaced Aete2sdef with a python script that outputs the sdef and hea…
Browse files Browse the repository at this point in the history
…der files for the current version of iTunes.
  • Loading branch information
kgn committed Jun 23, 2011
1 parent 8467f3f commit 191ea92
Show file tree
Hide file tree
Showing 13 changed files with 45 additions and 64 deletions.
51 changes: 0 additions & 51 deletions Aete2sdef1.1/Aete2sdef.app/Contents/Info.plist

This file was deleted.

Binary file removed Aete2sdef1.1/Aete2sdef.app/Contents/MacOS/Aete2sdef
Binary file not shown.
1 change: 0 additions & 1 deletion Aete2sdef1.1/Aete2sdef.app/Contents/PkgInfo

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.
1 change: 0 additions & 1 deletion Aete2sdef1.1/Aete2sdefHelp.html

This file was deleted.

8 changes: 0 additions & 8 deletions Aete2sdef1.1/Aete2sdef_HomePage.webloc

This file was deleted.

Binary file removed Aete2sdef1.1/Scripts/Aete2sdef.asdictionary
Binary file not shown.
1 change: 0 additions & 1 deletion Aete2sdef1.1/Scripts/ConvertAete.scr

This file was deleted.

1 change: 0 additions & 1 deletion Aete2sdef1.1/Scripts/GetVersion.scr

This file was deleted.

45 changes: 45 additions & 0 deletions iTunes.py
@@ -0,0 +1,45 @@
#!/usr/bin/env python

# Update the AppleScript information for iTunes

from __future__ import with_statement

import os
import plistlib
import subprocess
import xml.dom.minidom

k_iTunesApp = '/Applications/iTunes.app'
k_iTunesDir = os.path.abspath('./iTunes')

def GetVersion():
'''Get the current iTunes version'''
infoPlist = os.path.join(k_iTunesApp, 'Contents', 'Info.plist')
return plistlib.readPlist(infoPlist)['CFBundleVersion']

def SaveSdef(output):
'''Save the iTunes sdef xml to disk'''
proc = subprocess.Popen('sdef %s' % k_iTunesApp, shell=True,
stdout=subprocess.PIPE, stderr=subprocess.PIPE
)
stdout, stderr = proc.communicate()
if stderr:
raise RuntimeError(stderr)
dom = xml.dom.minidom.parseString(stdout.strip())
with open(output, 'w') as file:
file.write(dom.toprettyxml(encoding='utf-8'))

def SaveHeader(output):
'''Save the iTunes header file to disk'''
proc = subprocess.Popen('sdef %s | sdp -fh --basename iTunes -o "%s"' % (k_iTunesApp, output),
shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE
)
stdout, stderr = proc.communicate()
if stderr:
raise RuntimeError(stderr)

if __name__ == '__main__':
version = GetVersion()
basename = 'iTunes%s' % version
SaveHeader(os.path.join(k_iTunesDir, '%s.h' % basename))
SaveSdef(os.path.join(k_iTunesDir, '%s.sdef' % basename))

0 comments on commit 191ea92

Please sign in to comment.