| 1259 | |
| 1260 | |
| 1261 | def check_dependencies(config: ConfigDict=CONFIG, show_help: bool=True) -> None: |
| 1262 | invalid_dependencies = [ |
| 1263 | (name, info) for name, info in config['DEPENDENCIES'].items() |
| 1264 | if info['enabled'] and not info['is_valid'] |
| 1265 | ] |
| 1266 | if invalid_dependencies and show_help: |
| 1267 | stderr(f'[!] Warning: Missing {len(invalid_dependencies)} recommended dependencies', color='lightyellow') |
| 1268 | for dependency, info in invalid_dependencies: |
| 1269 | stderr( |
| 1270 | ' ! {}: {} ({})'.format( |
| 1271 | dependency, |
| 1272 | info['path'] or 'unable to find binary', |
| 1273 | info['version'] or 'unable to detect version', |
| 1274 | ) |
| 1275 | ) |
| 1276 | if dependency in ('YOUTUBEDL_BINARY', 'CHROME_BINARY', 'SINGLEFILE_BINARY', 'READABILITY_BINARY', 'MERCURY_BINARY'): |
| 1277 | hint(('To install all packages automatically run: archivebox setup', |
| 1278 | f'or to disable it and silence this warning: archivebox config --set SAVE_{dependency.rsplit("_", 1)[0]}=False', |
| 1279 | ''), prefix=' ') |
| 1280 | stderr('') |
| 1281 | |
| 1282 | if config['TIMEOUT'] < 5: |
| 1283 | stderr(f'[!] Warning: TIMEOUT is set too low! (currently set to TIMEOUT={config["TIMEOUT"]} seconds)', color='red') |
| 1284 | stderr(' You must allow *at least* 5 seconds for indexing and archive methods to run succesfully.') |
| 1285 | stderr(' (Setting it to somewhere between 30 and 3000 seconds is recommended)') |
| 1286 | stderr() |
| 1287 | stderr(' If you want to make ArchiveBox run faster, disable specific archive methods instead:') |
| 1288 | stderr(' https://github.com/ArchiveBox/ArchiveBox/wiki/Configuration#archive-method-toggles') |
| 1289 | stderr() |
| 1290 | |
| 1291 | elif config['USE_CHROME'] and config['TIMEOUT'] < 15: |
| 1292 | stderr(f'[!] Warning: TIMEOUT is set too low! (currently set to TIMEOUT={config["TIMEOUT"]} seconds)', color='red') |
| 1293 | stderr(' Chrome will fail to archive all sites if set to less than ~15 seconds.') |
| 1294 | stderr(' (Setting it to somewhere between 30 and 300 seconds is recommended)') |
| 1295 | stderr() |
| 1296 | stderr(' If you want to make ArchiveBox run faster, disable specific archive methods instead:') |
| 1297 | stderr(' https://github.com/ArchiveBox/ArchiveBox/wiki/Configuration#archive-method-toggles') |
| 1298 | stderr() |
| 1299 | |
| 1300 | if config['USE_YOUTUBEDL'] and config['MEDIA_TIMEOUT'] < 20: |
| 1301 | stderr(f'[!] Warning: MEDIA_TIMEOUT is set too low! (currently set to MEDIA_TIMEOUT={config["MEDIA_TIMEOUT"]} seconds)', color='red') |
| 1302 | stderr(' youtube-dl/yt-dlp will fail to archive any media if set to less than ~20 seconds.') |
| 1303 | stderr(' (Setting it somewhere over 60 seconds is recommended)') |
| 1304 | stderr() |
| 1305 | stderr(' If you want to disable media archiving entirely, set SAVE_MEDIA=False instead:') |
| 1306 | stderr(' https://github.com/ArchiveBox/ArchiveBox/wiki/Configuration#save_media') |
| 1307 | stderr() |
| 1308 | |
| 1309 | |
| 1310 | def check_data_folder(out_dir: Union[str, Path, None]=None, config: ConfigDict=CONFIG) -> None: |