Playback history
This commit is contained in:
@ -225,4 +225,11 @@ export function getSearchResults(query, uris = null, fields = ['any']){
|
||||
fields: fields
|
||||
}
|
||||
}
|
||||
|
||||
export function getQueueHistory(){
|
||||
return {
|
||||
type: 'MOPIDY_INSTRUCT',
|
||||
call: 'history.getHistory'
|
||||
}
|
||||
}
|
||||
|
||||
@ -163,7 +163,6 @@ const MopidyMiddleware = (function(){
|
||||
instruct( socket, store, action.call, action.value )
|
||||
break;
|
||||
|
||||
// send an instruction to the websocket
|
||||
case 'MOPIDY_DEBUG':
|
||||
instruct( socket, store, action.call, action.value )
|
||||
.then( response => {
|
||||
@ -171,7 +170,29 @@ const MopidyMiddleware = (function(){
|
||||
})
|
||||
break;
|
||||
|
||||
// send an instruction to the websocket
|
||||
case 'MOPIDY_URISCHEMES':
|
||||
var uri_schemes = action.data
|
||||
var remove = ['http','https','mms','rtmp','rtmps','rtsp','sc','spotify']
|
||||
|
||||
// remove all our ignored types
|
||||
for( var i = 0; i < remove.length; i++ ){
|
||||
var index = uri_schemes.indexOf(remove[i])
|
||||
if( index > -1 ) uri_schemes.splice(index, 1);
|
||||
}
|
||||
|
||||
// append with ':' to make them a mopidy URI
|
||||
for( var i = 0; i < uri_schemes.length; i++ ){
|
||||
uri_schemes[i] = uri_schemes[i] +':'
|
||||
}
|
||||
|
||||
store.dispatch({ type: 'MOPIDY_URISCHEMES_FILTERED', data: uri_schemes });
|
||||
break;
|
||||
|
||||
|
||||
/**
|
||||
* General playback
|
||||
**/
|
||||
|
||||
case 'MOPIDY_NEXT':
|
||||
var icon = false
|
||||
if( store.getState().ui.current_track ){
|
||||
@ -212,24 +233,6 @@ const MopidyMiddleware = (function(){
|
||||
})
|
||||
break;
|
||||
|
||||
case 'MOPIDY_URISCHEMES':
|
||||
var uri_schemes = action.data
|
||||
var remove = ['http','https','mms','rtmp','rtmps','rtsp','sc','spotify']
|
||||
|
||||
// remove all our ignored types
|
||||
for( var i = 0; i < remove.length; i++ ){
|
||||
var index = uri_schemes.indexOf(remove[i])
|
||||
if( index > -1 ) uri_schemes.splice(index, 1);
|
||||
}
|
||||
|
||||
// append with ':' to make them a mopidy URI
|
||||
for( var i = 0; i < uri_schemes.length; i++ ){
|
||||
uri_schemes[i] = uri_schemes[i] +':'
|
||||
}
|
||||
|
||||
store.dispatch({ type: 'MOPIDY_URISCHEMES_FILTERED', data: uri_schemes });
|
||||
break;
|
||||
|
||||
case 'MOPIDY_ENQUEUE_URIS_NEXT':
|
||||
|
||||
var current_track = store.getState().ui.current_track
|
||||
|
||||
@ -62,6 +62,22 @@ export default function reducer(mopidy = {}, action){
|
||||
time_position: action.data
|
||||
});
|
||||
|
||||
case 'MOPIDY_HISTORY':
|
||||
var history = []
|
||||
for (var i = 0; i < action.data.length; i++){
|
||||
history.push(Object.assign(
|
||||
{},
|
||||
action.data[i][1],
|
||||
{
|
||||
played_at: action.data[i][0],
|
||||
type: 'history'
|
||||
}
|
||||
))
|
||||
}
|
||||
return Object.assign({}, mopidy, {
|
||||
queue_history: history
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Asset-oriented actions
|
||||
|
||||
Reference in New Issue
Block a user