This commit is contained in:
James Barnsley
2018-08-15 19:39:03 +12:00
7 changed files with 12597 additions and 12701 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -98,7 +98,11 @@
// Release details
// These are automatically injected to built HTML
<<<<<<< HEAD
var build = "1534307216";
=======
var build = "1534236383";
>>>>>>> 54fb8a0266382e453de2eb9d9f88adee5d3c4f29
var version = "3.23.2";
// Construct the script tag

View File

@ -51,7 +51,8 @@ export default class URILink extends React.Component{
break;
case 'search':
to = global.baseURL+'search/'+uri;
var exploded = uri.split('%3A');
to = global.baseURL+'search/'+exploded[1]+'/'+exploded[2];
break;
default:

View File

@ -65,7 +65,7 @@ ReactDOM.render(
<Route path="settings(/service/:sub_view)" component={Settings} />
<Route path="settings/share-authorization" component={ShareAuthorization} />
<Route path="search(/:query)" component={Search} />
<Route path="search(/:type/:term)" component={Search} />
<Route path="album/:uri" component={Album} />
<Route path="artist/:uri(/:sub_view)" component={Artist} />
<Route path="playlist/create" component={CreatePlaylist} />

View File

@ -865,11 +865,11 @@ const MopidyMiddleware = (function(){
case 'MOPIDY_GET_SEARCH_RESULTS_PROCESSOR':
var last_run = store.getState().ui.processes.MOPIDY_GET_SEARCH_RESULTS_PROCESSOR
var last_run = store.getState().ui.processes.MOPIDY_GET_SEARCH_RESULTS_PROCESSOR;
// Cancelling
if (last_run && last_run.status == 'cancelling'){
store.dispatch(uiActions.processCancelled('MOPIDY_GET_SEARCH_RESULTS_PROCESSOR'))
store.dispatch(uiActions.processCancelled('MOPIDY_GET_SEARCH_RESULTS_PROCESSOR'));
return
// No more schemes, so we're done!
@ -895,6 +895,13 @@ const MopidyMiddleware = (function(){
// Albums
case 'albums':
// Quick check to see if we should be cancelling
var last_run = store.getState().ui.processes.MOPIDY_GET_SEARCH_RESULTS_PROCESSOR;
if (last_run && last_run.status == 'cancelling'){
store.dispatch(uiActions.processCancelled('MOPIDY_GET_SEARCH_RESULTS_PROCESSOR'));
return;
}
store.dispatch(uiActions.updateProcess(
'MOPIDY_GET_SEARCH_RESULTS_PROCESSOR',
@ -961,6 +968,13 @@ const MopidyMiddleware = (function(){
// Artists
case 'artists':
// Quick check to see if we should be cancelling
var last_run = store.getState().ui.processes.MOPIDY_GET_SEARCH_RESULTS_PROCESSOR;
if (last_run && last_run.status == 'cancelling'){
store.dispatch(uiActions.processCancelled('MOPIDY_GET_SEARCH_RESULTS_PROCESSOR'));
return;
}
store.dispatch(uiActions.updateProcess(
'MOPIDY_GET_SEARCH_RESULTS_PROCESSOR',
@ -1036,6 +1050,13 @@ const MopidyMiddleware = (function(){
// Playlists
case 'playlists':
// Quick check to see if we should be cancelling
var last_run = store.getState().ui.processes.MOPIDY_GET_SEARCH_RESULTS_PROCESSOR;
if (last_run && last_run.status == 'cancelling'){
store.dispatch(uiActions.processCancelled('MOPIDY_GET_SEARCH_RESULTS_PROCESSOR'));
return;
}
store.dispatch(uiActions.updateProcess(
'MOPIDY_GET_SEARCH_RESULTS_PROCESSOR',
@ -1085,6 +1106,13 @@ const MopidyMiddleware = (function(){
// Tracks
case 'tracks':
// Quick check to see if we should be cancelling
var last_run = store.getState().ui.processes.MOPIDY_GET_SEARCH_RESULTS_PROCESSOR;
if (last_run && last_run.status == 'cancelling'){
store.dispatch(uiActions.processCancelled('MOPIDY_GET_SEARCH_RESULTS_PROCESSOR'));
return;
}
store.dispatch(uiActions.updateProcess(
'MOPIDY_GET_SEARCH_RESULTS_PROCESSOR',
@ -1132,38 +1160,57 @@ const MopidyMiddleware = (function(){
// Search for all types
case 'all':
default:
store.dispatch(uiActions.updateProcess(
'MOPIDY_GET_SEARCH_RESULTS_PROCESSOR',
'Searching '+action.data.uri_scheme.replace(':','')+' tracks',
{
remaining: (action.data.uri_schemes.length) + 1
var process_tracks = () => {
// Quick check to see if we should be cancelling
var last_run = store.getState().ui.processes.MOPIDY_GET_SEARCH_RESULTS_PROCESSOR;
if (last_run && last_run.status == 'cancelling'){
store.dispatch(uiActions.processCancelled('MOPIDY_GET_SEARCH_RESULTS_PROCESSOR'));
return;
}
));
request(socket, store, 'library.search', {query: {any: [action.data.query]}, uris: [action.data.uri_scheme]})
.then(
response => {
if (response.length > 0 && response[0].tracks !== undefined){
var tracks = response[0].tracks;
store.dispatch({
type: 'MOPIDY_SEARCH_RESULTS_LOADED',
context: 'tracks',
results: helpers.formatTracks(tracks)
});
}
process_albums();
},
error => {
store.dispatch(coreActions.handleException(
"Mopidy: "+(error.message ? error.message : "Search failed"),
error
));
process_albums();
store.dispatch(uiActions.updateProcess(
'MOPIDY_GET_SEARCH_RESULTS_PROCESSOR',
'Searching '+action.data.uri_scheme.replace(':','')+' tracks',
{
remaining: (action.data.uri_schemes.length) + 1
}
);
));
request(socket, store, 'library.search', {query: {any: [action.data.query]}, uris: [action.data.uri_scheme]})
.then(
response => {
if (response.length > 0 && response[0].tracks !== undefined){
var tracks = response[0].tracks;
store.dispatch({
type: 'MOPIDY_SEARCH_RESULTS_LOADED',
context: 'tracks',
results: helpers.formatTracks(tracks)
});
}
process_albums();
},
error => {
store.dispatch(coreActions.handleException(
"Mopidy: "+(error.message ? error.message : "Search failed"),
error
));
process_albums();
}
);
}
var process_albums = () => {
// Quick check to see if we should be cancelling
var last_run = store.getState().ui.processes.MOPIDY_GET_SEARCH_RESULTS_PROCESSOR;
if (last_run && last_run.status == 'cancelling'){
store.dispatch(uiActions.processCancelled('MOPIDY_GET_SEARCH_RESULTS_PROCESSOR'));
return;
}
store.dispatch(uiActions.updateProcess(
'MOPIDY_GET_SEARCH_RESULTS_PROCESSOR',
'Searching '+action.data.uri_scheme.replace(':','')+' albums',
@ -1217,6 +1264,14 @@ const MopidyMiddleware = (function(){
}
var process_artists = () => {
// Quick check to see if we should be cancelling
var last_run = store.getState().ui.processes.MOPIDY_GET_SEARCH_RESULTS_PROCESSOR;
if (last_run && last_run.status == 'cancelling'){
store.dispatch(uiActions.processCancelled('MOPIDY_GET_SEARCH_RESULTS_PROCESSOR'));
return;
}
store.dispatch(uiActions.updateProcess(
'MOPIDY_GET_SEARCH_RESULTS_PROCESSOR',
'Searching '+action.data.uri_scheme.replace(':','')+' artists',
@ -1277,23 +1332,15 @@ const MopidyMiddleware = (function(){
}
);
}
var finished = () => {
// We're finally done searching for types on this provider
// On to the next scheme!
store.dispatch(uiActions.runProcess(
'MOPIDY_GET_SEARCH_RESULTS_PROCESSOR',
{
context: action.data.context,
query: action.data.query,
limit: action.data.limit,
uri_scheme: next_uri_scheme,
uri_schemes: next_uri_schemes,
remaining: action.data.uri_schemes.length
}
))
}
var process_playlists = () => {
// Quick check to see if we should be cancelling
var last_run = store.getState().ui.processes.MOPIDY_GET_SEARCH_RESULTS_PROCESSOR;
if (last_run && last_run.status == 'cancelling'){
store.dispatch(uiActions.processCancelled('MOPIDY_GET_SEARCH_RESULTS_PROCESSOR'));
return;
}
if (action.data.uri_scheme == 'm3u:'){
store.dispatch(uiActions.updateProcess(
'MOPIDY_GET_SEARCH_RESULTS_PROCESSOR',
@ -1344,6 +1391,25 @@ const MopidyMiddleware = (function(){
finished();
}
}
var finished = () => {
// We're finally done searching for types on this provider
// On to the next scheme!
store.dispatch(uiActions.runProcess(
'MOPIDY_GET_SEARCH_RESULTS_PROCESSOR',
{
context: action.data.context,
query: action.data.query,
limit: action.data.limit,
uri_scheme: next_uri_scheme,
uri_schemes: next_uri_schemes,
remaining: action.data.uri_schemes.length
}
))
}
// Kick things off with the tracks
process_tracks();
}
break

View File

@ -68,21 +68,14 @@ class Search extends React.Component{
// Digest the URI query property
// Triggered when the URL changes
digestUri(props = this.props){
if (props.params && props.params.query && props.params.query !== ''){
var type = helpers.getFromUri("searchtype", props.params.query);
var term = helpers.getFromUri("searchterm", props.params.query);
if (props.params && props.params.type && props.params.term){
if (type){
this.setState({type: type});
}
this.setState({
type: props.params.type,
term: props.params.term
});
if (term){
this.setState({term: term});
}
if (type && term){
this.search(type, term);
}
this.search(props.params.type, props.params.term);
}
}
@ -242,7 +235,7 @@ class Search extends React.Component{
Tracks
</h4>
<section className="list-wrapper">
<TrackList tracks={tracks} uri={'iris:'+this.props.params.query} show_source_icon />
<TrackList tracks={tracks} uri={'iris:search:'+this.state.type+':'+this.state.term} show_source_icon />
<LazyLoadListener enabled={this.props['tracks_more'] && spotify_search_enabled} loadMore={ () => this.loadMore('tracks') }/>
</section>
</div>
@ -309,7 +302,7 @@ class Search extends React.Component{
if (tracks.length > 0){
var tracks_section = (
<section className="list-wrapper">
<TrackList tracks={tracks} uri={'iris:'+this.props.params.query} show_source_icon />
<TrackList tracks={tracks} uri={'iris:search:'+this.state.type+':'+this.state.term} show_source_icon />
<LazyLoadListener loading={this.props['tracks_more'] && spotify_search_enabled} loadMore={ () => this.loadMore('tracks') }/>
</section>
)