2019-01-29 18:37:13 +01:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
import logging
|
|
|
|
|
|
|
|
from lookyloo.abstractmanager import AbstractManager
|
2021-04-09 14:33:40 +02:00
|
|
|
from lookyloo.helpers import shutdown_requested
|
2019-01-30 14:30:01 +01:00
|
|
|
from lookyloo.lookyloo import Lookyloo
|
2019-01-29 18:37:13 +01:00
|
|
|
|
|
|
|
logging.basicConfig(format='%(asctime)s %(name)s %(levelname)s:%(message)s',
|
|
|
|
level=logging.INFO, datefmt='%I:%M:%S')
|
|
|
|
|
|
|
|
|
2020-11-05 14:14:33 +01:00
|
|
|
class AsyncCapture(AbstractManager):
|
2019-01-29 18:37:13 +01:00
|
|
|
|
2021-03-12 16:49:04 +01:00
|
|
|
def __init__(self, loglevel: int=logging.INFO):
|
2019-01-29 18:37:13 +01:00
|
|
|
super().__init__(loglevel)
|
2020-03-31 16:57:16 +02:00
|
|
|
self.lookyloo = Lookyloo()
|
2021-04-09 14:33:40 +02:00
|
|
|
self.script_name = 'async_capture'
|
2019-01-29 18:37:13 +01:00
|
|
|
|
|
|
|
def _to_run_forever(self):
|
2019-04-05 16:12:54 +02:00
|
|
|
while True:
|
2020-11-05 14:14:33 +01:00
|
|
|
url = self.lookyloo.process_capture_queue()
|
2019-04-05 16:12:54 +02:00
|
|
|
if url is None or shutdown_requested():
|
|
|
|
break
|
2019-01-29 18:37:13 +01:00
|
|
|
|
|
|
|
|
2020-10-03 21:19:43 +02:00
|
|
|
def main():
|
2020-11-05 14:14:33 +01:00
|
|
|
m = AsyncCapture()
|
2019-01-29 18:37:13 +01:00
|
|
|
m.run(sleep_in_sec=1)
|
2020-10-03 21:19:43 +02:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|