Use the immutable subtitles in the player

This commit is contained in:
Grégoire Delattre 2017-06-02 15:02:47 +02:00
parent 06517be48b
commit 91aea923d2
3 changed files with 9 additions and 14 deletions

View File

@ -76,14 +76,14 @@ class Player extends React.Component {
<div className="embed-responsive embed-responsive-16by9">
<video controls>
<source src={this.props.url} type="video/mp4"/>
{this.props.subtitles !== undefined && subtitles.toKeyedSeq().map(function(el, index) {
{this.props.subtitles !== undefined && this.props.subtitles.toIndexedSeq().map(function(el, index) {
return (
<track
key={index}
kind="subtitles"
label={el.language}
src={el.vvt_file}
srcLang={el.language}
label={el.get('language')}
src={el.get('vvt_file')}
srcLang={el.get('language')}
/>
);
})}

View File

@ -16,7 +16,8 @@ export default function ListDetails(props) {
const trackedSeason = props.data.get('tracked_season');
const trackedEpisode = props.data.get('tracked_episode');
if (trackedEpisode !== null && trackedSeason !== null) {
if (trackedEpisode !== null && trackedSeason !== null
&& trackedEpisode !== undefined && trackedSeason !== undefined) {
if ((trackedSeason === 0) && (trackedEpisode === 0)) {
wishlistStr = "Whole show tracked";
} else {

View File

@ -1,7 +1,7 @@
import React from 'react'
import { connect } from 'react-redux'
import { bindActionCreators } from 'redux'
import { toJS } from 'immutable'
import { List } from 'immutable'
import { addTorrent } from '../../actions/torrents'
import { refreshSubtitles } from '../../actions/subtitles'
import { addShowToWishlist, deleteShowFromWishlist, getEpisodeDetails, updateShowDetails } from '../../actions/shows'
@ -177,12 +177,6 @@ class Season extends React.Component {
}
function Episode(props) {
// TODO: remove this when everything uses immutable
let subtitles;
if (props.data.has('subtitles') && props.data.get('subtitles')) {
subtitles = props.data.get('subtitles').toJS();
}
return (
<tr>
<th scope="row" className="col-xs-2">
@ -198,7 +192,7 @@ function Episode(props) {
<span className="pull-right episode-buttons">
<SubtitlesButton
url={props.data.get('polochon_url')}
subtitles={subtitles}
subtitles={props.data.get('subtitles')}
refreshSubtitles={props.refreshSubtitles}
resourceID={props.data.get('show_imdb_id')}
season={props.data.get('season')}
@ -218,7 +212,7 @@ function Episode(props) {
})}
<DownloadButton
url={props.data.get('polochon_url')}
subtitles={subtitles}
subtitles={props.data.get('subtitles')}
xs
/>
<GetDetailsButton