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
e5a791e0
Commit
e5a791e0
authored
Jun 20, 2012
by
Victor Shnayder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add scaffolding comments for progress tracking in video modules.
parent
21508534
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
4 deletions
+21
-4
common/lib/xmodule/video_module.py
+21
-4
No files found.
common/lib/xmodule/video_module.py
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
:
...
...
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