Exemplo n.º 1
0
def updateLikes(email):
	id_user = database_helper.get_id_by_email(email)
	if id_user != 'wrong email':
		if id_user in list_token_id.values():
			for token in list_token_id:
				if id_user==list_token_id.get(token) and token in list_conection:
						result = {}  
						result['number_like']=database_helper.get_number_likes_by_token(id_user)
						list_conection.get(token).send(create_message("updateLike",json.dumps(result)))
						break	
Exemplo n.º 2
0
def download_video_by_email(token,email):
	if token != None and list_token_id.has_key(token) and email!= None:
		id_user=database_helper.get_id_by_email(email)
		if id_user=='wrong email':
			return bytearray([])			
		filename=database_helper.get_name_video(id_user)
		if filename!='' and filename!=None:
			if os.path.isfile(UPLOAD_FOLDER+'/'+filename): #check if file exist
				result=send_from_directory(UPLOAD_FOLDER,filename, as_attachment=True)
				return result
			else:
				return bytearray([])
		else:
			return bytearray([])
	else:
		return bytearray([])