Just wanted to share this small python code that naïvely converts a signify parameter file into a RSS file that can be used in GMail with the Random Signature Appender lab feature.
It doesn’t support any magical option of Signify (alignment, variable replacement). However, current lab feature has limitation to 96 chars in signature. This definitively sucks.
Published under the WTFPL.
´´´ import lxml.etree as et import sys import StringIO import codecs
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar
14 rue de Plaisance, 75014 Paris, France
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.
take first command line parameter as input file
f = codecs.open( sys.argv[1], “r”, “utf-8” )
signs = [] current_signature = ""
preamble = """ <rss version=“0.91”> <channel> <title>Signify converted signatures</title> <taxonomy: tag: [backup] language>en-us</language> </channel> </rss> """
tree = et.parse(StringIO.StringIO(preamble)) channelNode = tree.xpath(’/rss/channel’)[0] count = 0
for line in f: line = line.rstrip() if line.find("#") == 0: line = line
do nothing
elif line.find(’%’) == 0: if len(current_signature) > 0: signs.append(current_signature)
item = et.Element(“item”) title = et.Element(“title”) title.text = current_signature
item.append(title) channelNode.append(item)
count += 1 current_signature = "" else:
current_signature += line + " "
print et.tostring(tree, xml_declaration=True, encoding=“utf-8”) ´´´ {% endraw %}