From f666b9c3963b321296ec51e5d8c8dd149ff60478 Mon Sep 17 00:00:00 2001 From: Sam Wenham Date: Sat, 30 Mar 2019 13:58:38 +0000 Subject: Update new management command for DB reset Switch to content_type from mimetype Make DB reset not nuke so much Tidy logbook parser --- parsers/logbooks.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'parsers/logbooks.py') diff --git a/parsers/logbooks.py b/parsers/logbooks.py index ffd8e21..fbe00a3 100644 --- a/parsers/logbooks.py +++ b/parsers/logbooks.py @@ -115,7 +115,7 @@ def ParseDate(tripdate, year): assert False, tripdate return datetime.date(year, month, day) -# 2007, 2008, 2006 +# 2006, 2008 - 2010 def Parselogwikitxt(year, expedition, txt): trippara = re.findall(r"===(.*?)===([\s\S]*?)(?====)", txt) for triphead, triptext in trippara: @@ -140,9 +140,9 @@ def Parselogwikitxt(year, expedition, txt): #print "\n", tripcave, "--- ppp", trippeople, len(triptext) EnterLogIntoDbase(date = ldate, place = tripcave, title = tripplace, text = triptext, trippeople=trippeople, expedition=expedition, logtime_underground=0) -# 2002, 2004, 2005 +# 2002, 2004, 2005, 2007, 2011 - 2018 def Parseloghtmltxt(year, expedition, txt): - print(" - Using log html parser") + #print(" - Starting log html parser") tripparas = re.findall(r"([\s\S]*?)(?=", "", triptext) ltriptext = re.sub(r"\s*?\n\s*", " ", ltriptext) ltriptext = re.sub(r"

", "\n\n", ltriptext).strip() @@ -183,7 +182,7 @@ def Parseloghtmltxt(year, expedition, txt): print(" - No trip entrys found in logbook, check the syntax matches htmltxt format") -# main parser for pre-2001. simpler because the data has been hacked so much to fit it +# main parser for 1991 - 2001. simpler because the data has been hacked so much to fit it def Parseloghtml01(year, expedition, txt): tripparas = re.findall(r"([\s\S]*?)(?=([\s\S]*?)(?=