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
2c78f062
Commit
2c78f062
authored
Aug 07, 2013
by
Alexander Kryklia
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #603 from edx/alex/fix-videoalpha-importing-from-xml
Fix videoalpha import from xml
parents
56244783
495b5a36
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
14 deletions
+15
-14
common/lib/xmodule/xmodule/videoalpha_module.py
+15
-14
No files found.
common/lib/xmodule/xmodule/videoalpha_module.py
View file @
2c78f062
...
@@ -21,7 +21,7 @@ from django.conf import settings
...
@@ -21,7 +21,7 @@ from django.conf import settings
from
xmodule.x_module
import
XModule
from
xmodule.x_module
import
XModule
from
xmodule.editing_module
import
TabsEditingDescriptor
from
xmodule.editing_module
import
TabsEditingDescriptor
from
xmodule.raw_module
import
RawDescriptor
from
xmodule.raw_module
import
EmptyData
RawDescriptor
from
xmodule.modulestore.mongo
import
MongoModuleStore
from
xmodule.modulestore.mongo
import
MongoModuleStore
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.django
import
modulestore
from
xmodule.contentstore.content
import
StaticContent
from
xmodule.contentstore.content
import
StaticContent
...
@@ -188,7 +188,7 @@ class VideoAlphaModule(VideoAlphaFields, XModule):
...
@@ -188,7 +188,7 @@ class VideoAlphaModule(VideoAlphaFields, XModule):
})
})
class
VideoAlphaDescriptor
(
VideoAlphaFields
,
TabsEditingDescriptor
,
RawDescriptor
):
class
VideoAlphaDescriptor
(
VideoAlphaFields
,
TabsEditingDescriptor
,
EmptyData
RawDescriptor
):
"""Descriptor for `VideoAlphaModule`."""
"""Descriptor for `VideoAlphaModule`."""
module_class
=
VideoAlphaModule
module_class
=
VideoAlphaModule
...
@@ -225,8 +225,8 @@ class VideoAlphaDescriptor(VideoAlphaFields, TabsEditingDescriptor, RawDescripto
...
@@ -225,8 +225,8 @@ class VideoAlphaDescriptor(VideoAlphaFields, TabsEditingDescriptor, RawDescripto
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
"""
"""
model_data
=
VideoAlphaDescriptor
.
_parse_video_xml
(
xml_data
)
# Calling from_xml of XmlDescritor, to get right Location, when importing from XML
video
=
cls
(
system
,
model_data
)
video
=
super
(
VideoAlphaDescriptor
,
cls
)
.
from_xml
(
xml_data
,
system
,
org
,
course
)
return
video
return
video
def
export_to_xml
(
self
,
resource_fs
):
def
export_to_xml
(
self
,
resource_fs
):
...
@@ -303,6 +303,15 @@ class VideoAlphaDescriptor(VideoAlphaFields, TabsEditingDescriptor, RawDescripto
...
@@ -303,6 +303,15 @@ class VideoAlphaDescriptor(VideoAlphaFields, TabsEditingDescriptor, RawDescripto
'to'
:
'end_time'
'to'
:
'end_time'
}
}
sources
=
xml
.
findall
(
'source'
)
if
sources
:
model_data
[
'html5_sources'
]
=
[
ele
.
get
(
'src'
)
for
ele
in
sources
]
model_data
[
'source'
]
=
model_data
[
'html5_sources'
][
0
]
track
=
xml
.
find
(
'track'
)
if
track
is
not
None
:
model_data
[
'track'
]
=
track
.
get
(
'src'
)
for
attr
,
value
in
xml
.
items
():
for
attr
,
value
in
xml
.
items
():
if
attr
in
video_compat
:
if
attr
in
video_compat
:
attr
=
video_compat
[
attr
]
attr
=
video_compat
[
attr
]
...
@@ -312,7 +321,8 @@ class VideoAlphaDescriptor(VideoAlphaFields, TabsEditingDescriptor, RawDescripto
...
@@ -312,7 +321,8 @@ class VideoAlphaDescriptor(VideoAlphaFields, TabsEditingDescriptor, RawDescripto
# should have made these youtube_id_1_00 for
# should have made these youtube_id_1_00 for
# cleanliness, but hindsight doesn't need glasses
# cleanliness, but hindsight doesn't need glasses
normalized_speed
=
speed
[:
-
1
]
if
speed
.
endswith
(
'0'
)
else
speed
normalized_speed
=
speed
[:
-
1
]
if
speed
.
endswith
(
'0'
)
else
speed
if
youtube_id
!=
''
:
# If the user has specified html5 sources, make sure we don't use the default video
if
youtube_id
!=
''
or
'html5_sources'
in
model_data
:
model_data
[
'youtube_id_{0}'
.
format
(
normalized_speed
.
replace
(
'.'
,
'_'
))]
=
youtube_id
model_data
[
'youtube_id_{0}'
.
format
(
normalized_speed
.
replace
(
'.'
,
'_'
))]
=
youtube_id
else
:
else
:
# Convert XML attrs into Python values.
# Convert XML attrs into Python values.
...
@@ -320,15 +330,6 @@ class VideoAlphaDescriptor(VideoAlphaFields, TabsEditingDescriptor, RawDescripto
...
@@ -320,15 +330,6 @@ class VideoAlphaDescriptor(VideoAlphaFields, TabsEditingDescriptor, RawDescripto
value
=
conversions
[
attr
](
value
)
value
=
conversions
[
attr
](
value
)
model_data
[
attr
]
=
value
model_data
[
attr
]
=
value
sources
=
xml
.
findall
(
'source'
)
if
sources
:
model_data
[
'html5_sources'
]
=
[
ele
.
get
(
'src'
)
for
ele
in
sources
]
model_data
[
'source'
]
=
model_data
[
'html5_sources'
][
0
]
track
=
xml
.
find
(
'track'
)
if
track
is
not
None
:
model_data
[
'track'
]
=
track
.
get
(
'src'
)
return
model_data
return
model_data
@staticmethod
@staticmethod
...
...
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