mirror of
https://github.com/ArchiveBox/ArchiveBox
synced 2024-11-10 14:44:18 +00:00
fix: Add condition to avoid breaking the add
command
This commit is contained in:
parent
c073ea141d
commit
3afb2401bc
2 changed files with 7 additions and 4 deletions
|
@ -123,7 +123,7 @@ def archive_link(link: Link, overwrite: bool=False, methods: Optional[Iterable[s
|
|||
|
||||
|
||||
@enforce_types
|
||||
def archive_links(links: List[Link], overwrite: bool=False, methods: Optional[Iterable[str]]=None, out_dir: Optional[str]=None, skip_index: bool=False) -> List[Link]:
|
||||
def archive_links(links: List[Link], overwrite: bool=False, methods: Optional[Iterable[str]]=None, out_dir: Optional[str]=None, skip_index: bool=False, oneshot: bool=False) -> List[Link]:
|
||||
if not links:
|
||||
return []
|
||||
|
||||
|
@ -132,8 +132,11 @@ def archive_links(links: List[Link], overwrite: bool=False, methods: Optional[It
|
|||
link: Link = links[0]
|
||||
try:
|
||||
for idx, link in enumerate(links):
|
||||
link_out_dir = out_dir or link.link_dir
|
||||
archive_link(link, overwrite=overwrite, methods=methods, link_out_dir=out_dir, skip_index=skip_index)
|
||||
if oneshot:
|
||||
link_out_dir = out_dir or link.link_dir
|
||||
else:
|
||||
link_out_dir = link.link_dir
|
||||
archive_link(link, overwrite=overwrite, methods=methods, out_dir=link_out_dir, skip_index=skip_index)
|
||||
except KeyboardInterrupt:
|
||||
log_archiving_paused(len(links), idx, link.timestamp)
|
||||
raise SystemExit(0)
|
||||
|
|
|
@ -498,7 +498,7 @@ def status(out_dir: str=OUTPUT_DIR) -> None:
|
|||
def oneshot(url: str, out_dir: str=OUTPUT_DIR):
|
||||
oneshot_links, _ = parse_links_memory([url])
|
||||
oneshot_links, _ = dedupe_links([], oneshot_links)
|
||||
archive_links(oneshot_links, out_dir=out_dir, skip_index=True)
|
||||
archive_links(oneshot_links, out_dir=out_dir, skip_index=True, oneshot=True)
|
||||
return oneshot_links
|
||||
|
||||
@enforce_types
|
||||
|
|
Loading…
Reference in a new issue