summaryrefslogtreecommitdiffstats
path: root/parsers
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@gmail.com>2023-07-24 13:14:42 +0300
committerPhilip Sargent <philip.sargent@gmail.com>2023-07-24 13:14:42 +0300
commit9f2b77bf1dbf09fcfa88fcfd5e5863b3e83f890c (patch)
tree9a065622f1f972338ac054c184a3c1f76dd103d9 /parsers
parent9473b22bd9aa71a23d23c4a0f6f9c88a3b7666f5 (diff)
downloadtroggle-9f2b77bf1dbf09fcfa88fcfd5e5863b3e83f890c.tar.gz
troggle-9f2b77bf1dbf09fcfa88fcfd5e5863b3e83f890c.tar.bz2
troggle-9f2b77bf1dbf09fcfa88fcfd5e5863b3e83f890c.zip
More compact parsing report to terminal
Diffstat (limited to 'parsers')
-rw-r--r--parsers/logbooks.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/parsers/logbooks.py b/parsers/logbooks.py
index e701183..8d2f969 100644
--- a/parsers/logbooks.py
+++ b/parsers/logbooks.py
@@ -57,7 +57,7 @@ LOGBOOK_PARSER_SETTINGS = {
LOGBOOKS_DIR = "years" # subfolder of settings.EXPOWEB
ENTRIES = {
- "2023": 27,
+ "2023": 32,
"2022": 90,
"2019": 55,
"2018": 95,
@@ -305,8 +305,8 @@ def parser_html(year, expedition, txt, seq=""):
endmatch = re.match(r"(?i)(?s).*<hr\s*/>([\s\S]*?)(?=</body)", txt)
endpara = endmatch.groups()[0].strip()
- #print(f" - endpara:\n'{endpara}'")
if len(endpara) > 0:
+ print(f"\n - {year} endpara:\n'{endpara}'")
endpath = Path(settings.EXPOWEB, LOGBOOKS_DIR, year, "endmatter.html")
with open(endpath, "w") as end:
end.write(endpara + "\n")
@@ -560,7 +560,8 @@ def parse_logbook_for_expedition(expedition, blog=False):
if logbook_parseable:
# --------------------
parser = globals()[parsefunc]
- print(f" - {year} parsing with {parsefunc} - {lb}")
+ # print(f" - {year} parsing with {parsefunc} - {lb}")
+ print(" .", end="")
logentries = parser(year, expedition, txt, sq) # this launches the right parser
# --------------------
@@ -665,7 +666,7 @@ def LoadLogbooks():
logentries = parse_logbook_for_expedition(b, blog=True) # loads the blog logbook for one expo
allentries += logentries
- print(f"total {len(allentries):,} log entries parsed in all expeditions")
+ print(f"\ntotal {len(allentries):,} log entries parsed in all expeditions")
mem = get_process_memory()
print(f" - MEM: {mem:7.2f} MB in use, {mem-mem1:7.2f} MB more", file=sys.stderr)
duration = time.time() - start
@@ -682,6 +683,7 @@ def LoadLogbooks():
for expo in expos:
expo.save() # to save logbook name property
mem = get_process_memory()
+ print(f"total {len(allentries):,} log entries saved into database")
print(f" - MEM: {mem:7.2f} MB in use, {mem-mem1:7.2f} MB more", file=sys.stderr)
duration = time.time() - start
print(f" - TIME: {duration:7.2f} s", file=sys.stderr)