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
5b9e88e2
Commit
5b9e88e2
authored
Jun 11, 2013
by
Peter Fogg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable exporting video to XML for backwards compatibility.
parent
f9b825fe
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
4 deletions
+15
-4
common/lib/xmodule/xmodule/video_module.py
+15
-4
No files found.
common/lib/xmodule/xmodule/video_module.py
View file @
5b9e88e2
...
@@ -97,6 +97,13 @@ class VideoDescriptor(VideoFields,
...
@@ -97,6 +97,13 @@ class VideoDescriptor(VideoFields,
stores_state
=
True
stores_state
=
True
template_dir_name
=
"video"
template_dir_name
=
"video"
metadata_attributes
=
RawDescriptor
.
metadata_attributes
+
(
'youtube_id_1_0'
,
'youtube_id_0_75'
,
'youtube_id_1_25'
,
'youtube_id_1_5'
)
metadata_to_strip
=
RawDescriptor
.
metadata_to_strip
+
(
'show_captions'
,)
@property
@property
def
non_editable_metadata_fields
(
self
):
def
non_editable_metadata_fields
(
self
):
non_editable_fields
=
super
(
MetadataOnlyEditingDescriptor
,
self
)
.
non_editable_metadata_fields
non_editable_fields
=
super
(
MetadataOnlyEditingDescriptor
,
self
)
.
non_editable_metadata_fields
...
@@ -116,9 +123,11 @@ class VideoDescriptor(VideoFields,
...
@@ -116,9 +123,11 @@ class VideoDescriptor(VideoFields,
org and course are optional strings that will be used in the generated modules
org and course are optional strings that will be used in the generated modules
url identifiers
url identifiers
"""
"""
video
=
super
(
Raw
Descriptor
,
cls
)
.
from_xml
(
xml_data
,
system
,
org
,
course
)
video
=
super
(
Video
Descriptor
,
cls
)
.
from_xml
(
xml_data
,
system
,
org
,
course
)
xml
=
etree
.
fromstring
(
xml_data
)
xml
=
etree
.
fromstring
(
xml_data
)
video
.
display_name
=
xml
.
get
(
'display_name'
)
display_name
=
xml
.
get
(
'display_name'
)
if
display_name
:
video
.
display_name
=
display_name
youtube
=
xml
.
get
(
'youtube'
)
youtube
=
xml
.
get
(
'youtube'
)
if
youtube
:
if
youtube
:
speeds
=
_parse_youtube
(
youtube
)
speeds
=
_parse_youtube
(
youtube
)
...
@@ -160,9 +169,11 @@ def _get_first_external(xmltree, tag):
...
@@ -160,9 +169,11 @@ def _get_first_external(xmltree, tag):
def
_parse_youtube
(
data
):
def
_parse_youtube
(
data
):
'''
'''
Parses a string of Youtube IDs into a dictionary.
Parses a string of Youtube IDs such as "1.0:AXdE34_U,1.5:VO3SxfeD"
into a dictionary. Necessary for backwards compatibility with
XML-based courses.
'''
'''
ret
=
{
'0.75'
:
None
,
'1.00'
:
None
,
'1.25'
:
None
,
'1.50'
:
None
}
ret
=
{
'0.75'
:
''
,
'1.00'
:
''
,
'1.25'
:
''
,
'1.50'
:
''
}
videos
=
data
.
split
(
','
)
videos
=
data
.
split
(
','
)
for
video
in
videos
:
for
video
in
videos
:
pieces
=
video
.
split
(
':'
)
pieces
=
video
.
split
(
':'
)
...
...
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