Fixing context menu trigger silencing; Search form polish
This commit is contained in:
@ -1043,7 +1043,6 @@ const MopidyMiddleware = (function () {
|
||||
'MOPIDY_GET_SEARCH_RESULTS_PROCESSOR',
|
||||
`Searching ${uri_schemes_total} Mopidy providers`,
|
||||
{
|
||||
context: action.context,
|
||||
query: action.query,
|
||||
limit: action.limit,
|
||||
total: uri_schemes_total,
|
||||
@ -1084,13 +1083,10 @@ const MopidyMiddleware = (function () {
|
||||
},
|
||||
));
|
||||
|
||||
switch (action.data.context) {
|
||||
// Albums
|
||||
switch (action.data.query.type) {
|
||||
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') {
|
||||
if (last_run && last_run.status === 'cancelling') {
|
||||
store.dispatch(uiActions.processCancelled('MOPIDY_GET_SEARCH_RESULTS_PROCESSOR'));
|
||||
return;
|
||||
}
|
||||
@ -1104,7 +1100,6 @@ const MopidyMiddleware = (function () {
|
||||
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,
|
||||
@ -1113,7 +1108,7 @@ const MopidyMiddleware = (function () {
|
||||
));
|
||||
};
|
||||
|
||||
request(socket, store, 'library.search', { query: { album: [action.data.query] }, uris: [action.data.uri_scheme] })
|
||||
request(socket, store, 'library.search', { query: { album: [action.data.query.term] }, uris: [action.data.uri_scheme] })
|
||||
.then(
|
||||
(response) => {
|
||||
if (response.length > 0) {
|
||||
@ -1142,8 +1137,8 @@ const MopidyMiddleware = (function () {
|
||||
store.dispatch({
|
||||
type: 'MOPIDY_SEARCH_RESULTS_LOADED',
|
||||
query: action.data.query,
|
||||
context: action.data.context,
|
||||
results: albums_uris,
|
||||
context: 'albums',
|
||||
});
|
||||
}
|
||||
|
||||
@ -1159,12 +1154,9 @@ const MopidyMiddleware = (function () {
|
||||
);
|
||||
break;
|
||||
|
||||
// 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') {
|
||||
if (last_run && last_run.status === 'cancelling') {
|
||||
store.dispatch(uiActions.processCancelled('MOPIDY_GET_SEARCH_RESULTS_PROCESSOR'));
|
||||
return;
|
||||
}
|
||||
@ -1178,7 +1170,6 @@ const MopidyMiddleware = (function () {
|
||||
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,
|
||||
@ -1187,7 +1178,7 @@ const MopidyMiddleware = (function () {
|
||||
));
|
||||
};
|
||||
|
||||
request(socket, store, 'library.search', { query: { artist: [action.data.query] }, uris: [action.data.uri_scheme] })
|
||||
request(socket, store, 'library.search', { query: { artist: [action.data.query.term] }, uris: [action.data.uri_scheme] })
|
||||
.then(
|
||||
(response) => {
|
||||
if (response.length > 0) {
|
||||
@ -1225,7 +1216,7 @@ const MopidyMiddleware = (function () {
|
||||
store.dispatch({
|
||||
type: 'MOPIDY_SEARCH_RESULTS_LOADED',
|
||||
query: action.data.query,
|
||||
context: action.data.context,
|
||||
context: 'artists',
|
||||
results: artists_uris,
|
||||
});
|
||||
}
|
||||
@ -1242,12 +1233,9 @@ const MopidyMiddleware = (function () {
|
||||
);
|
||||
break;
|
||||
|
||||
// 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') {
|
||||
if (last_run && last_run.status === 'cancelling') {
|
||||
store.dispatch(uiActions.processCancelled('MOPIDY_GET_SEARCH_RESULTS_PROCESSOR'));
|
||||
return;
|
||||
}
|
||||
@ -1283,7 +1271,7 @@ const MopidyMiddleware = (function () {
|
||||
store.dispatch({
|
||||
type: 'MOPIDY_SEARCH_RESULTS_LOADED',
|
||||
query: action.data.query,
|
||||
context: action.data.context,
|
||||
context: 'playlists',
|
||||
results: playlists_uris,
|
||||
});
|
||||
}
|
||||
@ -1299,12 +1287,9 @@ const MopidyMiddleware = (function () {
|
||||
);
|
||||
break;
|
||||
|
||||
// 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') {
|
||||
if (last_run && last_run.status === 'cancelling') {
|
||||
store.dispatch(uiActions.processCancelled('MOPIDY_GET_SEARCH_RESULTS_PROCESSOR'));
|
||||
return;
|
||||
}
|
||||
@ -1318,7 +1303,6 @@ const MopidyMiddleware = (function () {
|
||||
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,
|
||||
@ -1327,7 +1311,7 @@ const MopidyMiddleware = (function () {
|
||||
));
|
||||
};
|
||||
|
||||
request(socket, store, 'library.search', { query: { any: [action.data.query] }, uris: [action.data.uri_scheme] })
|
||||
request(socket, store, 'library.search', { query: { any: [action.data.query.term] }, uris: [action.data.uri_scheme] })
|
||||
.then(
|
||||
(response) => {
|
||||
if (response.length > 0 && response[0].tracks !== undefined) {
|
||||
@ -1336,7 +1320,7 @@ const MopidyMiddleware = (function () {
|
||||
store.dispatch({
|
||||
type: 'MOPIDY_SEARCH_RESULTS_LOADED',
|
||||
query: action.data.query,
|
||||
context: action.data.context,
|
||||
context: 'tracks',
|
||||
results: formatTracks(tracks),
|
||||
});
|
||||
}
|
||||
@ -1353,12 +1337,9 @@ const MopidyMiddleware = (function () {
|
||||
|
||||
break;
|
||||
|
||||
// Search for all types
|
||||
case 'all':
|
||||
default:
|
||||
|
||||
var process_tracks = () => {
|
||||
// Quick check to see if we should be cancelling
|
||||
const 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'));
|
||||
@ -1372,7 +1353,7 @@ const MopidyMiddleware = (function () {
|
||||
remaining: (action.data.uri_schemes.length) + 1,
|
||||
},
|
||||
));
|
||||
request(socket, store, 'library.search', { query: { any: [action.data.query] }, uris: [action.data.uri_scheme] })
|
||||
request(socket, store, 'library.search', { query: { any: [action.data.query.term] }, uris: [action.data.uri_scheme] })
|
||||
.then(
|
||||
(response) => {
|
||||
if (response.length > 0 && response[0].tracks !== undefined) {
|
||||
@ -1413,7 +1394,7 @@ const MopidyMiddleware = (function () {
|
||||
remaining: (action.data.uri_schemes.length) + 0.75,
|
||||
},
|
||||
));
|
||||
request(socket, store, 'library.search', { query: { album: [action.data.query] }, uris: [action.data.uri_scheme] })
|
||||
request(socket, store, 'library.search', { query: { album: [action.data.query.term] }, uris: [action.data.uri_scheme] })
|
||||
.then(
|
||||
(response) => {
|
||||
if (response.length > 0) {
|
||||
@ -1474,7 +1455,7 @@ const MopidyMiddleware = (function () {
|
||||
remaining: (action.data.uri_schemes.length) + 0.5,
|
||||
},
|
||||
));
|
||||
request(socket, store, 'library.search', { query: { artist: [action.data.query] }, uris: [action.data.uri_scheme] })
|
||||
request(socket, store, 'library.search', { query: { artist: [action.data.query.term] }, uris: [action.data.uri_scheme] })
|
||||
.then(
|
||||
(response) => {
|
||||
if (response.length > 0) {
|
||||
@ -1551,7 +1532,7 @@ const MopidyMiddleware = (function () {
|
||||
let playlists_uris = [];
|
||||
for (var i = 0; i < response.length; i++) {
|
||||
const playlist = response[i];
|
||||
if (playlist.name.includes(action.data.query) && action.data.uri_schemes.includes(`${uriSource(playlist.uri)}:`)) {
|
||||
if (playlist.name.includes(action.data.query.term) && action.data.uri_schemes.includes(`${uriSource(playlist.uri)}:`)) {
|
||||
playlists_uris.push(playlist.uri);
|
||||
}
|
||||
}
|
||||
@ -1593,7 +1574,6 @@ const MopidyMiddleware = (function () {
|
||||
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,
|
||||
|
||||
Reference in New Issue
Block a user