Local playlists and uri encoding
This commit is contained in:
@ -696,8 +696,14 @@ const CoreMiddleware = (function(){
|
||||
}
|
||||
}
|
||||
|
||||
// Already have this playlist partially in our index
|
||||
if (playlists_index[playlist.uri]){
|
||||
playlist = Object.assign({}, playlists_index[playlist.uri], playlist);
|
||||
|
||||
// Setup placeholder tracks_uris
|
||||
if (playlist.tracks_uris === undefined){
|
||||
playlist.tracks_uris = [];
|
||||
}
|
||||
}
|
||||
|
||||
// Load our tracks
|
||||
|
||||
@ -1546,7 +1546,7 @@ const MopidyMiddleware = (function(){
|
||||
is_completely_loaded: true,
|
||||
provider: 'mopidy',
|
||||
tracks: (response.tracks ? response.tracks : []),
|
||||
tracks_total: (response.tracks ? response.tracks.length : [])
|
||||
tracks_total: (response.tracks ? response.tracks.length : 0)
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@ -219,7 +219,7 @@ class Playlist extends React.Component{
|
||||
<ul className="details">
|
||||
{!this.props.slim_mode ? <li><Icon type="fontawesome" name={helpers.sourceIcon(playlist.uri)} /></li> : null }
|
||||
<li>
|
||||
{playlist.tracks_total ? playlist.tracks_total : (playlist.tracks ? playlist.tracks.length : '0')} tracks,
|
||||
{playlist.tracks_total ? playlist.tracks_total : '0'} tracks{playlist.tracks_total && playlist.tracks_total > 0 ? ',' : null}
|
||||
<Dater type="total-time" data={playlist.tracks} />
|
||||
</li>
|
||||
{!this.props.slim_mode && playlist.followers !== undefined ? <li>{playlist.followers.toLocaleString()} followers</li> : null }
|
||||
@ -251,7 +251,12 @@ class Playlist extends React.Component{
|
||||
}
|
||||
|
||||
const mapStateToProps = (state, ownProps) => {
|
||||
|
||||
// Decode the URI, and then re-encode all the spaces
|
||||
// This is needed as Mopidy encodes spaces in playlist URIs (but not other characters)
|
||||
var uri = decodeURIComponent(ownProps.match.params.uri);
|
||||
uri = uri.replace(/\s/g, '%20');
|
||||
|
||||
return {
|
||||
uri: uri,
|
||||
allow_reporting: state.ui.allow_reporting,
|
||||
|
||||
@ -204,7 +204,12 @@ class EditPlaylist extends React.Component{
|
||||
}
|
||||
|
||||
const mapStateToProps = (state, ownProps) => {
|
||||
|
||||
// Decode the URI, and then re-encode all the spaces
|
||||
// This is needed as Mopidy encodes spaces in playlist URIs (but not other characters)
|
||||
var uri = decodeURIComponent(ownProps.match.params.uri);
|
||||
uri = uri.replace(/\s/g, '%20');
|
||||
|
||||
return {
|
||||
uri: uri,
|
||||
mopidy_connected: state.mopidy.connected,
|
||||
|
||||
Reference in New Issue
Block a user