From 0ea8fadaebb93b4f7299d621e86419088fed4acb Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Tue, 5 Sep 2023 14:35:56 +0300 Subject: [PATCH] moer people/logbook improvements --- core/models/wallets.py | 1 - parsers/logbooks.py | 17 ++++++++--------- parsers/people.py | 34 +++++++++++++++++----------------- 3 files changed, 25 insertions(+), 27 deletions(-) diff --git a/core/models/wallets.py b/core/models/wallets.py index 3a05737..f8662eb 100644 --- a/core/models/wallets.py +++ b/core/models/wallets.py @@ -68,7 +68,6 @@ archaic_wallets = [ '1995-96kh', '1996-1999NotKHbook', '1997-99kh', - '1999', 'loosepages', ] class Wallet(models.Model): diff --git a/parsers/logbooks.py b/parsers/logbooks.py index ea927c1..ddc65f7 100644 --- a/parsers/logbooks.py +++ b/parsers/logbooks.py @@ -130,7 +130,7 @@ def reset_trip_id(date): # print(already, n, tid) return tid -rx_tripperson = re.compile(r"(?i)(.*?)$") +rx_tripauthor = re.compile(r"(?i)(.*?)$") rx_round_bracket = re.compile(r"[\(\[].*?[\)\]]") def GetTripPersons(trippeople, expedition, logtime_underground, tid=None): @@ -143,11 +143,14 @@ def GetTripPersons(trippeople, expedition, logtime_underground, tid=None): for tripperson in re.split(r",|\+|&|&(?!\w+;)| and ", trippeople): tripperson = tripperson.strip() # author_u = re.match(r"(?i)(.*?)$", tripperson) - author_u = rx_tripperson.match(tripperson) + author_u = rx_tripauthor.match(tripperson) if author_u: tripperson = author_u.group(1).strip() if tripperson: - if tripperson[0] != "*": # a name prefix of "*" is special + if tripperson[0] == "*": # a name prefix of "*" is special + guests.append(tripperson) + # print(f" ! - {expedition.year} * GUEST : {tripperson}") + else: tripperson = re.sub(rx_round_bracket, "", tripperson).strip() # Whacky aliases all resolved in GetPersonExpeditionNameLookup() @@ -172,16 +175,12 @@ def GetTripPersons(trippeople, expedition, logtime_underground, tid=None): raise if author_u: author = personyear - else: # *guest - guests.append(tripperson) - # print(f" ! - {expedition.year} * GUEST : {tripperson}") + if not author: if not res: return "", 0, "" - author = res[-1][0] # the previous valid person and a time of 0 hours - - # print(f" - {tid} [{author.person}] '{res[0][0].person}'...") + author = res[-1][0] # the last valid person and a time of 0 hours. BODGE. This gets written into the archive file as Truth. return res, author, guests def tidy_time_underground(logtime_underground): diff --git a/parsers/people.py b/parsers/people.py index fb90f38..ef6984b 100644 --- a/parsers/people.py +++ b/parsers/people.py @@ -138,32 +138,32 @@ def who_is_this(year, possibleid): global foreign_friends foreign_friends = [ - "P. Jeutter", - "K. Jäger", - "S. Steinberger", - "R. Seebacher", + "Aiko", + "Arndt Karger", "Dominik Jauch", + "Florian Gruner", "Fritz Mammel", + "Gunter Graf", + "Helmut Stopka-Ebeler", + "K. Jäger", + "Kai Schwekend", + "Karl Gaisberger", "Marcus Scheuerman", + "Mark Morgan", + "P. Jeutter", + "R. Seebacher", + "Regina Kaiser", + "Robert Seebacher", + "S. Steinberger", + "Sepp Steinberger", + "Thilo Müller", "Uli Schütz", "Wieland Scheuerle", - "Arndt Karger", - "Kai Schwekend", - "Regina Kaiser", - "Thilo Müller", - "Wieland Scheuerle", - "Florian Gruner", - "Helmut Stopka-Ebeler", - "Aiko", - "Mark Morgan", ] - def known_foreigner(id): """If this someone from ARGE or a known Austrian? Name has to be exact, no soft matching - - APPARENTLY NOT YET USED? Yes it is: in logbook Blog parsing - instead foreigners have names prefixed by * in the logbook.html ?""" + """ global foreign_friends if id in foreign_friends: