log matching links in a more logical place

This commit is contained in:
Nick Sweeting 2019-04-16 23:20:31 -04:00
parent 1e759084f3
commit 50d368b1bc
2 changed files with 6 additions and 2 deletions

View file

@ -79,6 +79,7 @@ def log_indexing_finished(out_dir: str, out_file: str):
def log_archiving_started(num_links: int, resume: Optional[float]):
start_ts = datetime.now()
_LAST_RUN_STATS.archiving_start_ts = start_ts
print()
if resume:
print('{green}[▶] [{}] Resuming archive updating for {} pages starting from {}...{reset}'.format(
start_ts.strftime('%Y-%m-%d %H:%M:%S'),
@ -119,6 +120,7 @@ def log_archiving_finished(num_links: int):
else:
duration = '{0:.2f} sec'.format(seconds, 2)
print()
print('{}[√] [{}] Update of {} pages complete ({}){}'.format(
ANSI['green'],
end_ts.strftime('%Y-%m-%d %H:%M:%S'),
@ -224,8 +226,6 @@ def log_list_finished(links):
def log_removal_started(links: List[Link], yes: bool, delete: bool):
log_list_finished(links)
print('{lightyellow}[i] Found {} matching URLs to remove.{reset}'.format(len(links), **ANSI))
if delete:
file_counts = [link.num_outputs for link in links if os.path.exists(link.link_dir)]

View file

@ -121,11 +121,15 @@ def remove_archive_links(filter_patterns: List[str], filter_type: str='exact',
))
finally:
timer.end()
if not len(links):
log_removal_finished(0, 0)
raise SystemExit(1)
log_list_finished(links)
log_removal_started(links, yes=yes, delete=delete)
timer = TimedProgress(360, prefix=' ')
try:
to_keep = []