diff options
author | Philip Sargent <philip.sargent@gmail.com> | 2023-09-05 14:35:56 +0300 |
---|---|---|
committer | Philip Sargent <philip.sargent@gmail.com> | 2023-09-05 14:35:56 +0300 |
commit | 0ea8fadaebb93b4f7299d621e86419088fed4acb (patch) | |
tree | 36d0ece92abebfe58dc3633987faa0a9d521a726 /parsers/logbooks.py | |
parent | f3d5a389eb8a510366ea68d6e6e9762ce024248c (diff) | |
download | troggle-0ea8fadaebb93b4f7299d621e86419088fed4acb.tar.gz troggle-0ea8fadaebb93b4f7299d621e86419088fed4acb.tar.bz2 troggle-0ea8fadaebb93b4f7299d621e86419088fed4acb.zip |
moer people/logbook improvements
Diffstat (limited to 'parsers/logbooks.py')
-rw-r--r-- | parsers/logbooks.py | 17 |
1 files changed, 8 insertions, 9 deletions
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)<u>(.*?)</u>$") +rx_tripauthor = re.compile(r"(?i)<u>(.*?)</u>$") 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)<u>(.*?)</u>$", 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): |