From db0504057b988ea0ccc982a53a48334084dc48bc Mon Sep 17 00:00:00 2001
From: Philip Sargent
", "
", ltriptext).strip()
@@ -404,9 +412,10 @@ def parser_html(year, expedition, txt, seq=""):
dupl[check] = 1
tu = tidy_time_underground(tu)
-
trippersons, author = tidy_trip_persons(trippeople, expedition, tu, tid)
- entrytuple = (ldate, tripcave, triptitle, ltriptext, trippersons, author, expedition, tu, tripid1)
+ tripcave = tidy_trip_cave(place)
+
+ entrytuple = (ldate, place, tripcave, triptitle, ltriptext, trippersons, author, expedition, tu, tripid1)
logentries.append(entrytuple)
@@ -494,7 +503,7 @@ def parser_blog(year, expedition, txt, sq=""):
# print(f" - tid: {tid} '{trippeople}' '{tripdate}'")
# triptitle must have the location then a hyphen at the beginning as it is ignored by export function. We can't know what this is, so we set it as 'Expo' and 'Unknown'.
- location = "Unknown"
+ place = "Unknown"
# triptitle must be unique for a given date. We can enforce this here.
triptitle = f"Expo - UK Caving Blog{sq} post {logbook_entry_count}"
tripcontent = re.sub(r"(width=\"\d+\")", "", tripcontent)
@@ -505,7 +514,9 @@ def parser_blog(year, expedition, txt, sq=""):
tripcontent = f"\n\n\nBlog Author: {trippeople}" + tripcontent
trippersons, author = tidy_trip_persons(trippeople, expedition, logtime_underground, tid)
- entrytuple = (tripdate, location, triptitle, tripcontent, trippersons, author, expedition, tu, tid)
+ tripcave = tidy_trip_cave(place)
+
+ entrytuple = (tripdate, place, tripcave, triptitle, tripcontent, trippersons, author, expedition, tu, tid)
logentries.append(entrytuple)
def clean_all_logbooks():
@@ -581,10 +592,6 @@ def parse_logbook_for_expedition(expedition, blog=False):
print(f" - {year} parsing with {parsefunc} - {lb}")
parser(year, expedition, txt, sq) # this launches the right parser for this year
# --------------------
- # move database storage into separate step
- # for entrytuple in logentries:
- # date, tripcave, triptitle, text, trippersons, author, expedition, logtime_underground, tripid1 = entrytuple
- # store_entry_into_database(date, tripcave, triptitle, text, trippersons, author, expedition, logtime_underground, tripid1)
if len(logentries) == expect:
# print(f"OK {year} {len(logentries):5d} is {expect}\n")
@@ -614,10 +621,12 @@ def LoadLogbook(year):
f" - Not a year with extant blog entries to import: '{year}' not in BLOG_PARSER_SETTINGS {BLOG_PARSER_SETTINGS}"
)
for entrytuple in logentries:
- date, tripcave, triptitle, text, trippersons, author, expedition, logtime_underground, tripid1 = entrytuple
- if expo == expedition:
+ date, place, tripcave, triptitle, text, trippersons, author, expedition, logtime_underground, tripid1 = entrytuple
+ if expo == expedition: # unneeded check, we zeroed it bbefore filling it
#print(f" - {triptitle}")
- store_entry_into_database(date, tripcave, triptitle, text, trippersons, author, expedition, logtime_underground, tripid1)
+ store_entry_into_database(date, place, tripcave, triptitle, text, trippersons, author, expedition, logtime_underground, tripid1)
+ else:
+ print(f" ! unexpected log entry labelled as '{expedition}' {tripid1}" )
expedition.save() # to save logbook name property
def LoadLogbooks():
@@ -703,8 +712,8 @@ def LoadLogbooks():
# - LogBookEntry (text, who when etc.)
# - PersonTrip (who was on that specific trip mentione din the logbook entry)
for entrytuple in allentries:
- date, tripcave, triptitle, text, trippersons, author, expedition, logtime_underground, tripid1 = entrytuple
- store_entry_into_database(date, tripcave, triptitle, text, trippersons, author, expedition, logtime_underground, tripid1)
+ date, place, tripcave, triptitle, text, trippersons, author, expedition, logtime_underground, tripid1 = entrytuple
+ store_entry_into_database(date, place, tripcave, triptitle, text, trippersons, author, expedition, logtime_underground, tripid1)
for expo in expos:
expedition.save() # to save logbook name property
--
cgit v1.2.3