Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
acf298e9
Commit
acf298e9
authored
Jun 12, 2014
by
Alexander Kryklia
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4074 from edx/alex/fix_video_saved_editor
Fix failing test and update documentation of video player
parents
5bcd4c54
6ea3c8cb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
13 deletions
+33
-13
common/lib/xmodule/xmodule/video_module/video_module.py
+28
-8
common/lib/xmodule/xmodule/x_module.py
+2
-2
common/test/acceptance/tests/video/test_video_module.py
+3
-3
No files found.
common/lib/xmodule/xmodule/video_module/video_module.py
View file @
acf298e9
...
...
@@ -25,7 +25,7 @@ from django.conf import settings
from
xblock.fields
import
ScopeIds
from
xblock.runtime
import
KvsFieldData
from
xmodule.modulestore.inheritance
import
InheritanceKeyValueStore
from
xmodule.modulestore.inheritance
import
InheritanceKeyValueStore
,
own_metadata
from
xmodule.x_module
import
XModule
,
module_attr
from
xmodule.editing_module
import
TabsEditingDescriptor
from
xmodule.raw_module
import
EmptyDataRawDescriptor
...
...
@@ -231,14 +231,34 @@ class VideoDescriptor(VideoFields, VideoStudioViewHandlers, TabsEditingDescripto
def
editor_saved
(
self
,
user
,
old_metadata
,
old_content
):
"""
Used to update video subtitles.
Used to update video values during `self`:save method from CMS.
old_metadata: dict, values of fields of `self` with scope=settings which were explicitly set by user.
old_content, same as `old_metadata` but for scope=content.
Due to nature of code flow in item.py::_save_item, before current function is called,
fields of `self` instance have been already updated, but not yet saved.
To obtain values, which were changed by user input,
one should compare own_metadata(self) and old_medatada.
Video player has two tabs, and due to nature of sync between tabs,
metadata from Basic tab is always sent when video player is edited and saved first time, for example:
{'youtube_id_1_0': u'OEoXaMPEzfM', 'display_name': u'Video', 'sub': u'OEoXaMPEzfM', 'html5_sources': []},
that's why these fields will always present in old_metadata after first save. This should be fixed.
At consequent save requests html5_sources are always sent too, disregard of their change by user.
That means that html5_sources are always in list of fields that were changed (`metadata` param in save_item).
This should be fixed too.
"""
manage_video_subtitles_save
(
self
,
user
,
old_metadata
if
old_metadata
else
None
,
generate_translation
=
True
)
metadata_was_changed_by_user
=
old_metadata
!=
own_metadata
(
self
)
if
metadata_was_changed_by_user
:
manage_video_subtitles_save
(
self
,
user
,
old_metadata
if
old_metadata
else
None
,
generate_translation
=
True
)
def
save_with_metadata
(
self
,
user
):
"""
...
...
common/lib/xmodule/xmodule/x_module.py
View file @
acf298e9
...
...
@@ -777,8 +777,8 @@ class XModuleDescriptor(XModuleMixin, HTMLSnippet, ResourceTemplates, XBlock):
Note that after this method is called, the modulestore update_item method will
be called on this xmodule. Therefore, any modifications to the xmodule that are
performed in editor_saved will automatically be persisted (
implementors of this method
should not call update_item themselves
).
performed in editor_saved will automatically be persisted (
calling update_item
from implementors of this method is not necessary
).
Args:
user: the user who requested the save (as obtained from the request)
...
...
common/test/acceptance/tests/video/test_video_module.py
View file @
acf298e9
...
...
@@ -267,7 +267,6 @@ class YouTubeVideoTest(VideoBaseTest):
unicode_text
=
"好 各位同学"
.
decode
(
'utf-8'
)
self
.
assertIn
(
unicode_text
,
self
.
video
.
captions_text
())
@skip
(
"Failing Intermittently in master. BLD-1115"
)
def
test_cc_button_transcripts_and_sub_fields_empty
(
self
):
"""
Scenario: CC button works correctly if transcripts and sub fields are empty,
...
...
@@ -276,8 +275,9 @@ class YouTubeVideoTest(VideoBaseTest):
And I have uploaded a .srt.sjson file to assets
Then I see the correct english text in the captions
"""
self
.
assets
.
append
(
'subs_OEoXaMPEzfM.srt.sjson'
)
self
.
navigate_to_video
()
self
.
_install_course_fixture
()
self
.
course_fixture
.
_upload_assets
([
'subs_OEoXaMPEzfM.srt.sjson'
])
self
.
_navigate_to_courseware_video_and_render
()
self
.
video
.
show_captions
()
# Verify that we see "Hi, welcome to Edx." text in the captions
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment