Snapcast fully operational

This commit is contained in:
James Barnsley
2019-10-30 06:42:11 +13:00
parent 88a5efaa05
commit 658b828c41
14 changed files with 6440 additions and 10693 deletions

View File

@ -13,6 +13,7 @@ import * as uiActions from '../services/ui/actions';
import * as pusherActions from '../services/pusher/actions';
import * as mopidyActions from '../services/mopidy/actions';
import * as spotifyActions from '../services/spotify/actions';
import * as snapcastActions from '../services/snapcast/actions';
class Debug extends React.Component {
constructor(props) {
@ -21,6 +22,7 @@ class Debug extends React.Component {
mopidy_call: 'playlists.asList',
mopidy_data: '{}',
pusher_data: '{"method":"get_config"}',
snapcast_data: '{"method":"Server.GetStatus"}',
access_token: this.props.access_token,
toggling_test_mode: false,
};
@ -40,6 +42,11 @@ class Debug extends React.Component {
this.props.pusherActions.debug(JSON.parse(this.state.pusher_data));
}
callSnapcast(e) {
e.preventDefault();
this.props.snapcastActions.debug(JSON.parse(this.state.snapcast_data));
}
toggleTestMode(e) {
this.setState({ toggling_test_mode: true });
this.props.uiActions.set({ test_mode: !this.props.test_mode });
@ -216,6 +223,25 @@ Back
</div>
</form>
<h4 className="underline">Snapcast</h4>
<form onSubmit={(e) => this.callSnapcast(e)}>
<label className="field">
<div className="name">Data</div>
<div className="input">
<textarea
onChange={(e) => this.setState({ snapcast_data: e.target.value })}
value={this.state.snapcast_data}
/>
</div>
</label>
<div className="field">
<div className="name" />
<div className="input">
<button type="submit" className="button button--default">Send</button>
</div>
</div>
</form>
<h4 className="underline">Response</h4>
<pre>
{ this.props.debug_response ? JSON.stringify(this.props.debug_response, null, 2) : null }
@ -244,6 +270,7 @@ const mapDispatchToProps = (dispatch) => ({
pusherActions: bindActionCreators(pusherActions, dispatch),
mopidyActions: bindActionCreators(mopidyActions, dispatch),
spotifyActions: bindActionCreators(spotifyActions, dispatch),
snapcastActions: bindActionCreators(snapcastActions, dispatch),
});
export default connect(mapStateToProps, mapDispatchToProps)(Debug);