Ejemplo n.º 1
0
def edit(uid):
	elements = ['category','entity','winner','year']
	for i in request.args.keys():
		if i in elements:
			param = request.args.get(i).replace("_", " ")
			rd.hset(uid, i, param)
	return jsonify(rd.hgetall(uid))
Ejemplo n.º 2
0
def showyearcat(year,category):
	filmlist = []
	category = category.replace("_", " ")
	for key in rd.keys():
		if rd.hget(key,'year') == year and category == rd.hget(key,'category'):
			filmlist.append(rd.hgetall(key))
	return jsonify(filmlist)
Ejemplo n.º 3
0
def showname(entity):
	filmlist = []
	entity = entity.replace("_", " ")
	for key in rd.keys():
		if entity == rd.hget(key,'entity'):
			filmlist.append(rd.hgetall(key))
	return jsonify(filmlist)
Ejemplo n.º 4
0
def create():
	category = request.args.get('category').replace("_", " ")
	entity = request.args.get('entity').replace("_", " ")
	winner = request.args.get('winner').replace("_", " ")
	year = request.args.get('year').replace("_", " ")
	uid = str(uuid.uuid4())

	rd.hmset(uid, {"category": category, "entity": entity, "winner": winner, "year": year, "uid": uid})
	return jsonify(rd.hgetall(uid))
Ejemplo n.º 5
0
def showrange():
	start = request.args.get('start')
	end = request.args.get('end')
	rangelist = []
	for key in rd.keys():
		year = rd.hget(key,'year')
		if year >= start and year <= end:
			rangelist.append(rd.hgetall(key))
	
	return "\n".join([str(x) for x in rangelist])
Ejemplo n.º 6
0
def showuid(uid):
	return jsonify(rd.hgetall(uid))
Ejemplo n.º 7
0
def showyear(year):
	filmlist = []
	for key in rd.keys():
		if rd.hget(key,'year') == year: 
			filmlist.append(rd.hgetall(key))	
	return "\n".join([str(x) for x in filmlist])
Ejemplo n.º 8
0
def deleteuid(uid):
	gone = rd.hgetall(uid)
	rd.delete(uid)
	gone['status'] = "DELETED"
	return jsonify(gone)