From c32a385e8ff6d330727346a28d16502acc5d33aa Mon Sep 17 00:00:00 2001 From: Nick Sweeting Date: Mon, 4 Feb 2019 18:45:18 -0800 Subject: [PATCH] show which format file was parsed as --- archivebox/archive.py | 5 +++-- archivebox/parse.py | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/archivebox/archive.py b/archivebox/archive.py index c7afe650..d2072148 100755 --- a/archivebox/archive.py +++ b/archivebox/archive.py @@ -59,7 +59,7 @@ def merge_links(archive_path=OUTPUT_DIR, import_path=None, only_new=False): all_links = [] if import_path: # parse and validate the import file - raw_links = parse_links(import_path) + raw_links, parser_name = parse_links(import_path) all_links = validate_links(raw_links) # merge existing links in archive_path and new links @@ -70,11 +70,12 @@ def merge_links(archive_path=OUTPUT_DIR, import_path=None, only_new=False): num_new_links = len(all_links) - len(existing_links) if num_new_links and not only_new: - print('[{green}+{reset}] [{}] Adding {} new links from {} to {}/index.json'.format( + print('[{green}+{reset}] [{}] Adding {} new links from {} to {}/index.json (parsed as {})'.format( datetime.now().strftime('%Y-%m-%d %H:%M:%S'), num_new_links, pretty_path(import_path), pretty_path(archive_path), + parser_name, **ANSI, )) # else: diff --git a/archivebox/parse.py b/archivebox/parse.py index e53fa77a..054d5f53 100644 --- a/archivebox/parse.py +++ b/archivebox/parse.py @@ -53,7 +53,7 @@ def parse_links(path): links = [] with open(path, 'r', encoding='utf-8') as file: - for parser_func in get_parsers(file).values(): + for parser_name, parser_func in get_parsers(file).items(): # otherwise try all parsers until one works try: links += list(parser_func(file)) @@ -63,7 +63,7 @@ def parse_links(path): # parser not supported on this file pass - return links + return links, parser_name def parse_pocket_export(html_file):