Commit b648b1ae7d5dcfe7c3a6b1f70d64d63f32c85846

Authored by André Araújo
1 parent 059ff4cf
Exists in master

Atualiza endpoint do banco de sinais

Showing 2 changed files with 14 additions and 6 deletions   Show diff stats
settings_local.py.tmpl
... ... @@ -5,7 +5,7 @@ SERVER_PORT = 8003
5 5 AGREEMENT_NUMBER = 2
6 6 API_HOST = "http://localhost:201"
7 7 API_DB_HOST = "http://localhost:200"
8   -UPLOAD_SIGN_HOST = "http://localhost:200/addsinal"
  8 +UPLOAD_SIGN_HOST = "http://localhost:200/updatesinal"
9 9 HOMEPAGE_URL = "http://localhost"
10 10  
11 11 # Apache Configuration
... ... @@ -15,7 +15,7 @@ APACHE_STATIC_FILES_ENDPOINT = "/wikilibras"
15 15  
16 16 # PyBossa Configuration
17 17 PYBOSSA_APP_NAME = "WikiLibras"
18   -PYBOSSA_APP_SHORT_NAME = "wikilibras"
  18 +PYBOSSA_APP_SHORT_NAME = "wikilibras"
19 19 PYBOSSA_APP_DESCRIPTION = "Esse projeto possibilitará que voluntários contribuam na expansão de um dicionário de LIBRAS, desenvolvido para promover o inclusão e acessibilidade nos meios digitais atravé do VLIBRAS."
20 20 PYBOSSA_ENDPOINT = "http://localhost/pybossa"
21 21 PYBOSSA_API_KEY = "my-api-key"
22 22 \ No newline at end of file
... ...
wikilibras.py
... ... @@ -68,7 +68,7 @@ class Wikilibras:
68 68 def update_project(self):
69 69 app_short_name = self.config['PYBOSSA_APP_SHORT_NAME']
70 70 project = self.__find_project(app_short_name)
71   - #self.__create_tasks(project)
  71 + # self.__create_tasks(project)
72 72 self.__update_project_info(project)
73 73 result_msg = "The project " + app_short_name + " was updated."
74 74 pyutil.log(result_msg)
... ... @@ -123,9 +123,17 @@ class Wikilibras:
123 123 blend_downloaded = self.get_file(('%s/public/%s/%s.blend' % (api_host, user_id, sign_name)), blend_path)
124 124 video_downloaded = self.get_file(('%s/public/%s/%s.webm' % (api_host, user_id, sign_name)), video_path)
125 125 if (blend_downloaded and video_downloaded):
126   - files = [ ("video", (video_path, open(video_path,"rb"))), ("video", (blend_path, open(blend_path, "rb"))) ]
127   - values = { "nome": sign_name, "selo": 1, "wikilibras": True, "overwrite": True }
128   - r = requests.post(("%s/addsinal" % (api_dbhost)), files=files, data=values)
  126 + files = [
  127 + ("video", (video_path, open(video_path,"rb"))),
  128 + ("video", (blend_path, open(blend_path, "rb")))
  129 + ]
  130 + body = {
  131 + "nome": sign_name,
  132 + "idTask": task_id,
  133 + "selo": 1
  134 + }
  135 + r = requests.post(("%s/updatesinal" % (api_dbhost)), files=files, data=body)
  136 + pyutil.log(r.text)
129 137 shutil.rmtree(tmp_dir)
130 138 result_msg = self.__close_task(project_id, task_id)
131 139 else:
... ...