else:
Source.counter += 1
self.num = Source.counter
- if tree and data:
- tree.sources[data['id']] = self
self.url = self.citation = self.title = self.fid = None
self.notes = set()
+ def get_data(self, data):
if data:
self.fid = data['id']
if 'about' in data:
else:
Indi.counter += 1
self.num = Indi.counter
+ self.downloaded = False
self.fid = fid
self.tree = tree
self.famc_fid = set()
self.fams_num = set()
self.name = None
self.gender = None
+ self.parents = self.children = self.spouses = None
self.baptism = self.confirmation = self.endowment = self.sealing_child = None
self.nicknames = set()
self.facts = set()
self.notes = set()
self.sources = set()
self.memories = set()
- if fid and tree and tree.fs:
+
+ def get_data(self):
+ if fid and tree and tree.fs and not self.downloaded:
+ self.downloaded = True
url = 'https://familysearch.org/platform/tree/persons/%s.json' % self.fid
data = tree.fs.get_url(url)
if data:
for y in data['sourceDescriptions']:
self.memories.add(Memorie(y))
- self.parents = None
- self.children = None
- self.spouses = None
-
# add a fams to the individual
def add_fams(self, fams):
if fams not in self.fams_fid:
def add_indi(self, fid):
if fid and fid not in self.indi:
self.indi[fid] = Indi(fid, self)
+ self.indi[fid].get_data()
# add family to the family tree
def add_fam(self, father, mother):
return self.sources[fid]
data = self.fs.get_url('https://familysearch.org/platform/sources/descriptions/%s.json' % fid)
if data:
- return Source(data['sourceDescriptions'][0], self)
+ self.sources[data['sourceDescriptions'][0]['id']] = Source(self)
+ self.sources[data['sourceDescriptions'][0]['id']].get_data(data['sourceDescriptions'][0])
+ return self.sources[data['sourceDescriptions'][0]['id']]
return False
def reset_num(self):