add support_phantompy.py
This commit is contained in:
parent
2686ab3db0
commit
a06a1829d6
@ -126,6 +126,8 @@ from PyQt5.QtWidgets import QApplication
|
|||||||
from PyQt5.QtPrintSupport import QPrinter
|
from PyQt5.QtPrintSupport import QPrinter
|
||||||
from PyQt5.QtWebEngineWidgets import QWebEnginePage
|
from PyQt5.QtWebEngineWidgets import QWebEnginePage
|
||||||
|
|
||||||
|
from support_phantompy import vsetup_logging
|
||||||
|
|
||||||
global LOG
|
global LOG
|
||||||
import logging
|
import logging
|
||||||
import warnings
|
import warnings
|
||||||
|
@ -12,7 +12,7 @@ from PyQt5 import QtWidgets
|
|||||||
from PyQt5.QtWidgets import (QProgressBar, QWidget, QVBoxLayout)
|
from PyQt5.QtWidgets import (QProgressBar, QWidget, QVBoxLayout)
|
||||||
|
|
||||||
from phantompy import Render
|
from phantompy import Render
|
||||||
from lookupdns import LookFor as Render
|
# from lookupdns import LookFor as Render
|
||||||
|
|
||||||
global LOG
|
global LOG
|
||||||
import logging
|
import logging
|
||||||
@ -85,27 +85,12 @@ def iMain(largs, bgui=True):
|
|||||||
url = largs[0]
|
url = largs[0]
|
||||||
outfile = largs[1]
|
outfile = largs[1]
|
||||||
jsfile = largs[2] if len(largs) > 2 else None
|
jsfile = largs[2] if len(largs) > 2 else None
|
||||||
if os.path.exists(url):
|
|
||||||
with open(url, 'rt') as ofd:
|
|
||||||
elts = ofd.readlines()
|
|
||||||
random.shuffle(elts)
|
|
||||||
lelts = elts[:4]
|
|
||||||
else:
|
|
||||||
lelts = [url]
|
|
||||||
for i, elt in enumerate(lelts):
|
|
||||||
# run only starts the url loading
|
# run only starts the url loading
|
||||||
r = Render(app, do_print=False, do_save=True)
|
r = Render(app, do_print=False, do_save=True)
|
||||||
uri = elt.strip()
|
uri = url.strip()
|
||||||
r.run(uri, outfile, jsfile)
|
r.run(uri, outfile, jsfile)
|
||||||
per = int(float(i)*100.0/2/len(lelts))
|
LOG.debug(f"{r.percent} {app.lstart}")
|
||||||
LOG.debug(f"{r.percent} {app.lstart} {per} {i}")
|
|
||||||
if len(lelts) == 1: break
|
|
||||||
for j in range(1, random.randint(30, 120)):
|
|
||||||
# google throttles too many links at a time
|
|
||||||
if widget:
|
|
||||||
widget.update(str(per))
|
|
||||||
app.processEvents()
|
|
||||||
time.sleep(1)
|
|
||||||
LOG.info(f"queued {len(app.lstart)} urls")
|
LOG.info(f"queued {len(app.lstart)} urls")
|
||||||
|
|
||||||
# run until app.exec() is finished (Qt window is closed)
|
# run until app.exec() is finished (Qt window is closed)
|
||||||
|
Loading…
Reference in New Issue
Block a user