Skip to content

Instantly share code, notes, and snippets.

Created July 17, 2013 00:25
Show Gist options
  • Select an option

  • Save anonymous/6016541 to your computer and use it in GitHub Desktop.

Select an option

Save anonymous/6016541 to your computer and use it in GitHub Desktop.
import os
# Dirty hack Pidgin to Adium emote pack converter!
# Coded by Washbucket from TEST
def findfile(fn): #find the correct file. I hope.
for i in os.listdir("./"):
if i.lower() == fn.lower():
return i
return None
f = open("theme")
print """<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AdiumSetVersion</key>
<integer>1</integer>
<key>Emoticons</key>
<dict>"""
for i in f.readlines():
if i[0] == "!":
ii = i.split()
if ii[1] in os.listdir("./"): #Look for file. Also this checks case.
print "<key>%s</key>" % ii[1] # Found file so just use name as normal.
else:
if os.path.exists(ii[1]): #Look for file agin. This time ignoring case.
print "<key>%s</key>" % findfile(ii[1]) #Find the file name with correct case.
else:
continue #Bail, we can't find the file at all!
print "<dict>\n\t<key>Equivalents</key>\n\t<array>"
for a in ii[2:]:
print "\t\t<string>%s</string>" % a
print "\t</array>\n\t<key>Name</key>\n\t<string>%s</string>\n</dict>\n" % ".".join(ii[1].split(".")[:-1])
f.close()
print """</dict>
</dict>
</plist>"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment