mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-27 13:14:24 -04:00
feat: Remove index.json and index.html generation from the regular process
This commit is contained in:
parent
494af5f2e1
commit
ae1484b8bf
5 changed files with 25 additions and 30 deletions
|
@ -225,7 +225,7 @@ def timed_index_update(out_path: Path):
|
|||
|
||||
@enforce_types
|
||||
def write_main_index(links: List[Link], out_dir: Path=OUTPUT_DIR, finished: bool=False) -> None:
|
||||
"""create index.html file for a given list of links"""
|
||||
"""Writes links to sqlite3 file for a given list of links"""
|
||||
|
||||
log_indexing_process_started(len(links))
|
||||
|
||||
|
@ -234,8 +234,6 @@ def write_main_index(links: List[Link], out_dir: Path=OUTPUT_DIR, finished: bool
|
|||
write_sql_main_index(links, out_dir=out_dir)
|
||||
os.chmod(out_dir / SQL_INDEX_FILENAME, int(OUTPUT_PERMISSIONS, base=8)) # set here because we don't write it with atomic writes
|
||||
|
||||
if finished:
|
||||
write_static_index(links, out_dir=out_dir)
|
||||
except (KeyboardInterrupt, SystemExit):
|
||||
stderr('[!] Warning: Still writing index to disk...', color='lightyellow')
|
||||
stderr(' Run archivebox init to fix any inconsisntencies from an ungraceful exit.')
|
||||
|
@ -246,13 +244,6 @@ def write_main_index(links: List[Link], out_dir: Path=OUTPUT_DIR, finished: bool
|
|||
|
||||
log_indexing_process_finished()
|
||||
|
||||
@enforce_types
|
||||
def write_static_index(links: List[Link], out_dir: Path=OUTPUT_DIR) -> None:
|
||||
with timed_index_update(out_dir / JSON_INDEX_FILENAME):
|
||||
write_json_main_index(links)
|
||||
with timed_index_update(out_dir / HTML_INDEX_FILENAME):
|
||||
write_html_main_index(links, out_dir=out_dir, finished=True)
|
||||
|
||||
@enforce_types
|
||||
def get_empty_snapshot_queryset(out_dir: Path=OUTPUT_DIR):
|
||||
setup_django(out_dir, check_db=True)
|
||||
|
|
|
@ -31,7 +31,6 @@ from .index import (
|
|||
parse_links_from_source,
|
||||
dedupe_links,
|
||||
write_main_index,
|
||||
write_static_index,
|
||||
snapshot_filter,
|
||||
get_indexed_folders,
|
||||
get_archived_folders,
|
||||
|
@ -561,10 +560,7 @@ def add(urls: Union[str, List[str]],
|
|||
archive_links(imported_links, overwrite=True, out_dir=out_dir)
|
||||
elif new_links:
|
||||
archive_links(new_links, overwrite=False, out_dir=out_dir)
|
||||
else:
|
||||
return all_links
|
||||
|
||||
write_static_index([link.as_link_with_details() for link in all_links], out_dir=out_dir)
|
||||
return all_links
|
||||
|
||||
@enforce_types
|
||||
|
@ -641,7 +637,6 @@ def remove(filter_str: Optional[str]=None,
|
|||
|
||||
remove_from_sql_main_index(snapshots=snapshots, out_dir=out_dir)
|
||||
all_snapshots = load_main_index(out_dir=out_dir)
|
||||
write_static_index([link.as_link_with_details() for link in all_snapshots], out_dir=out_dir)
|
||||
log_removal_finished(all_snapshots.count(), to_remove)
|
||||
|
||||
return all_snapshots
|
||||
|
@ -698,7 +693,6 @@ def update(resume: Optional[float]=None,
|
|||
|
||||
# Step 4: Re-write links index with updated titles, icons, and resources
|
||||
all_links = load_main_index(out_dir=out_dir)
|
||||
write_static_index([link.as_link_with_details() for link in all_links], out_dir=out_dir)
|
||||
return all_links
|
||||
|
||||
@enforce_types
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue