/usr/share/doc/claws-mail/tools/eud2gc.py is in claws-mail-tools 3.16.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | #!/usr/bin/python
import string, sys
def lReadEfile(sFileName):
try:
sLines = open(sFileName).read()
except:
print ('Error opening %s' %sFileName)
lLines = []
lLines = string.splitfields(sLines, '\n')
return lLines
def dElines2Dict(lElines):
dAliases = {}
for sEntry in lElines:
if '"' in sEntry:
lChunks = string.splitfields(sEntry, '"')
else:
lChunks = string.splitfields(sEntry, ' ')
if lChunks[0] <> 'alias':
print ('ignoring invalid line: %s' %sEntry)
else:
sAdresses = string.joinfields(lChunks[2:], ',')
print ('Entry added: %s %s' %(lChunks[1],sEntry))
dAliases[lChunks[1]]=sAdresses
return dAliases
def vWriteGfile(dAliases, sFileName):
try:
oFile = open(sFileName, 'w')
except:
print ('Error opening %s' %sFileName)
return 0
for sKey in dAliases.keys():
#print ('BEGIN:VCARD')
#print ('N:;%s' %sKey)
#print ('BDAY:')
#print ('ADR;HOME:;;;;;;')
#print ('TEL:;')
#print ('EMAIL;INTERNET:%s' %dAliases[sKey])
#print ('END:VCARD')
oFile.write ('BEGIN:VCARD\n')
oFile.write ('FN:%s\n' %sKey)
oFile.write ('N:;%s\n' %sKey)
oFile.write ('BDAY:\n')
oFile.write ('ADR;HOME:;;;;;;;\n')
oFile.write ('TEL:;\n')
oFile.write ('EMAIL;INTERNET:%s\n' %dAliases[sKey])
oFile.write ('END:VCARD\n')
oFile.close()
return 1
if __name__ == '__main__':
if len(sys.argv) >= 3:
sEfileName = sys.argv[1]
sGfileName = sys.argv[2]
lAliases = lReadEfile(sEfileName)
dAliases = dElines2Dict(lAliases)
if vWriteGfile(dAliases, sGfileName) == 1:
print ('Done!')
else:
print ('Error saving output-file')
else:
print ('Usage:\n %s <Eudora addressbook> <Gnomecard file>' %sys.argv[0])
|