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
84753740
Commit
84753740
authored
Jun 19, 2015
by
Nimisha Asthagiri
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #8570 from edx/mobile/video-upload-MA-844
MA-844 Video Upload: remove dependency on AssetMetaDataStore.
parents
8a112868
26d4a15d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
36 deletions
+9
-36
cms/djangoapps/contentstore/views/tests/test_videos.py
+5
-16
cms/djangoapps/contentstore/views/videos.py
+3
-19
requirements/edx/github.txt
+1
-1
No files found.
cms/djangoapps/contentstore/views/tests/test_videos.py
View file @
84753740
...
...
@@ -16,11 +16,9 @@ from mock import Mock, patch
from
edxval.api
import
create_profile
,
create_video
,
get_video_info
from
contentstore.models
import
VideoUploadConfig
from
contentstore.views.videos
import
KEY_EXPIRATION_IN_SECONDS
,
VIDEO_ASSET_TYPE
,
StatusDisplayStrings
from
contentstore.views.videos
import
KEY_EXPIRATION_IN_SECONDS
,
StatusDisplayStrings
from
contentstore.tests.utils
import
CourseTestCase
from
contentstore.utils
import
reverse_course_url
from
xmodule.assetstore
import
AssetMetadata
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.tests.factories
import
CourseFactory
...
...
@@ -47,6 +45,7 @@ class VideoUploadTestMixin(object):
"client_video_id"
:
"test1.mp4"
,
"duration"
:
42.0
,
"status"
:
"upload"
,
"courses"
:
[
unicode
(
self
.
course
.
id
)],
"encoded_videos"
:
[],
},
{
...
...
@@ -54,6 +53,7 @@ class VideoUploadTestMixin(object):
"client_video_id"
:
"test2.mp4"
,
"duration"
:
128.0
,
"status"
:
"file_complete"
,
"courses"
:
[
unicode
(
self
.
course
.
id
)],
"encoded_videos"
:
[
{
"profile"
:
"profile1"
,
...
...
@@ -74,6 +74,7 @@ class VideoUploadTestMixin(object):
"client_video_id"
:
u"nón-ascii-näme.mp4"
,
"duration"
:
256.0
,
"status"
:
"transcode_active"
,
"courses"
:
[
unicode
(
self
.
course
.
id
)],
"encoded_videos"
:
[
{
"profile"
:
"profile1"
,
...
...
@@ -91,6 +92,7 @@ class VideoUploadTestMixin(object):
"client_video_id"
:
"status_test.mp4"
,
"duration"
:
3.14
,
"status"
:
status
,
"courses"
:
[
unicode
(
self
.
course
.
id
)],
"encoded_videos"
:
[],
}
for
status
in
(
...
...
@@ -102,12 +104,6 @@ class VideoUploadTestMixin(object):
create_profile
(
profile
)
for
video
in
self
.
previous_uploads
:
create_video
(
video
)
modulestore
()
.
save_asset_metadata
(
AssetMetadata
(
self
.
course
.
id
.
make_asset_key
(
VIDEO_ASSET_TYPE
,
video
[
"edx_video_id"
])
),
self
.
user
.
id
)
def
_get_previous_upload
(
self
,
edx_video_id
):
"""Returns the previous upload with the given video id."""
...
...
@@ -289,13 +285,6 @@ class VideosHandlerTestCase(VideoUploadTestMixin, CourseTestCase):
headers
=
{
"Content-Type"
:
file_info
[
"content_type"
]}
)
# Ensure asset store was updated and the created_by field was set
asset_metadata
=
modulestore
()
.
find_asset_metadata
(
self
.
course
.
id
.
make_asset_key
(
VIDEO_ASSET_TYPE
,
video_id
)
)
self
.
assertIsNotNone
(
asset_metadata
)
self
.
assertEquals
(
asset_metadata
.
created_by
,
self
.
user
.
id
)
# Ensure VAL was updated
val_info
=
get_video_info
(
video_id
)
self
.
assertEqual
(
val_info
[
"status"
],
"upload"
)
...
...
cms/djangoapps/contentstore/views/videos.py
View file @
84753740
...
...
@@ -12,15 +12,13 @@ from django.utils.translation import ugettext as _, ugettext_noop
from
django.views.decorators.http
import
require_GET
,
require_http_methods
import
rfc6266
from
edxval.api
import
create_video
,
get_videos_for_
ids
,
SortDirection
,
VideoSortField
from
edxval.api
import
create_video
,
get_videos_for_
course
,
SortDirection
,
VideoSortField
from
opaque_keys.edx.keys
import
CourseKey
from
contentstore.models
import
VideoUploadConfig
from
contentstore.utils
import
reverse_course_url
from
edxmako.shortcuts
import
render_to_response
from
util.json_request
import
expect_json
,
JsonResponse
from
xmodule.assetstore
import
AssetMetadata
from
xmodule.modulestore.django
import
modulestore
from
.course
import
get_course_and_check_access
...
...
@@ -28,9 +26,6 @@ from .course import get_course_and_check_access
__all__
=
[
"videos_handler"
,
"video_encodings_download"
]
# String constant used in asset keys to identify video assets.
VIDEO_ASSET_TYPE
=
"video"
# Default expiration, in seconds, of one-time URLs used for uploading videos.
KEY_EXPIRATION_IN_SECONDS
=
86400
...
...
@@ -217,15 +212,9 @@ def _get_and_validate_course(course_key_string, user):
def
_get_videos
(
course
):
"""
Retrieves the list of videos from VAL corresponding to the videos listed in
the asset metadata store.
Retrieves the list of videos from VAL corresponding to this course.
"""
edx_videos_ids
=
[
v
.
asset_id
.
path
for
v
in
modulestore
()
.
get_all_asset_metadata
(
course
.
id
,
VIDEO_ASSET_TYPE
)
]
videos
=
list
(
get_videos_for_ids
(
edx_videos_ids
,
VideoSortField
.
created
,
SortDirection
.
desc
))
videos
=
list
(
get_videos_for_course
(
course
.
id
,
VideoSortField
.
created
,
SortDirection
.
desc
))
# convert VAL's status to studio's Video Upload feature status.
for
video
in
videos
:
...
...
@@ -333,11 +322,6 @@ def videos_post(course, request):
headers
=
{
"Content-Type"
:
req_file
[
"content_type"
]}
)
# persist edx_video_id as uploaded through this course
user_id
=
request
.
user
.
id
video_meta_data
=
AssetMetadata
(
course
.
id
.
make_asset_key
(
VIDEO_ASSET_TYPE
,
edx_video_id
),
created_by
=
user_id
)
modulestore
()
.
save_asset_metadata
(
video_meta_data
,
user_id
)
# persist edx_video_id in VAL
create_video
({
"edx_video_id"
:
edx_video_id
,
...
...
requirements/edx/github.txt
View file @
84753740
...
...
@@ -45,7 +45,7 @@ git+https://github.com/hmarr/django-debug-toolbar-mongo.git@b0686a76f1ce3532088c
-e git+https://github.com/edx/ease.git@b67d2928a26fe497826b6ea359b9a3d0371548a7#egg=ease==0.1.3
-e git+https://github.com/edx/i18n-tools.git@3478455a2cc59a734432264e409b8eade1e4b167#egg=i18n-tools
-e git+https://github.com/edx/edx-oauth2-provider.git@0.5.1#egg=oauth2-provider
-e git+https://github.com/edx/edx-val.git@
b1e11c9af3233bc06a17acbb33179f46d43c3b87
#egg=edx-val
-e git+https://github.com/edx/edx-val.git@
v0.0.5
#egg=edx-val
-e git+https://github.com/pmitros/RecommenderXBlock.git@518234bc354edbfc2651b9e534ddb54f96080779#egg=recommender-xblock
-e git+https://github.com/edx/edx-search.git@release-2015-06-16#egg=edx-search
-e git+https://github.com/edx/edx-milestones.git@release-2015-06-17#egg=edx-milestones
...
...
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