Auto eslint fix
This commit is contained in:
@ -1,509 +1,506 @@
|
||||
|
||||
import * as helpers from '../../helpers'
|
||||
import * as helpers from '../../helpers';
|
||||
|
||||
export function set(data){
|
||||
return {
|
||||
type: 'MOPIDY_SET',
|
||||
data: data
|
||||
}
|
||||
export function set(data) {
|
||||
return {
|
||||
type: 'MOPIDY_SET',
|
||||
data,
|
||||
};
|
||||
}
|
||||
|
||||
export function request(method, params = {}, response_callback = null, error_callback = null){
|
||||
return {
|
||||
type: 'MOPIDY_REQUEST',
|
||||
method: method,
|
||||
params: params,
|
||||
response_callback: response_callback,
|
||||
error_callback: error_callback
|
||||
}
|
||||
export function request(method, params = {}, response_callback = null, error_callback = null) {
|
||||
return {
|
||||
type: 'MOPIDY_REQUEST',
|
||||
method,
|
||||
params,
|
||||
response_callback,
|
||||
error_callback,
|
||||
};
|
||||
}
|
||||
|
||||
export function connect(){
|
||||
return {
|
||||
type: 'MOPIDY_CONNECT'
|
||||
}
|
||||
export function connect() {
|
||||
return {
|
||||
type: 'MOPIDY_CONNECT',
|
||||
};
|
||||
}
|
||||
|
||||
export function connecting(){
|
||||
return {
|
||||
type: 'MOPIDY_CONNECTING'
|
||||
}
|
||||
export function connecting() {
|
||||
return {
|
||||
type: 'MOPIDY_CONNECTING',
|
||||
};
|
||||
}
|
||||
|
||||
export function disconnect(){
|
||||
return {
|
||||
type: 'MOPIDY_DISCONNECT'
|
||||
}
|
||||
export function disconnect() {
|
||||
return {
|
||||
type: 'MOPIDY_DISCONNECT',
|
||||
};
|
||||
}
|
||||
|
||||
export function debug(call, value){
|
||||
return {
|
||||
type: 'MOPIDY_DEBUG',
|
||||
call: call,
|
||||
value: value
|
||||
}
|
||||
export function debug(call, value) {
|
||||
return {
|
||||
type: 'MOPIDY_DEBUG',
|
||||
call,
|
||||
value,
|
||||
};
|
||||
}
|
||||
|
||||
export function restartStarted(){
|
||||
return {
|
||||
type: 'MOPIDY_RESTART_STARTED'
|
||||
}
|
||||
export function restartStarted() {
|
||||
return {
|
||||
type: 'MOPIDY_RESTART_STARTED',
|
||||
};
|
||||
}
|
||||
|
||||
export function restartFinished(){
|
||||
return {
|
||||
type: 'MOPIDY_RESTART_FINISHED'
|
||||
}
|
||||
export function restartFinished() {
|
||||
return {
|
||||
type: 'MOPIDY_RESTART_FINISHED',
|
||||
};
|
||||
}
|
||||
|
||||
export function upgradeStarted(){
|
||||
return {
|
||||
type: 'MOPIDY_UPGRADE_STARTED'
|
||||
}
|
||||
export function upgradeStarted() {
|
||||
return {
|
||||
type: 'MOPIDY_UPGRADE_STARTED',
|
||||
};
|
||||
}
|
||||
|
||||
export function upgradeFinished(){
|
||||
return {
|
||||
type: 'MOPIDY_UPGRADE_FINISHED'
|
||||
}
|
||||
export function upgradeFinished() {
|
||||
return {
|
||||
type: 'MOPIDY_UPGRADE_FINISHED',
|
||||
};
|
||||
}
|
||||
|
||||
export function localScanStarted(){
|
||||
return {
|
||||
type: 'MOPIDY_LOCAL_SCAN_STARTED'
|
||||
}
|
||||
export function localScanStarted() {
|
||||
return {
|
||||
type: 'MOPIDY_LOCAL_SCAN_STARTED',
|
||||
};
|
||||
}
|
||||
|
||||
export function localScanFinished(){
|
||||
return {
|
||||
type: 'MOPIDY_LOCAL_SCAN_FINISHED'
|
||||
}
|
||||
export function localScanFinished() {
|
||||
return {
|
||||
type: 'MOPIDY_LOCAL_SCAN_FINISHED',
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Core play actions
|
||||
**/
|
||||
* */
|
||||
|
||||
export function getPlayState(){
|
||||
return {
|
||||
type: 'MOPIDY_GET_PLAY_STATE'
|
||||
}
|
||||
export function getPlayState() {
|
||||
return {
|
||||
type: 'MOPIDY_GET_PLAY_STATE',
|
||||
};
|
||||
}
|
||||
|
||||
export function play(){
|
||||
return {
|
||||
type: 'MOPIDY_PLAY'
|
||||
}
|
||||
export function play() {
|
||||
return {
|
||||
type: 'MOPIDY_PLAY',
|
||||
};
|
||||
}
|
||||
|
||||
export function pause(){
|
||||
return {
|
||||
type: 'MOPIDY_PAUSE'
|
||||
}
|
||||
export function pause() {
|
||||
return {
|
||||
type: 'MOPIDY_PAUSE',
|
||||
};
|
||||
}
|
||||
|
||||
export function stop(){
|
||||
return {
|
||||
type: 'MOPIDY_STOP'
|
||||
}
|
||||
export function stop() {
|
||||
return {
|
||||
type: 'MOPIDY_STOP',
|
||||
};
|
||||
}
|
||||
|
||||
export function next(){
|
||||
return {
|
||||
type: 'MOPIDY_NEXT'
|
||||
}
|
||||
export function next() {
|
||||
return {
|
||||
type: 'MOPIDY_NEXT',
|
||||
};
|
||||
}
|
||||
|
||||
export function previous(){
|
||||
return {
|
||||
type: 'MOPIDY_PREVIOUS'
|
||||
}
|
||||
export function previous() {
|
||||
return {
|
||||
type: 'MOPIDY_PREVIOUS',
|
||||
};
|
||||
}
|
||||
|
||||
export function getMute(){
|
||||
return {
|
||||
type: 'MOPIDY_GET_MUTE'
|
||||
}
|
||||
export function getMute() {
|
||||
return {
|
||||
type: 'MOPIDY_GET_MUTE',
|
||||
};
|
||||
}
|
||||
|
||||
export function setMute(mute){
|
||||
return {
|
||||
type: 'MOPIDY_SET_MUTE',
|
||||
mute: mute
|
||||
}
|
||||
export function setMute(mute) {
|
||||
return {
|
||||
type: 'MOPIDY_SET_MUTE',
|
||||
mute,
|
||||
};
|
||||
}
|
||||
|
||||
export function getVolume(){
|
||||
return {
|
||||
type: 'MOPIDY_GET_VOLUME'
|
||||
}
|
||||
export function getVolume() {
|
||||
return {
|
||||
type: 'MOPIDY_GET_VOLUME',
|
||||
};
|
||||
}
|
||||
|
||||
export function setVolume(volume){
|
||||
return {
|
||||
type: 'MOPIDY_SET_VOLUME',
|
||||
volume: volume
|
||||
}
|
||||
export function setVolume(volume) {
|
||||
return {
|
||||
type: 'MOPIDY_SET_VOLUME',
|
||||
volume,
|
||||
};
|
||||
}
|
||||
|
||||
export function getConsume(){
|
||||
return {
|
||||
type: 'MOPIDY_GET_CONSUME'
|
||||
}
|
||||
export function getConsume() {
|
||||
return {
|
||||
type: 'MOPIDY_GET_CONSUME',
|
||||
};
|
||||
}
|
||||
|
||||
export function setConsume(consume){
|
||||
return {
|
||||
type: 'MOPIDY_SET_CONSUME',
|
||||
consume: consume
|
||||
}
|
||||
export function setConsume(consume) {
|
||||
return {
|
||||
type: 'MOPIDY_SET_CONSUME',
|
||||
consume,
|
||||
};
|
||||
}
|
||||
|
||||
export function getRepeat(){
|
||||
return {
|
||||
type: 'MOPIDY_GET_REPEAT'
|
||||
}
|
||||
export function getRepeat() {
|
||||
return {
|
||||
type: 'MOPIDY_GET_REPEAT',
|
||||
};
|
||||
}
|
||||
|
||||
export function setRepeat(repeat){
|
||||
return {
|
||||
type: 'MOPIDY_SET_REPEAT',
|
||||
repeat: repeat
|
||||
}
|
||||
export function setRepeat(repeat) {
|
||||
return {
|
||||
type: 'MOPIDY_SET_REPEAT',
|
||||
repeat,
|
||||
};
|
||||
}
|
||||
|
||||
export function getRandom(){
|
||||
return {
|
||||
type: 'MOPIDY_GET_RANDOM'
|
||||
}
|
||||
export function getRandom() {
|
||||
return {
|
||||
type: 'MOPIDY_GET_RANDOM',
|
||||
};
|
||||
}
|
||||
|
||||
export function setRandom(random){
|
||||
return {
|
||||
type: 'MOPIDY_SET_RANDOM',
|
||||
random: random
|
||||
}
|
||||
export function setRandom(random) {
|
||||
return {
|
||||
type: 'MOPIDY_SET_RANDOM',
|
||||
random,
|
||||
};
|
||||
}
|
||||
|
||||
export function getTimePosition(){
|
||||
return {
|
||||
type: 'MOPIDY_GET_TIME_POSITION'
|
||||
}
|
||||
export function getTimePosition() {
|
||||
return {
|
||||
type: 'MOPIDY_GET_TIME_POSITION',
|
||||
};
|
||||
}
|
||||
|
||||
export function setTimePosition(time_position){
|
||||
return {
|
||||
type: 'MOPIDY_SET_TIME_POSITION',
|
||||
time_position: parseInt(time_position)
|
||||
}
|
||||
export function setTimePosition(time_position) {
|
||||
return {
|
||||
type: 'MOPIDY_SET_TIME_POSITION',
|
||||
time_position: parseInt(time_position),
|
||||
};
|
||||
}
|
||||
|
||||
export function timePosition(time_position){
|
||||
return {
|
||||
type: 'MOPIDY_TIME_POSITION',
|
||||
time_position: parseInt(time_position)
|
||||
}
|
||||
export function timePosition(time_position) {
|
||||
return {
|
||||
type: 'MOPIDY_TIME_POSITION',
|
||||
time_position: parseInt(time_position),
|
||||
};
|
||||
}
|
||||
|
||||
export function getUriSchemes(){
|
||||
return {
|
||||
type: 'MOPIDY_GET_URI_SCHEMES'
|
||||
}
|
||||
export function getUriSchemes() {
|
||||
return {
|
||||
type: 'MOPIDY_GET_URI_SCHEMES',
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Advanced playback actions
|
||||
**/
|
||||
* */
|
||||
|
||||
export function getCurrentTrack(){
|
||||
return {
|
||||
type: 'MOPIDY_GET_CURRENT_TRACK'
|
||||
}
|
||||
export function getCurrentTrack() {
|
||||
return {
|
||||
type: 'MOPIDY_GET_CURRENT_TRACK',
|
||||
};
|
||||
}
|
||||
|
||||
export function currentTrackLoaded(tl_track){
|
||||
return {
|
||||
type: 'MOPIDY_CURRENT_TRACK_LOADED',
|
||||
tl_track: tl_track
|
||||
}
|
||||
export function currentTrackLoaded(tl_track) {
|
||||
return {
|
||||
type: 'MOPIDY_CURRENT_TRACK_LOADED',
|
||||
tl_track,
|
||||
};
|
||||
}
|
||||
|
||||
export function getNextTrack(){
|
||||
return {
|
||||
type: 'MOPIDY_GET_NEXT_TRACK'
|
||||
}
|
||||
export function getNextTrack() {
|
||||
return {
|
||||
type: 'MOPIDY_GET_NEXT_TRACK',
|
||||
};
|
||||
}
|
||||
|
||||
export function clearCurrentTrack(){
|
||||
return {
|
||||
type: 'CLEAR_CURRENT_TRACK'
|
||||
}
|
||||
export function clearCurrentTrack() {
|
||||
return {
|
||||
type: 'CLEAR_CURRENT_TRACK',
|
||||
};
|
||||
}
|
||||
|
||||
export function getQueue(){
|
||||
return {
|
||||
type: 'MOPIDY_GET_QUEUE'
|
||||
}
|
||||
export function getQueue() {
|
||||
return {
|
||||
type: 'MOPIDY_GET_QUEUE',
|
||||
};
|
||||
}
|
||||
|
||||
export function changeTrack(tlid){
|
||||
return {
|
||||
type: 'MOPIDY_CHANGE_TRACK',
|
||||
tlid: tlid
|
||||
}
|
||||
export function changeTrack(tlid) {
|
||||
return {
|
||||
type: 'MOPIDY_CHANGE_TRACK',
|
||||
tlid,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Playing assets
|
||||
**/
|
||||
* */
|
||||
|
||||
export function playURIs(uris = [], from_uri = null, shuffle = false){
|
||||
return {
|
||||
type: 'MOPIDY_PLAY_URIS',
|
||||
uris: uris,
|
||||
from_uri: from_uri
|
||||
}
|
||||
export function playURIs(uris = [], from_uri = null, shuffle = false) {
|
||||
return {
|
||||
type: 'MOPIDY_PLAY_URIS',
|
||||
uris,
|
||||
from_uri,
|
||||
};
|
||||
}
|
||||
|
||||
export function playAlbum(uri){
|
||||
return {
|
||||
type: 'MOPIDY_PLAY_ALBUM',
|
||||
uri: uri
|
||||
}
|
||||
export function playAlbum(uri) {
|
||||
return {
|
||||
type: 'MOPIDY_PLAY_ALBUM',
|
||||
uri,
|
||||
};
|
||||
}
|
||||
|
||||
export function playPlaylist(uri, shuffle = false){
|
||||
return {
|
||||
type: 'MOPIDY_PLAY_PLAYLIST',
|
||||
uri: uri,
|
||||
shuffle: shuffle
|
||||
}
|
||||
export function playPlaylist(uri, shuffle = false) {
|
||||
return {
|
||||
type: 'MOPIDY_PLAY_PLAYLIST',
|
||||
uri,
|
||||
shuffle,
|
||||
};
|
||||
}
|
||||
|
||||
export function enqueueURIs(uris = [], from_uri = null, play_next = false, at_position = null, offset = 0){
|
||||
return {
|
||||
type: 'MOPIDY_ENQUEUE_URIS',
|
||||
uris: uris,
|
||||
from_uri: from_uri,
|
||||
at_position: at_position,
|
||||
play_next: play_next,
|
||||
offset: offset
|
||||
}
|
||||
export function enqueueURIs(uris = [], from_uri = null, play_next = false, at_position = null, offset = 0) {
|
||||
return {
|
||||
type: 'MOPIDY_ENQUEUE_URIS',
|
||||
uris,
|
||||
from_uri,
|
||||
at_position,
|
||||
play_next,
|
||||
offset,
|
||||
};
|
||||
}
|
||||
|
||||
export function enqueueAlbum(uri, next = false, at_position = null){
|
||||
return {
|
||||
type: 'MOPIDY_ENQUEUE_ALBUM',
|
||||
uri: uri,
|
||||
next: next,
|
||||
at_position: at_position
|
||||
}
|
||||
export function enqueueAlbum(uri, next = false, at_position = null) {
|
||||
return {
|
||||
type: 'MOPIDY_ENQUEUE_ALBUM',
|
||||
uri,
|
||||
next,
|
||||
at_position,
|
||||
};
|
||||
}
|
||||
|
||||
export function enqueuePlaylist(uri, play_next = false, at_position = null){
|
||||
return {
|
||||
type: 'MOPIDY_ENQUEUE_PLAYLIST',
|
||||
uri: uri,
|
||||
play_next: play_next,
|
||||
at_position: at_position
|
||||
}
|
||||
export function enqueuePlaylist(uri, play_next = false, at_position = null) {
|
||||
return {
|
||||
type: 'MOPIDY_ENQUEUE_PLAYLIST',
|
||||
uri,
|
||||
play_next,
|
||||
at_position,
|
||||
};
|
||||
}
|
||||
|
||||
export function enqueueURIsBatchDone(){
|
||||
return {
|
||||
type: 'MOPIDY_ENQUEUE_URIS_BATCH_DONE'
|
||||
}
|
||||
export function enqueueURIsBatchDone() {
|
||||
return {
|
||||
type: 'MOPIDY_ENQUEUE_URIS_BATCH_DONE',
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Playlist maniopulation
|
||||
**/
|
||||
* */
|
||||
|
||||
export function removeTracks(tlids){
|
||||
return {
|
||||
type: 'MOPIDY_REMOVE_TRACKS',
|
||||
tlids: tlids
|
||||
}
|
||||
export function removeTracks(tlids) {
|
||||
return {
|
||||
type: 'MOPIDY_REMOVE_TRACKS',
|
||||
tlids,
|
||||
};
|
||||
}
|
||||
|
||||
export function reorderTracklist(indexes, insert_before){
|
||||
var range = helpers.createRange(indexes );
|
||||
if (insert_before > range.start ) insert_before = insert_before - range.length
|
||||
return {
|
||||
type: 'MOPIDY_REORDER_TRACKLIST',
|
||||
range_start: range.start,
|
||||
range_length: range.length,
|
||||
insert_before: insert_before
|
||||
}
|
||||
export function reorderTracklist(indexes, insert_before) {
|
||||
const range = helpers.createRange(indexes);
|
||||
if (insert_before > range.start) insert_before -= range.length;
|
||||
return {
|
||||
type: 'MOPIDY_REORDER_TRACKLIST',
|
||||
range_start: range.start,
|
||||
range_length: range.length,
|
||||
insert_before,
|
||||
};
|
||||
}
|
||||
|
||||
export function clearTracklist(){
|
||||
return {
|
||||
type: 'MOPIDY_CLEAR_TRACKLIST'
|
||||
}
|
||||
export function clearTracklist() {
|
||||
return {
|
||||
type: 'MOPIDY_CLEAR_TRACKLIST',
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Asset-oriented actions
|
||||
**/
|
||||
* */
|
||||
|
||||
export function getImages(context, uris){
|
||||
return {
|
||||
type: 'MOPIDY_GET_IMAGES',
|
||||
context: context,
|
||||
uris: uris
|
||||
}
|
||||
export function getImages(context, uris) {
|
||||
return {
|
||||
type: 'MOPIDY_GET_IMAGES',
|
||||
context,
|
||||
uris,
|
||||
};
|
||||
}
|
||||
|
||||
export function createPlaylist(name, scheme){
|
||||
return {
|
||||
type: 'MOPIDY_CREATE_PLAYLIST',
|
||||
name: name,
|
||||
scheme: scheme
|
||||
}
|
||||
export function createPlaylist(name, scheme) {
|
||||
return {
|
||||
type: 'MOPIDY_CREATE_PLAYLIST',
|
||||
name,
|
||||
scheme,
|
||||
};
|
||||
}
|
||||
|
||||
export function deletePlaylist(uri){
|
||||
return {
|
||||
type: 'MOPIDY_DELETE_PLAYLIST',
|
||||
uri: uri
|
||||
}
|
||||
export function deletePlaylist(uri) {
|
||||
return {
|
||||
type: 'MOPIDY_DELETE_PLAYLIST',
|
||||
uri,
|
||||
};
|
||||
}
|
||||
|
||||
export function getLibraryPlaylists(){
|
||||
return { type: 'MOPIDY_GET_LIBRARY_PLAYLISTS' }
|
||||
export function getLibraryPlaylists() {
|
||||
return { type: 'MOPIDY_GET_LIBRARY_PLAYLISTS' };
|
||||
}
|
||||
|
||||
export function getPlaylist(uri){
|
||||
return {
|
||||
type: 'MOPIDY_GET_PLAYLIST',
|
||||
data: { uri: uri }
|
||||
}
|
||||
export function getPlaylist(uri) {
|
||||
return {
|
||||
type: 'MOPIDY_GET_PLAYLIST',
|
||||
data: { uri },
|
||||
};
|
||||
}
|
||||
|
||||
export function getPlaylists(uris, processor = null){
|
||||
return {
|
||||
type: 'MOPIDY_GET_PLAYLISTS',
|
||||
uris: uris,
|
||||
processor: processor
|
||||
}
|
||||
export function getPlaylists(uris, processor = null) {
|
||||
return {
|
||||
type: 'MOPIDY_GET_PLAYLISTS',
|
||||
uris,
|
||||
processor,
|
||||
};
|
||||
}
|
||||
|
||||
export function getDirectory(uri){
|
||||
return {
|
||||
type: 'MOPIDY_GET_DIRECTORY',
|
||||
data: { uri: uri }
|
||||
}
|
||||
export function getDirectory(uri) {
|
||||
return {
|
||||
type: 'MOPIDY_GET_DIRECTORY',
|
||||
data: { uri },
|
||||
};
|
||||
}
|
||||
|
||||
export function getTrack(uri){
|
||||
return {
|
||||
type: 'MOPIDY_GET_TRACK',
|
||||
data: { uri: uri }
|
||||
}
|
||||
export function getTrack(uri) {
|
||||
return {
|
||||
type: 'MOPIDY_GET_TRACK',
|
||||
data: { uri },
|
||||
};
|
||||
}
|
||||
|
||||
export function getLibraryArtists(uri = null){
|
||||
return {
|
||||
type: 'MOPIDY_GET_LIBRARY_ARTISTS',
|
||||
uri: uri
|
||||
}
|
||||
export function getLibraryArtists(uri = null) {
|
||||
return {
|
||||
type: 'MOPIDY_GET_LIBRARY_ARTISTS',
|
||||
uri,
|
||||
};
|
||||
}
|
||||
|
||||
export function clearLibraryArtists(){
|
||||
return {
|
||||
type: 'MOPIDY_CLEAR_LIBRARY_ARTISTS'
|
||||
}
|
||||
export function clearLibraryArtists() {
|
||||
return {
|
||||
type: 'MOPIDY_CLEAR_LIBRARY_ARTISTS',
|
||||
};
|
||||
}
|
||||
|
||||
export function getArtist(uri){
|
||||
return {
|
||||
type: 'MOPIDY_GET_ARTIST',
|
||||
data: { uri: uri }
|
||||
}
|
||||
export function getArtist(uri) {
|
||||
return {
|
||||
type: 'MOPIDY_GET_ARTIST',
|
||||
data: { uri },
|
||||
};
|
||||
}
|
||||
|
||||
export function getArtists(uris, processor = null){
|
||||
return {
|
||||
type: 'MOPIDY_GET_ARTISTS',
|
||||
uris: uris,
|
||||
processor: processor
|
||||
}
|
||||
export function getArtists(uris, processor = null) {
|
||||
return {
|
||||
type: 'MOPIDY_GET_ARTISTS',
|
||||
uris,
|
||||
processor,
|
||||
};
|
||||
}
|
||||
|
||||
export function getAlbum(uri){
|
||||
return {
|
||||
type: 'MOPIDY_GET_ALBUM',
|
||||
data: { uri: uri }
|
||||
}
|
||||
export function getAlbum(uri) {
|
||||
return {
|
||||
type: 'MOPIDY_GET_ALBUM',
|
||||
data: { uri },
|
||||
};
|
||||
}
|
||||
|
||||
export function getAlbums(uris, processor = null){
|
||||
return {
|
||||
type: 'MOPIDY_GET_ALBUMS',
|
||||
uris: uris,
|
||||
processor: processor
|
||||
}
|
||||
export function getAlbums(uris, processor = null) {
|
||||
return {
|
||||
type: 'MOPIDY_GET_ALBUMS',
|
||||
uris,
|
||||
processor,
|
||||
};
|
||||
}
|
||||
|
||||
export function getLibraryAlbums(uri = null){
|
||||
return {
|
||||
type: 'MOPIDY_GET_LIBRARY_ALBUMS',
|
||||
uri: uri
|
||||
}
|
||||
export function getLibraryAlbums(uri = null) {
|
||||
return {
|
||||
type: 'MOPIDY_GET_LIBRARY_ALBUMS',
|
||||
uri,
|
||||
};
|
||||
}
|
||||
|
||||
export function clearLibraryAlbums(){
|
||||
return {
|
||||
type: 'MOPIDY_CLEAR_LIBRARY_ALBUMS'
|
||||
}
|
||||
export function clearLibraryAlbums() {
|
||||
return {
|
||||
type: 'MOPIDY_CLEAR_LIBRARY_ALBUMS',
|
||||
};
|
||||
}
|
||||
|
||||
export function runProcessor(processor){
|
||||
return {
|
||||
type: processor
|
||||
}
|
||||
export function runProcessor(processor) {
|
||||
return {
|
||||
type: processor,
|
||||
};
|
||||
}
|
||||
|
||||
export function cancelProcessor(processor){
|
||||
return {
|
||||
type: processor+'_CANCEL'
|
||||
}
|
||||
export function cancelProcessor(processor) {
|
||||
return {
|
||||
type: `${processor}_CANCEL`,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Searching
|
||||
**/
|
||||
* */
|
||||
|
||||
export function clearSearchResults(){
|
||||
return {
|
||||
type: 'MOPIDY_CLEAR_SEARCH_RESULTS'
|
||||
}
|
||||
export function clearSearchResults() {
|
||||
return {
|
||||
type: 'MOPIDY_CLEAR_SEARCH_RESULTS',
|
||||
};
|
||||
}
|
||||
|
||||
export function getSearchResults(context, query, limit = 100){
|
||||
return {
|
||||
type: 'MOPIDY_GET_SEARCH_RESULTS',
|
||||
context: context,
|
||||
query: query,
|
||||
limit: limit
|
||||
}
|
||||
export function getSearchResults(context, query, limit = 100) {
|
||||
return {
|
||||
type: 'MOPIDY_GET_SEARCH_RESULTS',
|
||||
context,
|
||||
query,
|
||||
limit,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Other general actions
|
||||
**/
|
||||
* */
|
||||
|
||||
export function getQueueHistory(){
|
||||
return {
|
||||
type: 'MOPIDY_GET_QUEUE_HISTORY'
|
||||
}
|
||||
export function getQueueHistory() {
|
||||
return {
|
||||
type: 'MOPIDY_GET_QUEUE_HISTORY',
|
||||
};
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,217 +1,190 @@
|
||||
|
||||
import * as helpers from '../../helpers';
|
||||
|
||||
export default function reducer(mopidy = {}, action){
|
||||
switch (action.type){
|
||||
export default function reducer(mopidy = {}, action) {
|
||||
switch (action.type) {
|
||||
case 'MOPIDY_SET':
|
||||
return { ...mopidy, ...action.data };
|
||||
|
||||
case 'MOPIDY_SET':
|
||||
return Object.assign({}, mopidy, action.data);
|
||||
case 'MOPIDY_CONNECT':
|
||||
case 'MOPIDY_CONNECTING':
|
||||
return {
|
||||
...mopidy,
|
||||
connected: false,
|
||||
connecting: true,
|
||||
};
|
||||
|
||||
case 'MOPIDY_CONNECT':
|
||||
case 'MOPIDY_CONNECTING':
|
||||
return Object.assign({}, mopidy, {
|
||||
connected: false,
|
||||
connecting: true
|
||||
});
|
||||
|
||||
case 'MOPIDY_CONNECTED':
|
||||
return Object.assign({}, mopidy, {
|
||||
connected: true,
|
||||
case 'MOPIDY_CONNECTED':
|
||||
return {
|
||||
...mopidy,
|
||||
connected: true,
|
||||
connecting: false,
|
||||
restart_running: false,
|
||||
upgrade_running: false
|
||||
});
|
||||
upgrade_running: false,
|
||||
};
|
||||
|
||||
case 'MOPIDY_DISCONNECTED':
|
||||
return Object.assign({}, mopidy, {
|
||||
connected: false,
|
||||
connecting: false
|
||||
});
|
||||
case 'MOPIDY_DISCONNECTED':
|
||||
return {
|
||||
...mopidy,
|
||||
connected: false,
|
||||
connecting: false,
|
||||
};
|
||||
|
||||
case 'MOPIDY_CHANGE_TRACK':
|
||||
return Object.assign({}, mopidy, {
|
||||
tlid: action.tlid
|
||||
});
|
||||
case 'MOPIDY_CHANGE_TRACK':
|
||||
return { ...mopidy, tlid: action.tlid };
|
||||
|
||||
case 'MOPIDY_URI_SCHEMES':
|
||||
return Object.assign({}, mopidy, {
|
||||
uri_schemes: action.uri_schemes
|
||||
});
|
||||
case 'MOPIDY_URI_SCHEMES':
|
||||
return { ...mopidy, uri_schemes: action.uri_schemes };
|
||||
|
||||
case 'MOPIDY_RESTART_STARTED':
|
||||
return Object.assign({}, mopidy, { restart_running: true });
|
||||
case 'MOPIDY_RESTART_STARTED':
|
||||
return { ...mopidy, restart_running: true };
|
||||
|
||||
case 'MOPIDY_RESTART_FINISHED':
|
||||
return Object.assign({}, mopidy, { restart_running: false });
|
||||
case 'MOPIDY_RESTART_FINISHED':
|
||||
return { ...mopidy, restart_running: false };
|
||||
|
||||
case 'MOPIDY_UPGRADE_STARTED':
|
||||
return Object.assign({}, mopidy, { upgrade_running: true });
|
||||
case 'MOPIDY_UPGRADE_STARTED':
|
||||
return { ...mopidy, upgrade_running: true };
|
||||
|
||||
case 'MOPIDY_UPGRADE_FINISHED':
|
||||
return Object.assign({}, mopidy, { upgrade_running: false });
|
||||
case 'MOPIDY_UPGRADE_FINISHED':
|
||||
return { ...mopidy, upgrade_running: false };
|
||||
|
||||
case 'MOPIDY_LOCAL_SCAN_STARTED':
|
||||
return Object.assign({}, mopidy, { local_scan_running: true });
|
||||
case 'MOPIDY_LOCAL_SCAN_STARTED':
|
||||
return { ...mopidy, local_scan_running: true };
|
||||
|
||||
case 'MOPIDY_LOCAL_SCAN_FINISHED':
|
||||
return Object.assign({}, mopidy, { local_scan_running: false });
|
||||
case 'MOPIDY_LOCAL_SCAN_FINISHED':
|
||||
return { ...mopidy, local_scan_running: false };
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* State-oriented actions
|
||||
**/
|
||||
case 'MOPIDY_PLAY_STATE':
|
||||
return Object.assign({}, mopidy, {
|
||||
play_state: action.play_state
|
||||
});
|
||||
* */
|
||||
case 'MOPIDY_PLAY_STATE':
|
||||
return { ...mopidy, play_state: action.play_state };
|
||||
|
||||
case 'MOPIDY_CONSUME':
|
||||
return Object.assign({}, mopidy, {
|
||||
consume: action.consume
|
||||
});
|
||||
case 'MOPIDY_CONSUME':
|
||||
return { ...mopidy, consume: action.consume };
|
||||
|
||||
case 'MOPIDY_RANDOM':
|
||||
return Object.assign({}, mopidy, {
|
||||
random: action.random
|
||||
});
|
||||
case 'MOPIDY_RANDOM':
|
||||
return { ...mopidy, random: action.random };
|
||||
|
||||
case 'MOPIDY_REPEAT':
|
||||
return Object.assign({}, mopidy, {
|
||||
repeat: action.repeat
|
||||
});
|
||||
case 'MOPIDY_REPEAT':
|
||||
return { ...mopidy, repeat: action.repeat };
|
||||
|
||||
case 'MOPIDY_VOLUME':
|
||||
return Object.assign({}, mopidy, {
|
||||
volume: action.volume
|
||||
});
|
||||
case 'MOPIDY_VOLUME':
|
||||
return { ...mopidy, volume: action.volume };
|
||||
|
||||
case 'MOPIDY_MUTE':
|
||||
return Object.assign({}, mopidy, {
|
||||
mute: action.mute
|
||||
});
|
||||
case 'MOPIDY_MUTE':
|
||||
return { ...mopidy, mute: action.mute };
|
||||
|
||||
case 'MOPIDY_TIME_POSITION':
|
||||
return Object.assign({}, mopidy, {
|
||||
time_position: action.time_position
|
||||
});
|
||||
case 'MOPIDY_TIME_POSITION':
|
||||
return { ...mopidy, time_position: action.time_position };
|
||||
|
||||
case 'MOPIDY_QUEUE_HISTORY':
|
||||
var history = [];
|
||||
for (var i = 0; i < action.tracks.length; i++){
|
||||
history.push(Object.assign(
|
||||
{},
|
||||
action.tracks[i][1],
|
||||
{
|
||||
played_at: action.tracks[i][0],
|
||||
type: 'history'
|
||||
}
|
||||
))
|
||||
}
|
||||
return Object.assign({}, mopidy, {
|
||||
queue_history: history
|
||||
});
|
||||
case 'MOPIDY_QUEUE_HISTORY':
|
||||
var history = [];
|
||||
for (let i = 0; i < action.tracks.length; i++) {
|
||||
history.push({
|
||||
|
||||
...action.tracks[i][1],
|
||||
played_at: action.tracks[i][0],
|
||||
type: 'history',
|
||||
});
|
||||
}
|
||||
return { ...mopidy, queue_history: history };
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* Directories
|
||||
* This also facilitates all backend-only music providers (SoundCloud, Dirble, etc)
|
||||
**/
|
||||
* */
|
||||
|
||||
case 'MOPIDY_DIRECTORY_FLUSH':
|
||||
return Object.assign({}, mopidy, {
|
||||
directory: null
|
||||
});
|
||||
case 'MOPIDY_DIRECTORY_FLUSH':
|
||||
return { ...mopidy, directory: null };
|
||||
|
||||
case 'MOPIDY_DIRECTORY_LOADED':
|
||||
return Object.assign({}, mopidy, {
|
||||
directory: action.directory
|
||||
});
|
||||
case 'MOPIDY_DIRECTORY_LOADED':
|
||||
return { ...mopidy, directory: action.directory };
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* Library
|
||||
**/
|
||||
* */
|
||||
|
||||
case 'MOPIDY_LIBRARY_PLAYLISTS_LOADED':
|
||||
if (mopidy.library_playlists){
|
||||
var uris = [...mopidy.library_playlists,...action.uris]
|
||||
} else {
|
||||
var uris = action.uris
|
||||
}
|
||||
return Object.assign({}, mopidy, { library_playlists: helpers.removeDuplicates(uris) })
|
||||
case 'MOPIDY_LIBRARY_PLAYLISTS_LOADED':
|
||||
if (mopidy.library_playlists) {
|
||||
var uris = [...mopidy.library_playlists, ...action.uris];
|
||||
} else {
|
||||
var { uris } = action;
|
||||
}
|
||||
return { ...mopidy, library_playlists: helpers.removeDuplicates(uris) };
|
||||
|
||||
case 'MOPIDY_LIBRARY_PLAYLISTS_LOADED_ALL':
|
||||
return Object.assign({}, mopidy, { library_playlists_loaded_all: true })
|
||||
case 'MOPIDY_LIBRARY_PLAYLISTS_LOADED_ALL':
|
||||
return { ...mopidy, library_playlists_loaded_all: true };
|
||||
|
||||
case 'MOPIDY_LIBRARY_PLAYLIST_CREATED':
|
||||
var library_playlists = [];
|
||||
if (mopidy.library_playlists){
|
||||
library_playlists = Object.assign([], mopidy.library_playlists);
|
||||
}
|
||||
library_playlists.push(action.key);
|
||||
return Object.assign({}, mopidy, { library_playlists: library_playlists })
|
||||
case 'MOPIDY_LIBRARY_PLAYLIST_CREATED':
|
||||
var library_playlists = [];
|
||||
if (mopidy.library_playlists) {
|
||||
library_playlists = Object.assign([], mopidy.library_playlists);
|
||||
}
|
||||
library_playlists.push(action.key);
|
||||
return { ...mopidy, library_playlists };
|
||||
|
||||
case 'MOPIDY_LIBRARY_PLAYLIST_DELETED':
|
||||
var library_playlists = []
|
||||
if (mopidy.library_playlists){
|
||||
library_playlists = Object.assign([], mopidy.library_playlists);
|
||||
library_playlists.splice(library_playlists.indexOf(action.uri), 1);
|
||||
}
|
||||
return Object.assign({}, mopidy, { library_playlists: library_playlists })
|
||||
case 'MOPIDY_LIBRARY_PLAYLIST_DELETED':
|
||||
var library_playlists = [];
|
||||
if (mopidy.library_playlists) {
|
||||
library_playlists = Object.assign([], mopidy.library_playlists);
|
||||
library_playlists.splice(library_playlists.indexOf(action.uri), 1);
|
||||
}
|
||||
return { ...mopidy, library_playlists };
|
||||
|
||||
case 'MOPIDY_LIBRARY_ARTISTS_LOADED':
|
||||
if (mopidy.library_artists){
|
||||
var uris = [...mopidy.library_artists,...action.uris]
|
||||
} else {
|
||||
var uris = action.uris
|
||||
}
|
||||
return Object.assign({}, mopidy, { library_artists: helpers.removeDuplicates(uris) })
|
||||
case 'MOPIDY_LIBRARY_ARTISTS_LOADED':
|
||||
if (mopidy.library_artists) {
|
||||
var uris = [...mopidy.library_artists, ...action.uris];
|
||||
} else {
|
||||
var { uris } = action;
|
||||
}
|
||||
return { ...mopidy, library_artists: helpers.removeDuplicates(uris) };
|
||||
|
||||
case 'MOPIDY_CLEAR_LIBRARY_ARTISTS':
|
||||
return Object.assign({}, mopidy, { library_artists: null })
|
||||
case 'MOPIDY_CLEAR_LIBRARY_ARTISTS':
|
||||
return { ...mopidy, library_artists: null };
|
||||
|
||||
case 'MOPIDY_LIBRARY_ALBUMS_LOADED':
|
||||
if (mopidy.library_albums){
|
||||
var uris = [...mopidy.library_albums,...action.uris]
|
||||
} else {
|
||||
var uris = action.uris
|
||||
}
|
||||
return Object.assign({}, mopidy, { library_albums: helpers.removeDuplicates(uris) })
|
||||
case 'MOPIDY_LIBRARY_ALBUMS_LOADED':
|
||||
if (mopidy.library_albums) {
|
||||
var uris = [...mopidy.library_albums, ...action.uris];
|
||||
} else {
|
||||
var { uris } = action;
|
||||
}
|
||||
return { ...mopidy, library_albums: helpers.removeDuplicates(uris) };
|
||||
|
||||
case 'MOPIDY_CLEAR_LIBRARY_ALBUMS':
|
||||
return Object.assign({}, mopidy, { library_albums: null })
|
||||
case 'MOPIDY_CLEAR_LIBRARY_ALBUMS':
|
||||
return { ...mopidy, library_albums: null };
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* Searching
|
||||
**/
|
||||
* */
|
||||
|
||||
case 'MOPIDY_CLEAR_SEARCH_RESULTS':
|
||||
return Object.assign({}, mopidy, { search_results: {} });
|
||||
case 'MOPIDY_CLEAR_SEARCH_RESULTS':
|
||||
return { ...mopidy, search_results: {} };
|
||||
|
||||
case 'MOPIDY_SEARCH_RESULTS_LOADED':
|
||||
case 'MOPIDY_SEARCH_RESULTS_LOADED':
|
||||
|
||||
// Fetch or create our container
|
||||
if (mopidy.search_results){
|
||||
var search_results = Object.assign({}, mopidy.search_results);
|
||||
} else {
|
||||
var search_results = {};
|
||||
}
|
||||
// Fetch or create our container
|
||||
if (mopidy.search_results) {
|
||||
var search_results = { ...mopidy.search_results };
|
||||
} else {
|
||||
var search_results = {};
|
||||
}
|
||||
|
||||
search_results.query = action.query;
|
||||
search_results.query = action.query;
|
||||
|
||||
if (search_results[action.context]){
|
||||
search_results[action.context] = [...search_results[action.context], ...action.results];
|
||||
} else {
|
||||
search_results[action.context] = action.results;
|
||||
}
|
||||
if (search_results[action.context]) {
|
||||
search_results[action.context] = [...search_results[action.context], ...action.results];
|
||||
} else {
|
||||
search_results[action.context] = action.results;
|
||||
}
|
||||
|
||||
return Object.assign({}, mopidy, { search_results: search_results });
|
||||
return { ...mopidy, search_results };
|
||||
|
||||
default:
|
||||
return mopidy
|
||||
}
|
||||
default:
|
||||
return mopidy;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user