feat: Avoid running readability when the target is a file

This commit is contained in:
Cristian 2020-08-11 07:40:55 -05:00
parent 61e08a7c43
commit a14762640e

View file

@ -11,6 +11,7 @@ from ..system import run, atomic_write
from ..util import (
enforce_types,
download_url,
is_static_file,
)
from ..config import (
@ -26,6 +27,8 @@ from ..logging_util import TimedProgress
@enforce_types
def should_save_readability(link: Link, out_dir: Optional[str]=None) -> bool:
out_dir = out_dir or link.link_dir
if is_static_file(link.url):
return False
output = Path(out_dir or link.link_dir) / 'readability.json'
return SAVE_READABILITY and (not output.exists())