Browse Source

always show all totals in log output

Nick Sweeting 3 years ago
parent
commit
f6d6a06c78
2 changed files with 6 additions and 4 deletions
  1. 5 4
      archivebox/main.py
  2. 1 0
      archivebox/parsers/__init__.py

+ 5 - 4
archivebox/main.py

@@ -589,6 +589,7 @@ def add(urls: Union[str, List[str]],
         # save verbatim args to sources
         # save verbatim args to sources
         write_ahead_log = save_text_as_source('\n'.join(urls), filename='{ts}-import.txt', out_dir=out_dir)
         write_ahead_log = save_text_as_source('\n'.join(urls), filename='{ts}-import.txt', out_dir=out_dir)
     
     
+
     new_links += parse_links_from_source(write_ahead_log, root_url=None, parser=parser)
     new_links += parse_links_from_source(write_ahead_log, root_url=None, parser=parser)
 
 
     # If we're going one level deeper, download each link and look for more links
     # If we're going one level deeper, download each link and look for more links
@@ -628,16 +629,16 @@ def add(urls: Union[str, List[str]],
         ts = datetime.now(timezone.utc).strftime('%Y-%m-%d %H:%M:%S')
         ts = datetime.now(timezone.utc).strftime('%Y-%m-%d %H:%M:%S')
 
 
         if update:
         if update:
-            stderr(f'[*] [{ts}] Archiving + updating', len(imported_links), 'URLs from added set...', color='green')
+            stderr(f'[*] [{ts}] Archiving + updating {len(imported_links)}/{len(all_links)}', len(imported_links), 'URLs from added set...', color='green')
             archive_links(imported_links, overwrite=overwrite, **archive_kwargs)
             archive_links(imported_links, overwrite=overwrite, **archive_kwargs)
         elif update_all:
         elif update_all:
-            stderr(f'[*] [{ts}] Archiving + updating ', len(all_links), 'URLs from entire library...', color='green')
+            stderr(f'[*] [{ts}] Archiving + updating {len(all_links)}/{len(all_links)}', len(all_links), 'URLs from entire library...', color='green')
             archive_links(all_links, overwrite=overwrite, **archive_kwargs)
             archive_links(all_links, overwrite=overwrite, **archive_kwargs)
         elif overwrite:
         elif overwrite:
-            stderr(f'[*] [{ts}] Archiving + overwriting', len(imported_links), 'URLs from added set...', color='green')
+            stderr(f'[*] [{ts}] Archiving + overwriting {len(imported_links)}/{len(all_links)}', len(imported_links), 'URLs from added set...', color='green')
             archive_links(imported_links, overwrite=True, **archive_kwargs)
             archive_links(imported_links, overwrite=True, **archive_kwargs)
         elif new_links:
         elif new_links:
-            stderr(f'[*] [{ts}] Archiving', len(imported_links), 'URLs from added set...', color='green')
+            stderr(f'[*] [{ts}] Archiving {len(new_links)}/{len(all_links)} URLs from added set...', color='green')
             archive_links(new_links, overwrite=False, **archive_kwargs)
             archive_links(new_links, overwrite=False, **archive_kwargs)
 
 
 
 

+ 1 - 0
archivebox/parsers/__init__.py

@@ -8,6 +8,7 @@ For examples of supported import formats see tests/.
 __package__ = 'archivebox.parsers'
 __package__ = 'archivebox.parsers'
 
 
 import re
 import re
+import os
 from io import StringIO
 from io import StringIO
 
 
 from typing import IO, Tuple, List, Optional
 from typing import IO, Tuple, List, Optional