Files
Iris/src/js/services/mopidy/actions.js

106 lines
1.6 KiB
JavaScript
Raw Normal View History

/**
* Actions and Action Creators
**/
export function setConfig( config ){
return {
type: 'MOPIDY_SET_CONFIG',
config: config
}
}
export function connect(){
return {
type: 'MOPIDY_CONNECT'
}
}
export function disconnect(){
2016-10-18 08:56:53 +13:00
return {
type: 'MOPIDY_DISCONNECT'
2016-10-18 08:56:53 +13:00
}
}
export function instruct( call, value ){
return {
type: 'MOPIDY_INSTRUCT',
call: call,
value: value
}
}
/**
* Playback-oriented actions
**/
export function changeTrack( tlid ){
return {
type: 'MOPIDY_INSTRUCT',
call: 'playback.play',
value: { tlid: tlid }
}
}
2016-10-19 14:09:34 +13:00
export function playTracks( uris ){
return {
type: 'MOPIDY_PLAY_TRACKS',
uris: uris
}
}
export function enqueueTracks( uris, at_position = false ){
if( typeof(uris) !== 'object' ) uris = [uris];
var value = { uris: uris };
if( at_position ) value.at_position = at_position;
return {
type: 'MOPIDY_INSTRUCT',
2016-10-19 14:09:34 +13:00
call: 'tracklist.add',
value: value
2016-10-19 14:09:34 +13:00
}
}
export function removeTracks( tlids ){
return {
type: 'MOPIDY_INSTRUCT',
call: 'tracklist.remove',
value: { tlid: tlids }
}
}
export function play(){
return instruct('playback.play');
}
export function pause(){
return instruct('playback.pause');
}
export function next(){
return instruct('playback.next');
}
export function previous(){
return instruct('playback.previous');
}
/**
* Asset-oriented actions
**/
export function getPlaylists(){
return { type: 'MOPIDY_PLAYLISTS' }
}
2016-11-01 07:37:18 +13:00
export function getBrowse( uri ){
return {
type: 'MOPIDY_INSTRUCT',
call: 'library.browse',
value: { uri: uri }
}
}