Exemple #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))
Exemple #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)
Exemple #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)
Exemple #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))
Exemple #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])
Exemple #6
0
def showuid(uid):
	return jsonify(rd.hgetall(uid))
Exemple #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])
Exemple #8
0
def deleteuid(uid):
	gone = rd.hgetall(uid)
	rd.delete(uid)
	gone['status'] = "DELETED"
	return jsonify(gone)