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
7bf717f7
Commit
7bf717f7
authored
Jun 08, 2017
by
Mushtaq Ali
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add video image settings to aws settings so that lms can pull values from lms.env.json
parent
cf6200cb
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
53 additions
and
42 deletions
+53
-42
cms/djangoapps/contentstore/views/tests/test_videos.py
+37
-36
cms/djangoapps/contentstore/views/videos.py
+5
-5
cms/static/js/views/previous_video_upload.js
+8
-1
lms/envs/aws.py
+3
-0
No files found.
cms/djangoapps/contentstore/views/tests/test_videos.py
View file @
7bf717f7
...
...
@@ -711,75 +711,76 @@ class VideoImageTestCase(VideoUploadTestBase, CourseTestCase):
image_min_size
=
settings
.
VIDEO_IMAGE_MIN_FILE_SIZE_KB
)
),
# Image file
resolution validation
# Image file
minimum width / height
(
{
'width'
:
settings
.
VIDEO_IMAGE_MAX_WIDTH
,
# 1280x720
'height'
:
settings
.
VIDEO_IMAGE_MAX_HEIGHT
'width'
:
16
,
# 16x9
'height'
:
9
},
None
'The minimum allowed image resolution is {image_file_min_width}x{image_file_min_height}.'
.
format
(
image_file_min_width
=
settings
.
VIDEO_IMAGE_MIN_WIDTH
,
image_file_min_height
=
settings
.
VIDEO_IMAGE_MIN_HEIGHT
)
),
(
{
'width'
:
850
,
# 16:9
'height'
:
478
'width'
:
settings
.
VIDEO_IMAGE_MIN_WIDTH
-
10
,
'height'
:
settings
.
VIDEO_IMAGE_MIN_HEIGHT
},
None
'The minimum allowed image resolution is {image_file_min_width}x{image_file_min_height}.'
.
format
(
image_file_min_width
=
settings
.
VIDEO_IMAGE_MIN_WIDTH
,
image_file_min_height
=
settings
.
VIDEO_IMAGE_MIN_HEIGHT
)
),
(
{
'width'
:
940
,
# 1.67 ratio, applicable aspect ratio margin of .01
'height'
:
56
0
'width'
:
settings
.
VIDEO_IMAGE_MIN_WIDTH
,
'height'
:
settings
.
VIDEO_IMAGE_MIN_HEIGHT
-
1
0
},
None
'The minimum allowed image resolution is {image_file_min_width}x{image_file_min_height}.'
.
format
(
image_file_min_width
=
settings
.
VIDEO_IMAGE_MIN_WIDTH
,
image_file_min_height
=
settings
.
VIDEO_IMAGE_MIN_HEIGHT
)
),
(
{
'width'
:
1200
,
# not 16:9
'width'
:
1200
,
# not 16:9
, but width/height check first.
'height'
:
100
},
'This image file must have an aspect ratio of {video_image_aspect_ratio_text}.'
.
format
(
video_image_aspect_ratio_text
=
settings
.
VIDEO_IMAGE_ASPECT_RATIO_TEXT
'The minimum allowed image resolution is {image_file_min_width}x{image_file_min_height}.'
.
format
(
image_file_min_width
=
settings
.
VIDEO_IMAGE_MIN_WIDTH
,
image_file_min_height
=
settings
.
VIDEO_IMAGE_MIN_HEIGHT
)
),
# Image file aspect ratio validation
(
{
'width'
:
settings
.
VIDEO_IMAGE_M
IN_WIDTH
+
100
,
'height'
:
settings
.
VIDEO_IMAGE_M
IN_HEIGHT
+
200
'width'
:
settings
.
VIDEO_IMAGE_M
AX_WIDTH
,
# 1280x720
'height'
:
settings
.
VIDEO_IMAGE_M
AX_HEIGHT
},
'This image file must have an aspect ratio of {video_image_aspect_ratio_text}.'
.
format
(
video_image_aspect_ratio_text
=
settings
.
VIDEO_IMAGE_ASPECT_RATIO_TEXT
)
None
),
# Image file minimum width / height
(
{
'width'
:
16
,
# 16x
9
'height'
:
9
'width'
:
850
,
# 16:
9
'height'
:
478
},
'The minimum allowed image resolution is {image_file_min_width}x{image_file_min_height}.'
.
format
(
image_file_min_width
=
settings
.
VIDEO_IMAGE_MIN_WIDTH
,
image_file_min_height
=
settings
.
VIDEO_IMAGE_MIN_HEIGHT
)
None
),
(
{
'width'
:
settings
.
VIDEO_IMAGE_MIN_WIDTH
-
10
,
'height'
:
settings
.
VIDEO_IMAGE_MIN_HEIGHT
'width'
:
940
,
# 1.67 ratio, applicable aspect ratio margin of .01
'height'
:
560
},
'The minimum allowed image resolution is {image_file_min_width}x{image_file_min_height}.'
.
format
(
image_file_min_width
=
settings
.
VIDEO_IMAGE_MIN_WIDTH
,
image_file_min_height
=
settings
.
VIDEO_IMAGE_MIN_HEIGHT
)
None
),
(
{
'width'
:
settings
.
VIDEO_IMAGE_MIN_WIDTH
,
'height'
:
settings
.
VIDEO_IMAGE_MIN_HEIGHT
-
1
0
'width'
:
settings
.
VIDEO_IMAGE_MIN_WIDTH
+
100
,
'height'
:
settings
.
VIDEO_IMAGE_MIN_HEIGHT
+
20
0
},
'The minimum allowed image resolution is {image_file_min_width}x{image_file_min_height}.'
.
format
(
image_file_min_width
=
settings
.
VIDEO_IMAGE_MIN_WIDTH
,
image_file_min_height
=
settings
.
VIDEO_IMAGE_MIN_HEIGHT
'This image file must have an aspect ratio of {video_image_aspect_ratio_text}.'
.
format
(
video_image_aspect_ratio_text
=
settings
.
VIDEO_IMAGE_ASPECT_RATIO_TEXT
)
),
# Image file name validation
...
...
cms/djangoapps/contentstore/views/videos.py
View file @
7bf717f7
...
...
@@ -186,15 +186,15 @@ def validate_video_image(image_file):
except
TypeError
:
return
_
(
'This image file is corrupted.'
)
image_file_aspect_ratio
=
abs
(
image_file_width
/
float
(
image_file_height
)
-
settings
.
VIDEO_IMAGE_ASPECT_RATIO
)
if
image_file_aspect_ratio
>
settings
.
VIDEO_IMAGE_ASPECT_RATIO_ERROR_MARGIN
:
error
=
_
(
'This image file must have an aspect ratio of {video_image_aspect_ratio_text}.'
)
.
format
(
video_image_aspect_ratio_text
=
settings
.
VIDEO_IMAGE_ASPECT_RATIO_TEXT
)
elif
image_file_width
<
settings
.
VIDEO_IMAGE_MIN_WIDTH
or
image_file_height
<
settings
.
VIDEO_IMAGE_MIN_HEIGHT
:
if
image_file_width
<
settings
.
VIDEO_IMAGE_MIN_WIDTH
or
image_file_height
<
settings
.
VIDEO_IMAGE_MIN_HEIGHT
:
error
=
_
(
'The minimum allowed image resolution is {image_file_min_width}x{image_file_min_height}.'
)
.
format
(
image_file_min_width
=
settings
.
VIDEO_IMAGE_MIN_WIDTH
,
image_file_min_height
=
settings
.
VIDEO_IMAGE_MIN_HEIGHT
)
elif
image_file_aspect_ratio
>
settings
.
VIDEO_IMAGE_ASPECT_RATIO_ERROR_MARGIN
:
error
=
_
(
'This image file must have an aspect ratio of {video_image_aspect_ratio_text}.'
)
.
format
(
video_image_aspect_ratio_text
=
settings
.
VIDEO_IMAGE_ASPECT_RATIO_TEXT
)
else
:
try
:
image_file
.
name
.
encode
(
'ascii'
)
...
...
cms/static/js/views/previous_video_upload.js
View file @
7bf717f7
...
...
@@ -41,7 +41,9 @@ define(
},
removeVideo
:
function
(
event
)
{
var
videoView
=
this
;
var
$thumbnailEl
,
videoView
=
this
,
videoId
=
videoView
.
model
.
get
(
'edx_video_id'
);
event
.
preventDefault
();
...
...
@@ -58,6 +60,11 @@ define(
type
:
'DELETE'
}).
done
(
function
()
{
videoView
.
remove
();
// TODO: Remove this when cleaning up - EDUCATOR-562
$thumbnailEl
=
$
(
'.thumbnail-error-wrapper[data-video-id="'
+
videoId
+
'"]'
);
if
(
$thumbnailEl
.
length
)
{
$thumbnailEl
.
remove
();
}
});
}
);
...
...
lms/envs/aws.py
View file @
7bf717f7
...
...
@@ -796,6 +796,9 @@ XBLOCK_SETTINGS = ENV_TOKENS.get('XBLOCK_SETTINGS', {})
XBLOCK_SETTINGS
.
setdefault
(
"VideoDescriptor"
,
{})[
"licensing_enabled"
]
=
FEATURES
.
get
(
"LICENSING"
,
False
)
XBLOCK_SETTINGS
.
setdefault
(
"VideoModule"
,
{})[
'YOUTUBE_API_KEY'
]
=
AUTH_TOKENS
.
get
(
'YOUTUBE_API_KEY'
,
YOUTUBE_API_KEY
)
##### VIDEO IMAGE STORAGE #####
VIDEO_IMAGE_SETTINGS
=
ENV_TOKENS
.
get
(
'VIDEO_IMAGE_SETTINGS'
,
VIDEO_IMAGE_SETTINGS
)
##### CDN EXPERIMENT/MONITORING FLAGS #####
CDN_VIDEO_URLS
=
ENV_TOKENS
.
get
(
'CDN_VIDEO_URLS'
,
CDN_VIDEO_URLS
)
ONLOAD_BEACON_SAMPLE_RATE
=
ENV_TOKENS
.
get
(
'ONLOAD_BEACON_SAMPLE_RATE'
,
ONLOAD_BEACON_SAMPLE_RATE
)
...
...
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