Commit 1cf18a2c5e7297be622027f3483fd57dad16c666
1 parent
059ff4cf
Exists in
master
Handle for the new task model
Showing
5 changed files
with
27 additions
and
7 deletions
Show diff stats
settings_local.py.tmpl
| @@ -5,7 +5,6 @@ SERVER_PORT = 8003 | @@ -5,7 +5,6 @@ SERVER_PORT = 8003 | ||
| 5 | AGREEMENT_NUMBER = 2 | 5 | AGREEMENT_NUMBER = 2 |
| 6 | API_HOST = "http://localhost:201" | 6 | API_HOST = "http://localhost:201" |
| 7 | API_DB_HOST = "http://localhost:200" | 7 | API_DB_HOST = "http://localhost:200" |
| 8 | -UPLOAD_SIGN_HOST = "http://localhost:200/addsinal" | ||
| 9 | HOMEPAGE_URL = "http://localhost" | 8 | HOMEPAGE_URL = "http://localhost" |
| 10 | 9 | ||
| 11 | # Apache Configuration | 10 | # Apache Configuration |
view/js/helpers/video-helper.js
| @@ -5,6 +5,12 @@ | @@ -5,6 +5,12 @@ | ||
| 5 | + '<source src="' + encodeURI(videoBaseUrl + '.mp4') + '" type="video/mp4">Sem suporte a vídeos'; | 5 | + '<source src="' + encodeURI(videoBaseUrl + '.mp4') + '" type="video/mp4">Sem suporte a vídeos'; |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | + function _getSourceByWebmUrl(webmUrl) { | ||
| 9 | + var mp4Url = webmUrl.replace('.webm', '.mp4'); | ||
| 10 | + return '<source src="' + encodeURI(webmUrl) + '" type="video/webm">' | ||
| 11 | + + '<source src="' + encodeURI(mp4Url) + '" type="video/mp4">Sem suporte a vídeos'; | ||
| 12 | + } | ||
| 13 | + | ||
| 8 | function _controlVideo(elId, toPlay) { | 14 | function _controlVideo(elId, toPlay) { |
| 9 | if ($(elId).length === 0) | 15 | if ($(elId).length === 0) |
| 10 | return; | 16 | return; |
| @@ -27,4 +33,8 @@ | @@ -27,4 +33,8 @@ | ||
| 27 | return _getSource(videoBaseUrl); | 33 | return _getSource(videoBaseUrl); |
| 28 | }; | 34 | }; |
| 29 | 35 | ||
| 36 | + videoHelper.getSourceByWebmUrl = function(webmUrl) { | ||
| 37 | + return _getSourceByWebmUrl(webmUrl); | ||
| 38 | + }; | ||
| 39 | + | ||
| 30 | }(window.videoHelper = window.videoHelper || {}, jQuery)); | 40 | }(window.videoHelper = window.videoHelper || {}, jQuery)); |
view/js/submit-sign.js
| @@ -190,7 +190,7 @@ | @@ -190,7 +190,7 @@ | ||
| 190 | }; | 190 | }; |
| 191 | 191 | ||
| 192 | submitSign.setup = function(uploadSignHost, user) { | 192 | submitSign.setup = function(uploadSignHost, user) { |
| 193 | - submitUrl = uploadSignHost; | 193 | + submitUrl = uploadSignHost + "/addsinal"; |
| 194 | loggedUser = user; | 194 | loggedUser = user; |
| 195 | loadHtmlHelper.load('/submit-sign/submit-sign.html', | 195 | loadHtmlHelper.load('/submit-sign/submit-sign.html', |
| 196 | '#submit-sign-container', _setupSubmitSignForm); | 196 | '#submit-sign-container', _setupSubmitSignForm); |
view/js/wikilibras.js
| @@ -33,9 +33,19 @@ | @@ -33,9 +33,19 @@ | ||
| 33 | function _loadTaskInfo(task) { | 33 | function _loadTaskInfo(task) { |
| 34 | currentTaskId = task.id; | 34 | currentTaskId = task.id; |
| 35 | var signName = task.info.sign_name; | 35 | var signName = task.info.sign_name; |
| 36 | - var baseRefVidUrl = videosUrl + signName + '_REF'; | 36 | + var videoRef = task.info.video_ref; |
| 37 | + var videoSource = ''; | ||
| 38 | + | ||
| 39 | + if (isDemoTask) { | ||
| 40 | + var baseRefVidUrl = videosUrl + signName + '_REF'; | ||
| 41 | + videoSource = videoHelper.getSource(baseRefVidUrl); | ||
| 42 | + } else { | ||
| 43 | + var webmVideoUrl = uploadSignsUrl + videoRef; | ||
| 44 | + videoSource = videoHelper.getSourceByWebmUrl(webmVideoUrl); | ||
| 45 | + } | ||
| 46 | + | ||
| 37 | $('.sign-label').text(signName); | 47 | $('.sign-label').text(signName); |
| 38 | - $('.ref-video').html(videoHelper.getSource(baseRefVidUrl)); | 48 | + $('.ref-video').html(videoSource); |
| 39 | _setupTmpParameterJSON(task.info.sign_name); | 49 | _setupTmpParameterJSON(task.info.sign_name); |
| 40 | } | 50 | } |
| 41 | 51 |
wikilibras.py
| @@ -18,7 +18,8 @@ class Wikilibras: | @@ -18,7 +18,8 @@ class Wikilibras: | ||
| 18 | def __create_tasks(self, project): | 18 | def __create_tasks(self, project): |
| 19 | test_signs = ["ENSINADO", "ENTANTO", "ENTENDIDO"] | 19 | test_signs = ["ENSINADO", "ENTANTO", "ENTENDIDO"] |
| 20 | for sign in test_signs: | 20 | for sign in test_signs: |
| 21 | - task = dict(sign_name=sign, submission_date=pyutil.get_date_now()) | 21 | + video_ref = "/videos/" + sign + "_REF.webm" |
| 22 | + task = dict(sign_name=sign, submission_date=pyutil.get_date_now(), video_ref=video_ref) | ||
| 22 | pbclient.create_task(project.id, task) | 23 | pbclient.create_task(project.id, task) |
| 23 | 24 | ||
| 24 | def __setup_pb_client(self): | 25 | def __setup_pb_client(self): |
| @@ -40,7 +41,7 @@ class Wikilibras: | @@ -40,7 +41,7 @@ class Wikilibras: | ||
| 40 | app_shortname = self.config['PYBOSSA_APP_SHORT_NAME'], | 41 | app_shortname = self.config['PYBOSSA_APP_SHORT_NAME'], |
| 41 | api_host = self.config['API_HOST'], | 42 | api_host = self.config['API_HOST'], |
| 42 | homepage_url = self.config['HOMEPAGE_URL'], | 43 | homepage_url = self.config['HOMEPAGE_URL'], |
| 43 | - upload_sign_host = self.config['UPLOAD_SIGN_HOST'] | 44 | + upload_sign_host = self.config['API_DB_HOST'] |
| 44 | ) | 45 | ) |
| 45 | project.info['thumbnail'] = self.config['HOST_STATIC_FILES_ENDPOINT'] + "/img/thumbnail.png" | 46 | project.info['thumbnail'] = self.config['HOST_STATIC_FILES_ENDPOINT'] + "/img/thumbnail.png" |
| 46 | project.info['sched'] = "incremental" | 47 | project.info['sched'] = "incremental" |
| @@ -68,7 +69,7 @@ class Wikilibras: | @@ -68,7 +69,7 @@ class Wikilibras: | ||
| 68 | def update_project(self): | 69 | def update_project(self): |
| 69 | app_short_name = self.config['PYBOSSA_APP_SHORT_NAME'] | 70 | app_short_name = self.config['PYBOSSA_APP_SHORT_NAME'] |
| 70 | project = self.__find_project(app_short_name) | 71 | project = self.__find_project(app_short_name) |
| 71 | - #self.__create_tasks(project) | 72 | + #self.__create_tasks(project) |
| 72 | self.__update_project_info(project) | 73 | self.__update_project_info(project) |
| 73 | result_msg = "The project " + app_short_name + " was updated." | 74 | result_msg = "The project " + app_short_name + " was updated." |
| 74 | pyutil.log(result_msg) | 75 | pyutil.log(result_msg) |