Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-val
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-val
Commits
178b545c
Commit
178b545c
authored
Sep 19, 2014
by
David Ormsbee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add convenience methods to API when you only care about URLs.
parent
7ddf4ee7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
+21
-0
edxval/api.py
+21
-0
No files found.
edxval/api.py
View file @
178b545c
...
...
@@ -181,6 +181,27 @@ def get_video_info(edx_video_id, location=None): # pylint: disable=W0613
raise
ValInternalError
(
error_message
)
return
result
.
data
# pylint: disable=E1101
def
get_urls_for_profiles
(
edx_video_id
,
profiles
):
"""Returns a dict mapping profiles to URLs.
If the profiles or video is not found, urls will be blank.
"""
profiles_to_urls
=
{
profile
:
""
for
profile
in
profiles
}
try
:
video_info
=
get_video_info
(
edx_video_id
)
except
ValVideoNotFoundError
:
return
profiles_to_urls
for
encoded_video
in
video_info
[
"encoded_videos"
]:
if
encoded_video
[
"profile"
]
in
profiles
:
profiles_to_urls
[
encoded_video
[
"profile"
]]
=
encoded_video
[
"url"
]
return
profiles_to_urls
def
get_url_for_profile
(
edx_video_id
,
profile
):
return
get_urls_for_profiles
(
edx_video_id
,
[
profile
])[
profile
]
def
get_videos_for_course
(
course_id
):
"""
Returns an iterator of videos for the given course id
...
...
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