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"> <div className="embed-responsive embed-responsive-16by9">
<video controls> <video controls>
<source src={this.props.url} type="video/mp4"/> <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 ( return (
<track <track
key={index} key={index}
kind="subtitles" kind="subtitles"
label={el.language} label={el.get('language')}
src={el.vvt_file} src={el.get('vvt_file')}
srcLang={el.language} srcLang={el.get('language')}
/> />
); );
})} })}

View File

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

View File

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