#!/usr/bin/python # ------------------------------------------------ # sogudi2qs.py # # Exports Sogudi searches to mozilla quicksearches # # Author: # Salvatore Montefusco # www.brightpebbles.org # # Usage: # # python sogudi2qs.py [file] >quicksearches.html # ----------------------------------------------- import sys, getopt, os, re from xml.dom import minidom import xml if len(sys.argv) < 2: theSource = os.path.expanduser('~/Library/Application Support/SogudiShortcuts.plist') if not os.path.exists(theSource) : sys.exit("SogudiShortcuts.plist not found in Application Support folder.") else: theSource = sys.argv[1] if not os.path.isfile(theSource) : sys.exit("Input is not a file! \n Usage: sogudi2qs.py [file] > quicksearches.html") try: xmldoc = minidom.parse(theSource) except xml.parsers.expat.ExpatError: sys.exit("Error parsing the document!") for dict in xmldoc.getElementsByTagName('dict') : data = {} for key in dict.getElementsByTagName('key') : data[key.firstChild.data] = key.nextSibling.nextSibling.firstChild.data print """\
""" for key in data : print '
"""