Merging from develop

This commit is contained in:
James Barnsley
2018-02-06 20:00:19 +13:00
12 changed files with 506 additions and 411 deletions

View File

@ -13,6 +13,7 @@ import Thumbnail from './Thumbnail'
import Icon from './Icon'
import * as uiActions from '../services/ui/actions'
import * as coreActions from '../services/core/actions'
import * as mopidyActions from '../services/mopidy/actions'
class PlaybackControls extends React.Component{
@ -57,6 +58,18 @@ class PlaybackControls extends React.Component{
return button;
}
renderStreamingButton(){
var button = null;
if (this.props.http_streaming_enabled){
if (this.props.http_streaming_active){
button = <a className="control active has-tooltip" onClick={() => this.props.coreActions.set({http_streaming_active: false})}><FontAwesome name="rss" /><span className="tooltip">HTTP Streaming</span></a>
} else {
button = <a className="control has-tooltip" onClick={() => this.props.coreActions.set({http_streaming_active: true})}><FontAwesome name="rss" /><span className="tooltip">HTTP Streaming</span></a>;
}
}
return button;
}
handleThumbnailClick(e){
e.preventDefault();
this.props.uiActions.openModal('kiosk_mode');
@ -71,7 +84,7 @@ class PlaybackControls extends React.Component{
return (
<div className={(this.state.expanded ? "expanded playback-controls" : "playback-controls")}>
{this.props.http_streaming_enabled && this.props.play_state == 'playing' ? <audio id="http-streamer" autoPlay preload="none">
{this.props.http_streaming_enabled && this.props.http_streaming_active && this.props.play_state == 'playing' ? <audio id="http-streamer" autoPlay preload="none">
<source src={this.props.http_streaming_url} type={"audio/"+this.props.http_streaming_encoding} />
</audio> : null}
@ -101,6 +114,7 @@ class PlaybackControls extends React.Component{
</section>
<section className="settings">
{this.renderStreamingButton()}
{this.renderConsumeButton()}
{this.renderRandomButton()}
{this.renderRepeatButton()}
@ -139,6 +153,7 @@ class PlaybackControls extends React.Component{
const mapStateToProps = (state, ownProps) => {
return {
http_streaming_active: state.core.http_streaming_active,
http_streaming_enabled: state.core.http_streaming_enabled,
http_streaming_encoding: state.core.http_streaming_encoding,
http_streaming_url: state.core.http_streaming_url,
@ -155,6 +170,7 @@ const mapStateToProps = (state, ownProps) => {
const mapDispatchToProps = (dispatch) => {
return {
coreActions: bindActionCreators(coreActions, dispatch),
uiActions: bindActionCreators(uiActions, dispatch),
mopidyActions: bindActionCreators(mopidyActions, dispatch)
}

View File

@ -56,7 +56,7 @@ class LibraryAlbums extends React.Component{
}
}
if (newProps.spotify_connected && (newProps.source == 'all' || newProps.source == 'spotify')){
if (newProps.spotify_connected && newProps.mopidy_uri_schemes.includes('spotify:') && (newProps.source == 'all' || newProps.source == 'spotify')){
// We've just connected
if (!this.props.spotify_connected){
@ -207,12 +207,15 @@ class LibraryAlbums extends React.Component{
{
value: 'local',
label: 'Local'
},
{
}
];
if (this.props.mopidy_uri_schemes.includes('spotify:')){
source_options.push({
value: 'spotify',
label: 'Spotify'
}
]
});
}
var view_options = [
{
@ -276,6 +279,7 @@ class LibraryAlbums extends React.Component{
const mapStateToProps = (state, ownProps) => {
return {
mopidy_connected: state.mopidy.connected,
mopidy_uri_schemes: state.mopidy.uri_schemes,
spotify_connected: state.spotify.connected,
load_queue: state.ui.load_queue,
albums: state.core.albums,

View File

@ -33,7 +33,7 @@ class LibraryArtists extends React.Component{
this.props.mopidyActions.getLibraryArtists()
}
if (this.props.spotify_library_artists_status != 'finished' && this.props.spotify_connected && (this.props.source == 'all' || this.props.source == 'spotify')){
if (this.props.mopidy_uri_schemes.includes('spotify:') && this.props.spotify_library_artists_status != 'finished' && this.props.spotify_connected && (this.props.source == 'all' || this.props.source == 'spotify')){
this.props.spotifyActions.getLibraryArtists()
}
}
@ -52,7 +52,7 @@ class LibraryArtists extends React.Component{
}
}
if (newProps.spotify_connected && (newProps.source == 'all' || newProps.source == 'spotify')){
if (newProps.mopidy_uri_schemes.includes('spotify:') && newProps.spotify_connected && (newProps.source == 'all' || newProps.source == 'spotify')){
// We've just connected
if (!this.props.spotify_connected){
@ -178,12 +178,15 @@ class LibraryArtists extends React.Component{
{
value: 'local',
label: 'Local'
},
{
}
];
if (this.props.mopidy_uri_schemes.includes('spotify:')){
source_options.push({
value: 'spotify',
label: 'Spotify'
}
]
});
}
var view_options = [
{
@ -194,7 +197,7 @@ class LibraryArtists extends React.Component{
label: 'List',
value: 'list'
}
]
];
var sort_options = [
{
@ -209,7 +212,7 @@ class LibraryArtists extends React.Component{
label: 'Popularity',
value: 'popularity'
}
]
];
var options = (
<span>
@ -240,6 +243,7 @@ const mapStateToProps = (state, ownProps) => {
return {
mopidy_connected: state.mopidy.connected,
spotify_connected: state.spotify.connected,
mopidy_uri_schemes: state.mopidy.uri_schemes,
mopidy_library_artists: state.mopidy.library_artists,
mopidy_library_artists_status: (state.ui.processes.MOPIDY_LIBRARY_ARTISTS_PROCESSOR !== undefined ? state.ui.processes.MOPIDY_LIBRARY_ARTISTS_PROCESSOR.status : null),
spotify_library_artists: state.spotify.library_artists,

View File

@ -35,7 +35,7 @@ class LibraryPlaylists extends React.Component{
this.props.mopidyActions.getLibraryPlaylists()
}
if (this.props.spotify_library_playlists_status !== 'finished' && this.props.spotify_connected && (this.props.source == 'all' || this.props.source == 'spotify')){
if (this.props.mopidy_uri_schemes.includes('spotify:') && this.props.spotify_library_playlists_status !== 'finished' && this.props.spotify_connected && (this.props.source == 'all' || this.props.source == 'spotify')){
this.props.spotifyActions.getLibraryPlaylists()
}
}
@ -54,7 +54,7 @@ class LibraryPlaylists extends React.Component{
}
}
if (newProps.spotify_connected && (newProps.source == 'all' || newProps.source == 'spotify')){
if (newProps.mopidy_uri_schemes.includes('spotify:') && newProps.spotify_connected && (newProps.source == 'all' || newProps.source == 'spotify')){
// We've just connected
if (!this.props.spotify_connected){
@ -192,12 +192,15 @@ class LibraryPlaylists extends React.Component{
{
value: 'local',
label: 'Local'
},
{
}
];
if (this.props.mopidy_uri_schemes.includes('spotify:')){
source_options.push({
value: 'spotify',
label: 'Spotify'
}
]
});
}
var view_options = [
{
@ -208,7 +211,7 @@ class LibraryPlaylists extends React.Component{
value: 'list',
label: 'List'
}
]
];
var sort_options = [
{
@ -231,7 +234,7 @@ class LibraryPlaylists extends React.Component{
value: 'source',
label: 'Source'
}
]
];
var options = (
<span>
@ -267,6 +270,7 @@ const mapStateToProps = (state, ownProps) => {
slim_mode: state.ui.slim_mode,
mopidy_connected: state.mopidy.connected,
spotify_connected: state.spotify.connected,
mopidy_uri_schemes: state.mopidy.uri_schemes,
mopidy_library_playlists: state.mopidy.library_playlists,
mopidy_library_playlists_status: (state.ui.processes.MOPIDY_LIBRARY_PLAYLISTS_PROCESSOR !== undefined ? state.ui.processes.MOPIDY_LIBRARY_PLAYLISTS_PROCESSOR.status : null),
spotify_library_playlists: state.spotify.library_playlists,