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
view/js/helpers/video-helper.js
| ... | ... | @@ -5,6 +5,12 @@ |
| 5 | 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 | 14 | function _controlVideo(elId, toPlay) { |
| 9 | 15 | if ($(elId).length === 0) |
| 10 | 16 | return; |
| ... | ... | @@ -27,4 +33,8 @@ |
| 27 | 33 | return _getSource(videoBaseUrl); |
| 28 | 34 | }; |
| 29 | 35 | |
| 36 | + videoHelper.getSourceByWebmUrl = function(webmUrl) { | |
| 37 | + return _getSourceByWebmUrl(webmUrl); | |
| 38 | + }; | |
| 39 | + | |
| 30 | 40 | }(window.videoHelper = window.videoHelper || {}, jQuery)); | ... | ... |
view/js/submit-sign.js
| ... | ... | @@ -190,7 +190,7 @@ |
| 190 | 190 | }; |
| 191 | 191 | |
| 192 | 192 | submitSign.setup = function(uploadSignHost, user) { |
| 193 | - submitUrl = uploadSignHost; | |
| 193 | + submitUrl = uploadSignHost + "/addsinal"; | |
| 194 | 194 | loggedUser = user; |
| 195 | 195 | loadHtmlHelper.load('/submit-sign/submit-sign.html', |
| 196 | 196 | '#submit-sign-container', _setupSubmitSignForm); | ... | ... |
view/js/wikilibras.js
| ... | ... | @@ -33,9 +33,19 @@ |
| 33 | 33 | function _loadTaskInfo(task) { |
| 34 | 34 | currentTaskId = task.id; |
| 35 | 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 | 47 | $('.sign-label').text(signName); |
| 38 | - $('.ref-video').html(videoHelper.getSource(baseRefVidUrl)); | |
| 48 | + $('.ref-video').html(videoSource); | |
| 39 | 49 | _setupTmpParameterJSON(task.info.sign_name); |
| 40 | 50 | } |
| 41 | 51 | ... | ... |
wikilibras.py
| ... | ... | @@ -18,7 +18,8 @@ class Wikilibras: |
| 18 | 18 | def __create_tasks(self, project): |
| 19 | 19 | test_signs = ["ENSINADO", "ENTANTO", "ENTENDIDO"] |
| 20 | 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 | 23 | pbclient.create_task(project.id, task) |
| 23 | 24 | |
| 24 | 25 | def __setup_pb_client(self): |
| ... | ... | @@ -40,7 +41,7 @@ class Wikilibras: |
| 40 | 41 | app_shortname = self.config['PYBOSSA_APP_SHORT_NAME'], |
| 41 | 42 | api_host = self.config['API_HOST'], |
| 42 | 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 | 46 | project.info['thumbnail'] = self.config['HOST_STATIC_FILES_ENDPOINT'] + "/img/thumbnail.png" |
| 46 | 47 | project.info['sched'] = "incremental" |
| ... | ... | @@ -68,7 +69,7 @@ class Wikilibras: |
| 68 | 69 | def update_project(self): |
| 69 | 70 | app_short_name = self.config['PYBOSSA_APP_SHORT_NAME'] |
| 70 | 71 | project = self.__find_project(app_short_name) |
| 71 | - #self.__create_tasks(project) | |
| 72 | + #self.__create_tasks(project) | |
| 72 | 73 | self.__update_project_info(project) |
| 73 | 74 | result_msg = "The project " + app_short_name + " was updated." |
| 74 | 75 | pyutil.log(result_msg) | ... | ... |