mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-14 07:04:27 -04:00
colorize output and add progress bar
This commit is contained in:
parent
172c4ad5b8
commit
a167d2a1f4
5 changed files with 226 additions and 89 deletions
19
index.py
19
index.py
|
@ -2,8 +2,14 @@ import os
|
|||
from datetime import datetime
|
||||
from string import Template
|
||||
|
||||
from config import INDEX_TEMPLATE, INDEX_ROW_TEMPLATE
|
||||
from parse import derived_link_info
|
||||
from config import (
|
||||
INDEX_TEMPLATE,
|
||||
INDEX_ROW_TEMPLATE,
|
||||
ARCHIVE_PERMISSIONS,
|
||||
ANSI,
|
||||
chmod_file,
|
||||
)
|
||||
|
||||
|
||||
def dump_index(links, service):
|
||||
|
@ -28,4 +34,13 @@ def dump_index(links, service):
|
|||
}
|
||||
|
||||
with open(os.path.join(service, 'index.html'), 'w', encoding='utf-8') as f:
|
||||
f.write(Template(index_html).substitute(template_vars))
|
||||
f.write(Template(index_html).substitute(**template_vars))
|
||||
|
||||
chmod_file(service, permissions=ARCHIVE_PERMISSIONS)
|
||||
|
||||
print('[+] [{}] Created archive index with {}{}{} links.'.format(
|
||||
datetime.now().strftime('%Y-%m-%d %H:%M:%S'),
|
||||
ANSI['green'],
|
||||
len(links),
|
||||
ANSI['reset'],
|
||||
))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue