| 488 | |
| 489 | |
| 490 | def log_removal_started(links: List["Link"], yes: bool, delete: bool): |
| 491 | print('{lightyellow}[i] Found {} matching URLs to remove.{reset}'.format(len(links), **ANSI)) |
| 492 | if delete: |
| 493 | file_counts = [link.num_outputs for link in links if Path(link.link_dir).exists()] |
| 494 | print( |
| 495 | f' {len(links)} Links will be de-listed from the main index, and their archived content folders will be deleted from disk.\n' |
| 496 | f' ({len(file_counts)} data folders with {sum(file_counts)} archived files will be deleted!)' |
| 497 | ) |
| 498 | else: |
| 499 | print( |
| 500 | ' Matching links will be de-listed from the main index, but their archived content folders will remain in place on disk.\n' |
| 501 | ' (Pass --delete if you also want to permanently delete the data folders)' |
| 502 | ) |
| 503 | |
| 504 | if not yes: |
| 505 | print() |
| 506 | print('{lightyellow}[?] Do you want to proceed with removing these {} links?{reset}'.format(len(links), **ANSI)) |
| 507 | try: |
| 508 | assert input(' y/[n]: ').lower() == 'y' |
| 509 | except (KeyboardInterrupt, EOFError, AssertionError): |
| 510 | raise SystemExit(0) |
| 511 | |
| 512 | def log_removal_finished(all_links: int, to_remove: int): |
| 513 | if all_links == 0: |