summaryrefslogtreecommitdiffstats
path: root/parsers/logbooks.py
diff options
context:
space:
mode:
Diffstat (limited to 'parsers/logbooks.py')
-rw-r--r--parsers/logbooks.py30
1 files changed, 21 insertions, 9 deletions
diff --git a/parsers/logbooks.py b/parsers/logbooks.py
index 25da271..ef2ce1d 100644
--- a/parsers/logbooks.py
+++ b/parsers/logbooks.py
@@ -52,7 +52,7 @@ data for old logbooks. New design needed, with a mechanism for flagging fixtures
'''
MAX_LOGBOOK_ENTRY_TITLE_LENGTH = 200
BLOG_PARSER_SETTINGS = {
- "2017": ("ukcavingblog.html", "parser_blog"),
+ # "2017": ("ukcavingblog.html", "parser_blog"), # now folded in to logbooks.html
"2019": ("ukcavingblog.html", "parser_blog"),
"2022": ("ukcavingblog.html", "parser_blog"),
}
@@ -94,7 +94,7 @@ LOGBOOK_PARSER_SETTINGS = {
"1982": ("log.htm", "parser_html_01"),
}
-entries = { "2022": 64, "2019": 56, "2018": 75, "2017": 61, "2016": 81, "2015": 79,
+entries = { "2022": 64, "2019": 56, "2018": 75, "2017": 76, "2016": 81, "2015": 79,
"2014": 65, "2013": 51, "2012": 75, "2011": 68, "2010": 22, "2009": 52,
"2008": 49, "2007": 111, "2006": 60, "2005": 55, "2004": 76, "2003": 42, "2002": 31,
"2001": 48, "2000": 54, "1999": 79, "1998": 43, "1997": 53, "1996": 95, "1995": 42,
@@ -140,6 +140,10 @@ def GetTripPersons(trippeople, expedition, logtime_underground, tid=None):
tripperson = "Mike Richardson"
if tripperson =="MikeTA":
tripperson = "Mike Richardson"
+ if tripperson =="cavingpig":
+ tripperson = "Elaine Oliver"
+ if tripperson =="nobrotson":
+ tripperson = "Rob Watson"
personyear = GetPersonExpeditionNameLookup(expedition).get(tripperson.lower())
@@ -153,8 +157,8 @@ def GetTripPersons(trippeople, expedition, logtime_underground, tid=None):
author = personyear
if not author:
if not res:
- return None, None
- author = res[-1][0]
+ 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}'...")
return res, author
@@ -193,8 +197,15 @@ def EnterLogIntoDbase(date, place, title, text, trippeople, expedition, logtime_
cave = GetCaveLookup().get(lplace)
y = str(date)[:4]
- text = text.replace('src="', f'src="/years/{y}/' )
- text = text.replace("src='", f"src='/years/{y}/" )
+
+ text = text.replace(' src="', f' src="/years/{y}/' )
+ text = text.replace(" src='", f" src='/years/{y}/" )
+
+ text = text.replace(f' src="/years/{y}//years/{y}/', f' src="/years/{y}/' )
+ text = text.replace(f" src='/years/{y}//years/{y}/", f" src='/years/{y}/" )
+
+ text = text.replace('\t', '' )
+ text = text.replace('\n\n\n', '\n\n' )
#Check for an existing copy of the current entry, and save
expeditionday = expedition.get_expedition_day(date)
@@ -213,7 +224,6 @@ def EnterLogIntoDbase(date, place, title, text, trippeople, expedition, logtime_
# This creates the lbo instance of LogbookEntry
lbo, created=save_carefully(LogbookEntry, lookupAttribs, nonLookupAttribs)
-
for tripperson, time_underground in trippersons:
# print(f" - {tid} '{tripperson}' author:{tripperson == author}")
@@ -557,9 +567,11 @@ def parser_blog(year, expedition, txt, sq=""):
print(message)
# fallback, ignore the timestamp bits:
tripdate = datetime.fromisoformat(datestamp[0:10])
- print(f" - tid: {tid} '{trippeople}' '{tripdate}'")
+ # print(f" - tid: {tid} '{trippeople}' '{tripdate}'")
- tripname = f"UK Caving Blog{sq} post {logbook_entry_count}" # must be unique for a given date
+ # tripname must have the location then a hyphen at the beginning as it is ignored by export function
+ location = "Unknown"
+ tripname = f"Expo - UK Caving Blog{sq} post {logbook_entry_count}" # must be unique for a given date
tripcontent = trippara + f"\n\nBlog Author: {trippeople}"
entrytuple = (tripdate, location, tripname, tripcontent,