chiark / gitweb /
changed graphs to manual dot file; added pictures; faffed about with text
[familyTree.git] / familyTree / text2SQL.py
index 1749197a73b76492d15111517313a96e5a27615d..6185b7f5bde4faf90b800c8a8173f2755bec4d0a 100755 (executable)
@@ -34,7 +34,11 @@ for line in f:
        if lastline == 'Name:':
                names = thisline.split()
                if len(names)>0:
-                       firstName = add_quotes(names[0])
+                       notNames = ['Prince','Princess','St']
+                       if names[0] in notNames:
+                               firstName = add_quotes(names[1])
+                       else:
+                               firstName = add_quotes(names[0])
                else:
                        firstName = ''
                thisName = add_quotes(thisline)
@@ -46,7 +50,11 @@ for line in f:
                yd = findYear.find_year(thisline)
                md = findYear.find_month(thisline)
                thisDied =  add_quotes(thisline)
-               finishedRecord = 1
+               finishedRecord=1
+       if lastline == 'URL:':
+               url = add_quotes(thisline)
+       if lastline == 'Picture:':
+               picture = add_quotes(thisline)
        if lastline == 'Father:':
                a = is_number(thisline)
                s = make_insert('parents',[thisID, a])
@@ -58,7 +66,8 @@ for line in f:
        
        if finishedRecord ==1:
                s = make_insert('people',\
-               [thisID,thisName,firstName,thisBorn,yb,thisDied,yd,mb,md])
+               [thisID,thisName,firstName,thisBorn,yb,\
+                       thisDied,yd,mb,md,url,picture])
                print s
                finishedRecord = 0
        if lastline == 'Style:':