Revamping radio notifications; Radio current track

This commit is contained in:
James Barnsley
2018-04-01 21:26:42 +12:00
parent 407a2d3a10
commit fcbfc64ec6
27 changed files with 346 additions and 237 deletions

View File

@ -42,19 +42,9 @@ class Playlist extends React.Component{
}
}
handleContextMenu(e){
var data = {
e: e,
context: (this.props.playlist.can_edit ? 'editable-playlist' : 'playlist'),
items: [this.props.playlist],
uris: [this.props.params.uri]
}
this.props.uiActions.showContextMenu(data)
}
loadPlaylist(props = this.props){
if (props.playlist && props.playlist.tracks && (props.playlist.tracks_total == 0 || props.playlist.tracks.length > 0)){
if (props.playlist && props.playlist.is_completely_loaded){
console.info('Loading playlist from index')
} else {
@ -85,6 +75,16 @@ class Playlist extends React.Component{
);
}
handleContextMenu(e){
var data = {
e: e,
context: (this.props.playlist.can_edit ? 'editable-playlist' : 'playlist'),
items: [this.props.playlist],
uris: [this.props.params.uri]
}
this.props.uiActions.showContextMenu(data)
}
play(){
this.props.mopidyActions.playPlaylist(this.props.playlist.uri)
}

View File

@ -105,7 +105,10 @@ class Queue extends React.Component{
track = Object.assign(
{},
this.props.tracks[track.uri],
track
track,
{
playing: (this.props.current_track && this.props.current_track.tlid == track.tlid)
}
);
}
@ -114,10 +117,7 @@ class Queue extends React.Component{
track = Object.assign(
{},
track,
this.props.queue_metadata["tlid_"+track.tlid],
{
playing: (this.props.current_track && this.props.current_track.tlid == track.tlid)
}
this.props.queue_metadata["tlid_"+track.tlid]
);
}

View File

@ -44,7 +44,7 @@ class Search extends React.Component{
this.props.mopidyActions.getSearchResults(context, term)
}
if (this.props.spotify_connected && this.props.search_uri_schemes && this.props.search_uri_schemes.includes('spotify:')){
if (this.props.search_uri_schemes && this.props.search_uri_schemes.includes('spotify:')){
this.props.spotifyActions.getSearchResults(context, term)
}
}
@ -67,16 +67,8 @@ class Search extends React.Component{
var term = null;
}
if (term && !this.props.mopidy_connected && newProps.mopidy_connected){
this.props.mopidyActions.getSearchResults(context, term);
}
if (term && !this.props.spotify_connected && newProps.spotify_connected && newProps.search_uri_schemes.includes('spotify:')){
this.props.spotifyActions.getSearchResults(context, term);
}
// Search changed
if (term && context && term !== old_term){
if (term && context && (term !== old_term || context !== old_context)){
this.props.mopidyActions.clearSearchResults();
this.props.spotifyActions.clearSearchResults();
@ -375,7 +367,6 @@ class Search extends React.Component{
const mapStateToProps = (state, ownProps) => {
return {
mopidy_connected: state.mopidy.connected,
spotify_connected: state.spotify.connected,
albums: (state.core.albums ? state.core.albums : []),
artists: (state.core.artists ? state.core.artists : []),
playlists: (state.core.playlists ? state.core.playlists : []),

View File

@ -15,7 +15,9 @@ class DiscoverCategories extends React.Component{
}
componentDidMount(){
this.props.spotifyActions.getCategories();
if (!this.props.categories){
this.props.spotifyActions.getCategories();
}
}
render(){

View File

@ -16,7 +16,7 @@ class DiscoverCategory extends React.Component{
}
componentDidMount(){
this.loadCategory()
this.loadCategory();
}
componentWillReceiveProps(nextProps){
@ -26,7 +26,9 @@ class DiscoverCategory extends React.Component{
}
loadCategory(){
if (!this.props.category || !this.props.category.playlists_uris) this.props.spotifyActions.getCategory(this.props.params.id );
if (!this.props.category || !this.props.category.playlists_uris){
this.props.spotifyActions.getCategory(this.props.params.id);
}
}
loadMore(){

View File

@ -21,7 +21,9 @@ class DiscoverFeatured extends React.Component{
}
componentDidMount(){
this.props.spotifyActions.getFeaturedPlaylists();
if (!this.props.featured_playlists){
this.props.spotifyActions.getFeaturedPlaylists();
}
}
playPlaylist(e,playlist){

View File

@ -23,7 +23,9 @@ class DiscoverNewReleases extends React.Component{
}
componentDidMount(){
if (!this.props.new_releases) this.props.spotifyActions.getNewReleases();
if (!this.props.new_releases){
this.props.spotifyActions.getNewReleases();
}
}
loadMore(){

View File

@ -275,7 +275,6 @@ 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,
mopidy_library_albums: state.mopidy.library_albums,

View File

@ -242,7 +242,6 @@ class LibraryArtists extends React.Component{
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),

View File

@ -264,7 +264,6 @@ const mapStateToProps = (state, ownProps) => {
return {
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),