mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-13 14:44:29 -04:00
allow passing links to remove method
This commit is contained in:
parent
313fcd0501
commit
d6030e15c7
1 changed files with 36 additions and 32 deletions
|
@ -547,6 +547,7 @@ def add(urls: Union[str, List[str]],
|
|||
def remove(filter_str: Optional[str]=None,
|
||||
filter_patterns: Optional[List[str]]=None,
|
||||
filter_type: str='exact',
|
||||
links: Optional[List[Link]]=None,
|
||||
after: Optional[float]=None,
|
||||
before: Optional[float]=None,
|
||||
yes: bool=False,
|
||||
|
@ -556,6 +557,7 @@ def remove(filter_str: Optional[str]=None,
|
|||
|
||||
check_data_folder(out_dir=out_dir)
|
||||
|
||||
if links is None:
|
||||
if filter_str and filter_patterns:
|
||||
stderr(
|
||||
'[X] You should pass either a pattern as an argument, '
|
||||
|
@ -589,6 +591,7 @@ def remove(filter_str: Optional[str]=None,
|
|||
finally:
|
||||
timer.end()
|
||||
|
||||
|
||||
if not len(links):
|
||||
log_removal_finished(0, 0)
|
||||
raise SystemExit(1)
|
||||
|
@ -606,7 +609,8 @@ def remove(filter_str: Optional[str]=None,
|
|||
should_remove = (
|
||||
(after is not None and float(link.timestamp) < after)
|
||||
or (before is not None and float(link.timestamp) > before)
|
||||
or link_matches_filter(link, filter_patterns, filter_type)
|
||||
or link_matches_filter(link, filter_patterns or [], filter_type)
|
||||
or link in links
|
||||
)
|
||||
if should_remove:
|
||||
to_delete.append(link)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue