Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
e5a791e0
Commit
e5a791e0
authored
12 years ago
by
Victor Shnayder
Browse files
Options
Downloads
Patches
Plain Diff
Add scaffolding comments for progress tracking in video modules.
parent
21508534
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
common/lib/xmodule/video_module.py
+21
-4
21 additions, 4 deletions
common/lib/xmodule/video_module.py
with
21 additions
and
4 deletions
common/lib/xmodule/video_module.py
+
21
−
4
View file @
e5a791e0
...
...
@@ -4,6 +4,7 @@ import logging
from
lxml
import
etree
from
x_module
import
XModule
,
XModuleDescriptor
from
progress
import
Progress
log
=
logging
.
getLogger
(
"
mitx.courseware.modules
"
)
...
...
@@ -15,17 +16,32 @@ class Module(XModule):
video_time
=
0
def
handle_ajax
(
self
,
dispatch
,
get
):
'''
Handle ajax calls to this video.
TODO (vshnayder): This is not being called right now, so the position
is not being saved.
'''
log
.
debug
(
u
"
GET {0}
"
.
format
(
get
))
log
.
debug
(
u
"
DISPATCH {0}
"
.
format
(
dispatch
))
if
dispatch
==
'
goto_position
'
:
self
.
position
=
int
(
float
(
get
[
'
position
'
]))
log
.
debug
(
u
"
NEW POSITION {0}
"
.
format
(
self
.
position
))
log
.
info
(
u
"
NEW POSITION {0}
"
.
format
(
self
.
position
))
return
json
.
dumps
({
'
success
'
:
True
})
raise
Http404
()
def
get_progress
(
self
):
'''
TODO (vshnayder): Get and save duration of youtube video, then return
fraction watched.
(Be careful to notice when video link changes and update)
For now, we have no way of knowing if the video has even been watched, so
just return None.
'''
return
None
def
get_state
(
self
):
log
.
debug
(
u
"
STATE POSITION {0}
"
.
format
(
self
.
position
))
return
json
.
dumps
({
'
position
'
:
self
.
position
})
return
json
.
dumps
({
'
position
'
:
self
.
position
})
@classmethod
def
get_xml_tags
(
c
):
...
...
@@ -41,15 +57,16 @@ class Module(XModule):
'
id
'
:
self
.
item_id
,
'
position
'
:
self
.
position
,
'
name
'
:
self
.
name
,
'
annotations
'
:
self
.
annotations
'
annotations
'
:
self
.
annotations
,
})
def
__init__
(
self
,
system
,
xml
,
item_id
,
state
=
None
):
XModule
.
__init__
(
self
,
system
,
xml
,
item_id
,
state
)
xmltree
=
etree
.
fromstring
(
xml
)
xmltree
=
etree
.
fromstring
(
xml
)
self
.
youtube
=
xmltree
.
get
(
'
youtube
'
)
self
.
name
=
xmltree
.
get
(
'
name
'
)
self
.
position
=
0
if
state
is
not
None
:
state
=
json
.
loads
(
state
)
if
'
position
'
in
state
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment