ppf: write dates as int
This commit is contained in:
10
ppf.py
10
ppf.py
@@ -34,7 +34,7 @@ def import_from_file(fn, sqlite):
|
||||
exists = [ i[0] for i in sqlite.execute('SELECT url FROM uris WHERE url=?',(u,)).fetchall() ]
|
||||
if exists: continue
|
||||
print('adding "%s"' % u)
|
||||
sqlite.execute('INSERT INTO uris (added,url,check_time,error) VALUES (?,?,?,?)', (time.time(),u,0,1))
|
||||
sqlite.execute('INSERT INTO uris (added,url,check_time,error) VALUES (?,?,?,?)', (int(time.time()),u,0,1))
|
||||
sqlite.commit()
|
||||
|
||||
def fetch_contents(url):
|
||||
@@ -95,7 +95,7 @@ def proxyfind(sqlite = None):
|
||||
if len(urls):
|
||||
query = [ 'url=?' for u in urls ]
|
||||
known = [ i[0] for i in sqlite.execute('SELECT url FROM uris WHERE %s' % ' OR '.join(query),urls).fetchall() ]
|
||||
time_now = time.time()
|
||||
time_now = int(time.time())
|
||||
new = [ (time_now,i,0,5,0) for i in urls if not i in known ]
|
||||
if len(new):
|
||||
sqlite.executemany('INSERT INTO uris (added,url,check_time,error,driver) values(?,?,?,?,?)', new)
|
||||
@@ -139,13 +139,13 @@ def proxyleech(sqlite, rows):
|
||||
else: row[2] = 0
|
||||
|
||||
#check_time = (time.time() + 3600 + (3600 * row[2]))
|
||||
sqlite.execute('UPDATE uris SET error=?,hash=?,check_time=? where url=?', (row[2],hash, time.time(),row[0]))
|
||||
sqlite.execute('UPDATE uris SET error=?,hash=?,check_time=? where url=?', (row[2],hash, int(time.time()),row[0]))
|
||||
sqlite.commit()
|
||||
|
||||
if not row[1] or row[2] > 0: return
|
||||
|
||||
add = []
|
||||
time_now = time.time()
|
||||
time_now = int(time.time())
|
||||
for i in uniques:
|
||||
add.append(i)
|
||||
if len(add) > 500:
|
||||
@@ -187,7 +187,7 @@ if __name__ == '__main__':
|
||||
while True:
|
||||
try:
|
||||
## any site that needs to be checked ?
|
||||
rows = [ [i[0],i[1],i[2]] for i in sqlite.execute('SELECT url,hash,error FROM uris WHERE (check_time+?+(error*?) <?) ORDER BY RANDOM() LIMIT 25', (config.ppf.checktime, config.ppf.perfail_checktime, time.time())).fetchall() ]
|
||||
rows = [ [i[0],i[1],i[2]] for i in sqlite.execute('SELECT url,hash,error FROM uris WHERE (check_time+?+(error*?) <?) ORDER BY RANDOM() LIMIT 25', (config.ppf.checktime, config.ppf.perfail_checktime, int(time.time()))).fetchall() ]
|
||||
|
||||
if len(rows): proxyleech(sqlite,rows)
|
||||
## search for new website during free time
|
||||
|
||||
Reference in New Issue
Block a user