Change lim/max settings only for current "run"

master
pictuga 2014-01-19 23:36:41 +01:00
parent 0f7bc568e4
commit 4e549dc88a
1 changed files with 15 additions and 15 deletions

View File

@ -571,24 +571,24 @@ def Gather(rss, url, cache, options):
startTime = time.time() startTime = time.time()
# custom settings # custom settings
global LIM_ITEM lim_item = LIM_ITEM
global LIM_TIME lim_time = LIM_TIME
global MAX_ITEM max_item = MAX_ITEM
global MAX_TIME max_time = MAX_TIME
if options.progress: if options.progress:
MAX_TIME = -1 max_time = 12
LIM_TIME = 15 lim_time = 13
MAX_ITEM = -1 max_item = -1
LIM_ITEM = -1 lim_item = -1
if options.cache: if options.cache:
MAX_TIME = 0 max_time = 0
if options.OFCOURSENOT: if options.OFCOURSENOT:
log('welcome home') log('welcome home')
LIM_ITEM = -1 lim_item = -1
LIM_TIME = -1 lim_time = -1
MAX_ITEM = -1 max_item = -1
MAX_TIME = -1 max_time = -1
# set # set
def runner(queue): def runner(queue):
@ -601,14 +601,14 @@ def Gather(rss, url, cache, options):
queue.task_done() queue.task_done()
def worker(i, item): def worker(i, item):
if time.time() - startTime > LIM_TIME >= 0 or i+1 > LIM_ITEM >= 0: if time.time() - startTime > lim_time >= 0 or i+1 > lim_item >= 0:
log('dropped') log('dropped')
item.remove() item.remove()
return return
item = Fix(item, url) item = Fix(item, url)
if time.time() - startTime > MAX_TIME >= 0 or i+1 > MAX_ITEM >= 0: if time.time() - startTime > max_time >= 0 or i+1 > max_item >= 0:
if not options.proxy: if not options.proxy:
if Fill(item, cache, url, True) is False: if Fill(item, cache, url, True) is False:
item.remove() item.remove()