Example #1
0
def contents(param):
	x = Videos()
	
	hash = param['hash']
	publc = param['publc']
	type = param['type']
	
	# create a hash
	m = md5.new(publc + _private_key())

	# check if this hash is equal to the one transmitted
	if m.hexdigest() == hash:
	
		data = x.allPublicByType(param)
		
		obj = {}
		i = 0
		if data:
			for item in data:
				obj[i] = {
					'id' : item[0],
					'category' : item[1],
					'tags' : item[2],
					'data' : item[3]
					#'date_added': item[4]
				}
				i = i + 1
		else:
			obj = False
		
		dat = {
			'id': 1234, # just a random id
			'records': x.countRecords('videos', type, 1),
			'data': obj
		}
	else:
		dat = {
			'id': 1234, # just a random id
			'records': 0,
			'data': False
		}
	return dat