fix nonsense

This commit is contained in:
mickael
2019-01-05 01:12:27 +00:00
parent 6df8fac96e
commit 8f6f9d2f2e

6
ppf.py
View File

@@ -55,17 +55,15 @@ def fetch_contents(uri):
def insert_proxies(proxies, uri, sqlite): def insert_proxies(proxies, uri, sqlite):
time_now = time.time() time_now = time.time()
added = 0
query = [ 'proxy=?' for p in proxies ] query = [ 'proxy=?' for p in proxies ]
known = [ i[0] for i in sqlite.execute('SELECT proxy FROM proxylist WHERE %s' % ' OR '.join(query), proxies).fetchall() ] known = [ i[0] for i in sqlite.execute('SELECT proxy FROM proxylist WHERE %s' % ' OR '.join(query), proxies).fetchall() ]
new = [ (time_now,i,3,0) for i in proxies if not i in known ] new = [ (time_now,i,3,0) for i in proxies if not i in known ]
if len(new): if len(new):
added = added + len(new)
sqlite.executemany('INSERT INTO proxylist (added,proxy,failed,tested) VALUES (?,?,?,?)', new) sqlite.executemany('INSERT INTO proxylist (added,proxy,failed,tested) VALUES (?,?,?,?)', new)
sqlite.commit() sqlite.commit()
_log('+%d item(s) from %s' % (len(new), uri), 'added')
if added > 0: _log('+%d item(s) from %s' % (added, uri), 'added')
def proxyfind(sqlite = None): def proxyfind(sqlite = None):
#print('entering proxyfind...') #print('entering proxyfind...')