예제 #1
0
def giveanumkey(prefix, qry=0):
    key = prefix
    amount = kvdb.qrykey(key)

    if qry == 1:
        return amount
    else:
        return 1

    if amount and amount < 10:
        amount += 1
        kvdb.replacekey(key, amount)
    else:
        amount = 1
        kvdb.createkey(key, amount)
    return amount
예제 #2
0
파일: myapp.py 프로젝트: agostop/mkvprocess
def pullurl():
	try:
		MaxTask = kvdb.qrykey('maxtask')
	
		if not MaxTask :
			kvdb.createkey('maxtask',0)
	
		if request.form:
			download_url = request.form['url']
			download_opt = request.form['opt']
			MaxTask += 1
			url_key = 'url_%s' % MaxTask
			url_opt = 'opt_%s' % url_key
			if not kvdb.addkey(url_key, download_url):
				kvdb.createkey(url_key,download_url)
			if not kvdb.addkey(url_opt, download_opt):
				kvdb.createkey(url_opt, download_opt)

			kvdb.setkey('maxtask',MaxTask)
			return 'now the maxtask is %s \nthe url is : %s : %s\n%s : %s' % (
					kvdb.qrykey('maxtask'),
					url_key,
					kvdb.qrykey(url_key),
					url_opt,
					kvdb.qrykey(url_opt)
					)
		else:
			return 'no form data'
	except Exception,ex:
		return '%s : %s'% (Exception,ex)