From: Benoît Fontaine Date: Thu, 11 Jan 2018 15:27:52 +0000 (+0100) Subject: Add informations for user X-Git-Url: https://git.nutra.tk/v2?a=commitdiff_plain;h=25760ebfecb0b6b9ea647de5fabbc0a67f58248c;p=gamesguru%2Fgetmyancestors.git Add informations for user --- diff --git a/fsearch_translation.py b/fsearch_translation.py index f7b6978..7658605 100644 --- a/fsearch_translation.py +++ b/fsearch_translation.py @@ -98,4 +98,35 @@ translations = { 'ru': 'Название племени', 'zh': '部落名字' }, + 'Download starting individuals...': { + 'fr': 'Téléchargement des personnes de départ...', + }, + 'th generation of ancestors...': { + 'fr': 'e génération d\'ancêtres...', + }, + 'th generation of descendants...': { + 'fr': 'e génération de descendants...', + }, + 'Download spouses and marriage information...': { + 'fr': 'Téléchargement des conjoints de des information de mariage...', + }, + 'Download notes': { + 'fr': 'Téléchargement des notes', + }, + ' and': { + 'fr': ' et', + }, + ' ordinances': { + 'fr': ' des ordonnances', + }, + ' and contributors': { + 'fr': ' et des contributeurs', + }, + 'Downloaded %s individuals, %s families, %s sources and %s notes in %s seconds with %s HTTP requests.': { + 'fr': '%s personnes, %s familles, %s sources et %s notes téléchargés en %s secondes avec %s requêtes HTTP.', + }, + 'Download ': { + 'fr': 'Téléchargement de la ', + }, + } diff --git a/getmyancestors.py b/getmyancestors.py index 6e33f11..45c5b62 100755 --- a/getmyancestors.py +++ b/getmyancestors.py @@ -89,6 +89,7 @@ class Session: self.timeout = timeout self.fid = self.lang = None self.login() + self.counter = 0 # retrieve FamilySearch session ID (https://familysearch.org/developers/docs/guides/oauth2) def login(self): @@ -212,6 +213,7 @@ class Session: # retrieve JSON structure from FamilySearch URL def get_url(self, url): + self.counter += 1 while True: try: if self.verbose: @@ -548,13 +550,11 @@ class Indi: # add a fams to the individual def add_fams(self, fams): - if fams not in self.fams_fid: - self.fams_fid.add(fams) + self.fams_fid.add(fams) # add a famc to the individual def add_famc(self, famc): - if famc not in self.famc_fid: - self.famc_fid.add(famc) + self.famc_fid.add(famc) # retrieve individual notes def get_notes(self): @@ -940,7 +940,10 @@ if __name__ == '__main__': username = args.u if args.u else input("Enter FamilySearch username: ") password = args.p if args.p else getpass.getpass("Enter FamilySearch password: ") + time_count = time.time() + # initialize a FamilySearch session and a family tree object + print('Login to FamilySearch...') fs = Session(username, password, args.v, args.l, args.t) tree = Tree(fs) @@ -950,24 +953,32 @@ if __name__ == '__main__': # add list of starting individuals to the family tree todo = args.i if args.i else [fs.get_userid()] + print(fs._('Download starting individuals...')) tree.add_indis(todo) # download ancestors todo = set(todo) done = set() for i in range(args.a): + if not todo: + break done |= todo + print(fs._('Download ') + str(i + 1) + fs._('th generation of ancestors...')) todo = tree.add_parents(todo) - done # download descendants todo = set(tree.indi.keys()) done = set() for i in range(args.d): + if not todo: + break done |= todo + print(fs._('Download ') + str(i + 1) + fs._('th generation of descendants...')) todo = tree.add_children(todo) - done # download spouses if args.m: + print(fs._('Download spouses and marriage information...')) todo = set(tree.indi.keys()) tree.add_spouses(todo) @@ -988,8 +999,10 @@ if __name__ == '__main__': await future loop = asyncio.get_event_loop() + print(fs._('Download notes') + (((',' if args.r else fs._(' and')) + fs._(' ordinances')) if args.c else '') + (fs._(' and contributors') if args.r else '') + '...') loop.run_until_complete(download_stuff(loop)) # compute number for family relationships and print GEDCOM file tree.reset_num() tree.print(args.o) + print(fs._('Downloaded %s individuals, %s families, %s sources and %s notes in %s seconds with %s HTTP requests.') % (str(len(tree.indi)), str(len(tree.fam)), str(len(tree.sources)), str(len(tree.notes)), str(round(time.time() - time_count)), str(fs.counter)))