Skip to content

Commit

Permalink
Release v0.9.0 (#256)
Browse files Browse the repository at this point in the history
See CHANGELOG.md for release details
  • Loading branch information
z4y4ts authored Jul 11, 2017
2 parents 8a90232 + 85db242 commit 90c90f2
Show file tree
Hide file tree
Showing 25 changed files with 776 additions and 329 deletions.
18 changes: 17 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,21 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

## [0.9.0] - 2017-07-11

### Added

- Direct transcripts streaming from 3PlayMedia service.
Now Video Xblock will always use up-to-date transcripts from 3PM.

### Changed

- UI: Transcripts settings section now split into two panels.
To make more apparent how different options are related and which
transcripts are going to be diplayed.
- "Manual & default transcripts"
- "3PlayMedia transcripts"

## [0.8.0] - 2017-06-30

### Added
Expand Down Expand Up @@ -211,4 +226,5 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
[0.7.0]: https://github.com/raccoongang/xblock-video/compare/v0.6.6...v0.7.0
[0.7.1]: https://github.com/raccoongang/xblock-video/compare/v0.7.0...v0.7.1
[0.8.0]: https://github.com/raccoongang/xblock-video/compare/v0.7.1...v0.8.0
[Unreleased]: https://github.com/raccoongang/xblock-video/compare/v0.8.0...HEAD
[0.9.0]: https://github.com/raccoongang/xblock-video/compare/v0.8.0...v0.9.0
[Unreleased]: https://github.com/raccoongang/xblock-video/compare/v0.9.0...HEAD
2 changes: 1 addition & 1 deletion test_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
bok-choy==0.7.1
coverage>=4.3.4,<5.0.0
Django>=1.8.12,<1.9
Django>=1.8.12,<1.9 # pyup: >=1.8,<1.9
ddt>=1.1.1,<2.0.0
edx-lint>=0.5.2,<1.0.0
Mako>=1.0.6,<2.0.0
Expand Down
26 changes: 22 additions & 4 deletions video_xblock/backends/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,10 @@ def editable_fields(self):
Defaults to concatenation of `basic_fields` and `advanced_fields`.
"""
return tuple(itertools.chain(self.basic_fields, self.advanced_fields))
return tuple(itertools.chain(
self.basic_fields, self.advanced_fields, self.trans_fields,
self.three_pm_fields
))

@property
def basic_fields(self):
Expand All @@ -131,11 +134,26 @@ def advanced_fields(self):
Subclasses can extend or redefine list if needed. Defaults to a tuple defined by VideoXBlock.
"""
return [
'start_time', 'end_time', 'handout', 'transcripts',
'threeplaymedia_file_id', 'threeplaymedia_apikey', 'download_transcript_allowed',
'default_transcripts', 'download_video_allowed', 'download_video_url'
'start_time', 'end_time', 'handout', 'download_transcript_allowed',
'download_video_allowed', 'download_video_url',
]

@property
def three_pm_fields(self):
"""
Tuple of VideoXBlock fields to display on `3PlayMedia transcripts` panel.
"""
return [
'threeplaymedia_file_id', 'threeplaymedia_apikey', 'threeplaymedia_streaming'
]

@property
def trans_fields(self):
"""
Tuple of VideoXBlock fields to display on `Manual & default transcripts` panel.
"""
return ['transcripts', 'default_transcripts']

@property
def fields_help(self):
"""
Expand Down
17 changes: 13 additions & 4 deletions video_xblock/backends/brightcove.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,14 @@ def advanced_fields(self):
Brightcove videos require Brightcove Account id.
"""
fields_list = ['player_id'] + super(BrightcovePlayer, self).advanced_fields
return ['player_id'] + super(BrightcovePlayer, self).advanced_fields

@property
def three_pm_fields(self):
"""
Tuple of VideoXBlock fields to display on `3PlayMedia transcripts` panel.
"""
fields_list = super(BrightcovePlayer, self).three_pm_fields
# Add `token` field before `threeplaymedia_file_id`
fields_list.insert(fields_list.index('threeplaymedia_file_id'), 'token')
return fields_list
Expand Down Expand Up @@ -497,13 +504,15 @@ def authenticate_api(self, **kwargs):
error_status_message (str): Error messages for the sake of verbosity.
"""
token, account_id = kwargs.get('token'), kwargs.get('account_id')
client_secret, client_id, error_message = BrightcoveApiClient.create_credentials(token, account_id)
try:
client_secret, client_id, error_message = BrightcoveApiClient.create_credentials(token, account_id)
except BrightcoveApiClientError as bc_exception:
return {}, bc_exception.message

self.api_client.api_key = client_id
self.api_client.api_secret = client_secret
self.xblock.metadata['client_id'] = client_id
self.xblock.metadata['client_secret'] = client_secret
if error_message:
return {}, error_message
auth_data = {
'client_secret': client_secret,
'client_id': client_id,
Expand Down
13 changes: 10 additions & 3 deletions video_xblock/backends/vimeo.py
Original file line number Diff line number Diff line change
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),
'Authorization': 'Bearer {}'.format(self.access_token.encode(encoding='utf-8')),
'Accept': 'application/json'
}
if headers is not None:
Expand Down Expand Up @@ -126,7 +126,14 @@ def advanced_fields(self):
Vimeo videos require Access token to be set.
"""
fields_list = super(VimeoPlayer, self).advanced_fields
return super(VimeoPlayer, self).advanced_fields

@property
def three_pm_fields(self):
"""
Tuple of VideoXBlock fields to display on `3PlayMedia transcripts` panel.
"""
fields_list = super(VimeoPlayer, self).three_pm_fields
# Add `token` field before `threeplaymedia_file_id`
fields_list.insert(fields_list.index('threeplaymedia_file_id'), 'token')
return fields_list
Expand Down Expand Up @@ -218,7 +225,7 @@ def get_default_transcripts(self, **kwargs):
try:
json_data = self.api_client.get(url)
except VimeoApiClientError:
message = _('No timed transcript may be fetched from a video platform.')
message = _('No timed transcript may be fetched from a video platform.<br>')
return default_transcripts, message

if not json_data:
Expand Down
9 changes: 8 additions & 1 deletion video_xblock/backends/wistia.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,14 @@ def advanced_fields(self):
Brightcove videos require Brightcove Account id.
"""
fields_list = super(WistiaPlayer, self).advanced_fields
return super(WistiaPlayer, self).advanced_fields

@property
def three_pm_fields(self):
"""
Tuple of VideoXBlock fields to display on `3PlayMedia transcripts` panel.
"""
fields_list = super(WistiaPlayer, self).three_pm_fields
# Add `token` field before `threeplaymedia_file_id`
fields_list.insert(fields_list.index('threeplaymedia_file_id'), 'token')
return fields_list
Expand Down
18 changes: 16 additions & 2 deletions video_xblock/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,21 @@
Lists of constants that can be used in the video xblock.
"""

from enum import Enum

DEFAULT_LANG = 'en'


class Status(Enum):
"""
Status flags enumeration.
"""

success = 'success'
error = 'error'
warning = 'warning'


class PlayerName(object):
"""
Contains Player names for each backends.
Expand Down Expand Up @@ -288,9 +300,11 @@ def __init__(self, language_id):
:param language_id : int (from API response list of available transcript translations).
"""
if language_id not in self.TPM_LANGUAGES.keys():
try:
language_id = int(language_id)
language_info = self.TPM_LANGUAGES[language_id]
except (ValueError, KeyError):
raise ValueError("Language ID: {} does not exist!".format(language_id))
language_info = self.TPM_LANGUAGES[language_id]
self.language_id = language_id
self.ietf_code = language_info.get("ietf_code")
self.iso_639_1_code = language_info.get("iso_639_1_code")
Expand Down
Loading

0 comments on commit 90c90f2

Please sign in to comment.