|
|
@@ -21,7 +21,7 @@ import uuid
|
|
|
import argparse
|
|
|
|
|
|
def DEBUG(debug,msg):
|
|
|
- if debug is not None:
|
|
|
+ if debug is True:
|
|
|
print("..DEBUG: " + msg)
|
|
|
|
|
|
|
|
|
@@ -43,16 +43,23 @@ try:
|
|
|
|
|
|
# contactID abfragen
|
|
|
contactID=row[0]
|
|
|
+ familyN=row[6]
|
|
|
+ givenN=row[4]
|
|
|
+ fullN=row[1]
|
|
|
+ cardfile=args.output + "/" + fullN.replace(" ","_") + ".vcf"
|
|
|
+
|
|
|
|
|
|
# wir erstellen das Objekt
|
|
|
vcf = vobject.vCard()
|
|
|
|
|
|
vcf.add('uid').value = str(uuid.uuid4())
|
|
|
#vcf.add('uid').value = "Testdaten"
|
|
|
- vcf.add('n').value = vobject.vcard.Name( family=row[6], given=row[4] )
|
|
|
- vcf.add('fn').value =row[1]
|
|
|
+ vcf.add('n').value = vobject.vcard.Name( family=familyN, given=givenN )
|
|
|
+ vcf.add('fn').value =fullN
|
|
|
+
|
|
|
|
|
|
- DEBUG(args.debug,"Contact " + row[1])
|
|
|
+ print("exporting " + fullN + " to file " + cardfile)
|
|
|
+ DEBUG(args.debug,"Contact " + fullN)
|
|
|
|
|
|
# abfrage der Adressdaten
|
|
|
SQLADRCur = SQLconn.cursor()
|
|
|
@@ -171,7 +178,9 @@ try:
|
|
|
continue
|
|
|
|
|
|
# Ausgabe
|
|
|
- print(vcf.serialize())
|
|
|
+ f = open(cardfile,'w')
|
|
|
+ f.write(vcf.serialize())
|
|
|
+ f.close()
|
|
|
|
|
|
# hier brauchen wir einige eception handles -> wie bekommen wir die einzelnen exceptions heruas ?
|
|
|
#except:
|