Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge Juniper compatibility, Py3, and Chrome browser fixes from Raccoon Gang, Edly, and UCSD forks #35

Closed
wants to merge 66 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
13ff123
Add ability to upload image handouts (#254)
wowkalucky Jul 13, 2017
88e1c78
Add Wistia captions settings screenshot (#263)
DenisKolesnik Jul 13, 2017
01aefdb
Improve js unit test coverage (#247)
wowkalucky Jul 14, 2017
8b7b8aa
Add doc how to disable built-in Wistia captions (#264)
DenisKolesnik Jul 14, 2017
eab48d3
Issue 257: Configurable default player ID (#262)
wowkalucky Jul 14, 2017
f8f63e8
Wistia-234: Fix the error while trying to upload default transcripts.…
wowkalucky Jul 14, 2017
f9486e1
284 bug - missing html form elements for token field (#265)
wowkalucky Jul 14, 2017
4917ecc
Fix Brightcove backend to track player's state (#271)
wowkalucky Jul 20, 2017
89c17b7
Add transcripts to list of allowed handouts (#267)
wowkalucky Jul 20, 2017
635985d
Hide explicit 3PlayMedia switch (#268)
wowkalucky Jul 21, 2017
2dc5afc
Quick fix: hide transcript downloading button from student view (#270)
wowkalucky Jul 21, 2017
6278d42
Actualize wording of default transcripts accordion section (#272)
wowkalucky Jul 28, 2017
301ab86
Fix default&manual transcripts accordion section (#269)
wowkalucky Jul 28, 2017
5d7b2a6
Simplify BrightcovePlayer.dispatch() (#151)
z4y4ts Jul 31, 2017
4e2c2dc
Summary to v0.9.1 (#273)
wowkalucky Jul 31, 2017
008263e
Refactor xBlock's fields filling; revert XBLOCK_SETTINGS structure (#…
wowkalucky Aug 3, 2017
2894dba
Prepare CHANGELOG.md for a new release
wowkalucky Aug 3, 2017
fd15bf7
Bump __version__ to 0.9.1
wowkalucky Aug 3, 2017
856d81d
Update documentation
wowkalucky Aug 3, 2017
e33ea17
Update Brightcove account_id field validation (#277)
wowkalucky Aug 9, 2017
672b59e
Merge branch 'master' into dev
wowkalucky Jan 12, 2018
7db0611
fixed speed menu position
otecMuxah Jan 17, 2018
c5e9f95
Suppress custom menus hiding
wowkalucky Jan 18, 2018
b8a2153
Remove non functional caret control
wowkalucky Jan 18, 2018
d4cfd0d
Merge branch 'otecMuxah/issue_287' into dev
wowkalucky Jan 18, 2018
d615a31
Fix code quality
wowkalucky Jan 18, 2018
3376bfc
Prepare CHANGELOG.md for a new release
wowkalucky Jan 18, 2018
65433a8
Bump __version__ to 0.9.4
wowkalucky Jan 18, 2018
c4543f3
Update xblock dependecies due to Ginkgo release
wowkalucky Jan 23, 2018
fb2cdc4
Make transcripts indexable for LMS search (#294)
wowkalucky Jan 23, 2018
f793f89
Fixed `fullscreen` button overlapping (#295)
wowkalucky Jan 23, 2018
bf5688b
Fix for issue #292: languages selected differ between transcript and …
wowkalucky Jan 24, 2018
04c46a6
Prepare CHANGELOG.md for a new release
wowkalucky Jan 24, 2018
f4449bf
Bump __version__ to 0.10.0
wowkalucky Jan 24, 2018
d069a5f
Merge branch 'master' into dev
wowkalucky Jan 24, 2018
26d7201
Fix dependency link format
wowkalucky Jan 29, 2018
713ab8f
Catch API connection exception
wowkalucky Jan 30, 2018
8e43c13
Fix muted player's volume state
wowkalucky Jan 30, 2018
37499f3
Fix tests and quality
wowkalucky Jan 30, 2018
5c0c9fc
Improve accordion transcripts switch UX in studio view (#300)
wowkalucky Jan 30, 2018
e7b37e1
Add multiple transcripts downloading (#301)
wowkalucky Jan 30, 2018
af7a00d
Update `Download transcripts` dropdown button layout
wowkalucky Jan 31, 2018
ff1cf3d
Fix Safari empty transcripts issue
wowkalucky Feb 5, 2018
13ba99c
Add more debug loggers
wowkalucky Feb 8, 2018
fa4657c
Fix empty transcripts generator case
wowkalucky Feb 8, 2018
3cf98d2
Brightcove retranscode issue (#302)
wowkalucky Feb 9, 2018
8d0d3a1
Hide back transcripts download url
Feb 13, 2018
a60de76
Fix test and typo
wowkalucky Feb 13, 2018
f17276f
Refactor remote transcripts download url
wowkalucky Feb 13, 2018
8f4778f
Revert test fix
wowkalucky Feb 13, 2018
93d4140
Prepare CHANGELOG.md for a new release
wowkalucky Feb 13, 2018
d114d29
Bump __version__ to 0.10.1
wowkalucky Feb 13, 2018
35e30ce
Merge branch 'master' into dev
wowkalucky Feb 13, 2018
555f7ba
BUG: Safari captions always on (#304)
wowkalucky Feb 14, 2018
03ec58b
Fixes for hawthorn
maximst Nov 22, 2018
f535876
In Python 3, string.format() on a byte-encoded value renders as b'<va…
matthewf-ucsd May 7, 2021
5e3afc6
iterable.next() on an iterable was depricated and removed, use next(i…
matthewf-ucsd May 7, 2021
519457d
Remove unnecessary calls unicode() and its python-3 equivalent string…
matthewf-ucsd May 7, 2021
5f206c6
added dependency link for xblock-utils
ahmadshafique May 26, 2021
e8e894e
Initialize new engine instead of using default one while rendering te…
GlugovGrGlib Sep 18, 2020
1aab7aa
Added mute before playing video for chrome to avoid autoplay policy r…
Apr 19, 2021
7e05101
make some strings b'' so course indexing works
Apr 9, 2021
91add98
Update xblock-utils requirement for Juniper compat
bryanlandia Jul 30, 2021
fd98bc9
python3 compatibility fixes
rehan99000 Feb 9, 2021
966b036
Py3 compat for HTMLParser import
bryanlandia Jul 30, 2021
86b2516
Use py3 pycaptions version, resolve version issue with BeautifulSoup4…
bryanlandia Jul 30, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,20 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

## [0.10.1] - 2018-02-13

## Added

- Multiple transcripts downloading;
- Error handling during Brightcove video re-transcode job submitting;

## Fixed

- Safari `empty transcripts` issue;
- Studio editor improvements:
- transcripts accordion switch;
- re-transcode button styling;

## [0.10.0] - 2018-01-24

## Added
Expand Down Expand Up @@ -282,4 +296,5 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
[0.9.3]: https://github.com/raccoongang/xblock-video/compare/v0.9.2...v0.9.3
[0.9.4]: https://github.com/raccoongang/xblock-video/compare/v0.9.3...v0.9.4
[0.10.0]: https://github.com/raccoongang/xblock-video/compare/v0.9.4...v0.10.0
[Unreleased]: https://github.com/raccoongang/xblock-video/compare/v0.10.0...HEAD
[0.10.1]: https://github.com/raccoongang/xblock-video/compare/v0.10.0...v0.10.1
[Unreleased]: https://github.com/raccoongang/xblock-video/compare/v0.10.1...HEAD
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ dev-install:
pip install --process-dependency-links -e .

deps-test: ## Install dependencies required to run tests
pip install -Ur requirements.txt
pip install -Ur test_requirements.txt
pip install -r $(VIRTUAL_ENV)/src/xblock-sdk/requirements/base.txt

Expand Down
34 changes: 17 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pycaption>=1.0.6,<2
requests>=2.9.1,<3.0.0
babelfish>=0.5.5,<0.6.0
XBlock>=0.4.10,<2.0.0
xblock-utils>2,<=2.1.1

9 changes: 3 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,13 @@ def package_data(pkg, roots):
'video_xblock',
],
dependency_links=[
# At the moment of writing PyPI hosts outdated version of xblock-utils, hence git
# Replace dependency links with numbered versions when it's released on PyPI
'git+https://github.com/edx/[email protected]#egg=xblock-utils-1.0.5',
],
install_requires=[
'XBlock>=0.4.10,<2.0.0',
'xblock-utils>=1.0.2,<=1.0.5',
'pycaption>=0.7.1,<1.0', # The latest Python 2.7 compatible version
'pycaption>=1.0.6,<2', # Py3, Juniper compat BeautifulSoup4>=4.9.1
'requests>=2.9.1,<3.0.0',
'babelfish>=0.5.5,<0.6.0',
'XBlock>=0.4.10,<2.0.0',
'xblock-utils>2,<=2.1.1'
],
entry_points={
'xblock.v1': [
Expand Down
2 changes: 1 addition & 1 deletion video_xblock/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Video xblock module.
"""

__version__ = '0.10.0'
__version__ = '0.10.1'

# pylint: disable=wildcard-import
from .video_xblock import * # nopep8
4 changes: 2 additions & 2 deletions video_xblock/backends/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ def clean_default_transcripts(default_transcripts):
default_transcripts.sort(key=get_values)
distinct_transcripts = []
for _key, group in itertools.groupby(default_transcripts, get_values):
distinct_transcripts.append(group.next())
distinct_transcripts.append(next(group))
return distinct_transcripts

def filter_default_transcripts(self, default_transcripts, transcripts):
Expand All @@ -423,6 +423,6 @@ def filter_default_transcripts(self, default_transcripts, transcripts):
enabled_languages_codes = [t[u'lang'] for t in transcripts]
default_transcripts = [
dt for dt in default_transcripts
if (unicode(dt.get('lang')) not in enabled_languages_codes) and default_transcripts
if (dt.get('lang') not in enabled_languages_codes) and default_transcripts
]
return default_transcripts
47 changes: 36 additions & 11 deletions video_xblock/backends/brightcove.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import base64
from datetime import datetime
import json
import httplib
import http.client as httplib
import logging
import re

Expand Down Expand Up @@ -105,10 +105,14 @@ def _refresh_access_token(self):
"Content-Type": "application/x-www-form-urlencoded",
"Authorization": "Basic " + auth_string
}
resp = requests.post(url, headers=headers, data=params)
if resp.status_code == httplib.OK:
result = resp.json()
return result['access_token']
try:
resp = requests.post(url, headers=headers, data=params)
if resp.status_code == httplib.OK:
result = resp.json()
return result['access_token']
except IOError:
log.exception(_("Connection issue. Couldn't refresh API access token."))
return None

def get(self, url, headers=None, can_retry=True):
"""
Expand Down Expand Up @@ -153,13 +157,21 @@ def post(self, url, payload, headers=None, can_retry=True):
headers_.update(headers)

resp = requests.post(url, data=payload, headers=headers_)
log.debug("BC response status: {}".format(resp.status_code))
if resp.status_code in (httplib.OK, httplib.CREATED):
return resp.json()
elif resp.status_code == httplib.UNAUTHORIZED and can_retry:
self.access_token = self._refresh_access_token()
return self.post(url, payload, headers, can_retry=False)
else:
raise BrightcoveApiClientError

try:
resp_dict = resp.json()[0]
log.warn("API error code: %s - %s", resp_dict.get(u'error_code'), resp_dict.get(u'message'))
except (ValueError, IndexError):
message = _("Can't parse unexpected response during POST request to Brightcove API!")
log.exception(message)
resp_dict = {"message": message}
return resp_dict


class BrightcoveHlsMixin(object):
Expand All @@ -169,6 +181,8 @@ class BrightcoveHlsMixin(object):
These features are:
1. Video playback autoquality. i.e. adjusting video bitrate depending on client's bandwidth.
2. Video content encryption using short-living keys.

NOTE(wowkalucky): Dynamic Ingest is the legacy ingest system. New Video Cloud accounts use Dynamic Delivery.
"""

DI_PROFILES = {
Expand Down Expand Up @@ -240,6 +254,7 @@ def submit_retranscode_job(self, account_id, video_id, profile_type):
- default - re-transcode using default DI profile;
- autoquality - re-transcode using HLS only profile;
- encryption - re-transcode using HLS with encryption profile;
ref: https://support.brightcove.com/dynamic-ingest-api
"""
url = 'https://ingest.api.brightcove.com/v1/accounts/{account_id}/videos/{video_id}/ingest-requests'.format(
account_id=account_id, video_id=video_id
Expand All @@ -255,9 +270,18 @@ def submit_retranscode_job(self, account_id, video_id, profile_type):
if profile_type != 'default':
retranscode_params['profile'] = self.DI_PROFILES[profile_type]['name']
res = self.api_client.post(url, json.dumps(retranscode_params))
self.xblock.metadata['retranscode-status'] = (
'ReTranscode request submitted {:%Y-%m-%d %H:%M} UTC using profile "{}". Job id: {}'.format(
datetime.utcnow(), retranscode_params.get('profile', 'default'), res['id']))
if u'error_code' in res:
self.xblock.metadata['retranscode-status'] = (
'ReTranscode request encountered error {:%Y-%m-%d %H:%M} UTC using profile "{}".\nMessage: {}'.format(
datetime.utcnow(), retranscode_params.get('profile', 'default'), res['message']
)
)
else:
self.xblock.metadata['retranscode-status'] = (
'ReTranscode request submitted {:%Y-%m-%d %H:%M} UTC using profile "{}". Job id: {}'.format(
datetime.utcnow(), retranscode_params.get('profile', 'default'), res['id']
)
)
return res

def get_video_renditions(self, account_id, video_id):
Expand Down Expand Up @@ -388,6 +412,7 @@ def get_frag(self, **context):
Because of this it doesn't use `super.get_frag()`.
"""
context['player_state'] = json.dumps(context['player_state'])
log.debug('CONTEXT: player_state: %s', context.get('player_state'))

frag = Fragment(
self.render_template('brightcove.html', **context)
Expand Down Expand Up @@ -433,7 +458,7 @@ def get_player_html(self, **context):
'static/js/videojs/videojs-transcript.js'
]
context['vjs_plugins'] = map(self.resource_string, vjs_plugins)
log.debug("[get_player_html] initialized scripts: %s", vjs_plugins)
log.debug("Initialized scripts: %s", vjs_plugins)
return super(BrightcovePlayer, self).get_player_html(**context)

def dispatch(self, _request, suffix):
Expand Down
6 changes: 3 additions & 3 deletions video_xblock/backends/vimeo.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Vimeo Video player plugin.
"""

import httplib
import http.client as httplib
import json
import logging
import re
Expand Down Expand Up @@ -51,7 +51,7 @@ def get(self, url, headers=None, can_retry=False):
Response in python native data format.
"""
headers_ = {
'Authorization': 'Bearer {}'.format(self.access_token.encode(encoding='utf-8')),
'Authorization': 'Bearer {}'.format(self.access_token),
'Accept': 'application/json'
}
if headers is not None:
Expand Down Expand Up @@ -277,4 +277,4 @@ def download_default_transcript(self, url, language_code=None): # pylint: disab
data = requests.get(url)
text = data.content.decode('utf8')
cleaned_captions_text = remove_escaping(text)
return unicode(cleaned_captions_text)
return cleaned_captions_text
4 changes: 2 additions & 2 deletions video_xblock/backends/wistia.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
Wistia Video player plugin.
"""

import HTMLParser
from html.parser import HTMLParser
import json
import httplib
import http.client as httplib
import logging
import re

Expand Down
4 changes: 2 additions & 2 deletions video_xblock/backends/youtube.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
YouTube Video player plugin.
"""

import HTMLParser
from html.parser import HTMLParser
import json
import httplib
import http.client as httplib
import re
import textwrap
import urllib
Expand Down
3 changes: 2 additions & 1 deletion video_xblock/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"""

import datetime
from six import string_types
import time

from xblock.fields import JSONField
Expand Down Expand Up @@ -73,7 +74,7 @@ def from_json(self, value):
if isinstance(value, float):
return datetime.timedelta(seconds=value)

if isinstance(value, basestring):
if isinstance(value, string_types):
return self.isotime_to_timedelta(value)

msg = "RelativeTime Field {0} has bad value '{1!r}'".format(self.name, value)
Expand Down
Loading