2020-03-03 16:39:37 +13:00
|
|
|
import { createRange } from '../../util/arrays';
|
2020-04-28 21:24:17 +12:00
|
|
|
import { generateGuid } from '../../util/helpers';
|
2016-10-14 22:42:45 +13:00
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function set(data) {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_SET',
|
|
|
|
|
data,
|
|
|
|
|
};
|
2016-10-14 22:42:45 +13:00
|
|
|
}
|
|
|
|
|
|
2020-04-26 22:04:39 +12:00
|
|
|
export function updateServer(server) {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_UPDATE_SERVER',
|
|
|
|
|
server,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-28 21:24:17 +12:00
|
|
|
export function updateServers(servers) {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_UPDATE_SERVERS',
|
|
|
|
|
servers,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function addServer() {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_UPDATE_SERVER',
|
|
|
|
|
server: {
|
|
|
|
|
id: generateGuid(),
|
|
|
|
|
name: 'New server',
|
|
|
|
|
host: window.location.hostname,
|
|
|
|
|
port: (window.location.port ? window.location.port : (window.location.protocol === 'https:' ? '443' : '80')),
|
2020-04-30 15:45:55 +12:00
|
|
|
ssl: window.location.protocol === 'https:',
|
|
|
|
|
},
|
2020-04-28 21:24:17 +12:00
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function setCurrentServer(server) {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_SET_CURRENT_SERVER',
|
|
|
|
|
server,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function removeServer(id) {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_REMOVE_SERVER',
|
|
|
|
|
id,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-05 16:05:49 +13:00
|
|
|
export function setConnection(data) {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_SET_CONNECTION',
|
|
|
|
|
data,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function request(method, params = {}, response_callback = null, error_callback = null) {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_REQUEST',
|
|
|
|
|
method,
|
|
|
|
|
params,
|
|
|
|
|
response_callback,
|
|
|
|
|
error_callback,
|
|
|
|
|
};
|
2018-09-24 16:10:42 +12:00
|
|
|
}
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function connect() {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_CONNECT',
|
|
|
|
|
};
|
2016-10-16 12:37:37 +13:00
|
|
|
}
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function connecting() {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_CONNECTING',
|
|
|
|
|
};
|
2018-04-17 15:58:39 +12:00
|
|
|
}
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function disconnect() {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_DISCONNECT',
|
|
|
|
|
};
|
2018-04-17 15:58:39 +12:00
|
|
|
}
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function debug(call, value) {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_DEBUG',
|
|
|
|
|
call,
|
|
|
|
|
value,
|
|
|
|
|
};
|
2018-04-17 15:58:39 +12:00
|
|
|
}
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function restartStarted() {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_RESTART_STARTED',
|
|
|
|
|
};
|
2016-10-18 08:56:53 +13:00
|
|
|
}
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function restartFinished() {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_RESTART_FINISHED',
|
|
|
|
|
};
|
2018-11-02 16:10:38 +13:00
|
|
|
}
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function upgradeStarted() {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_UPGRADE_STARTED',
|
|
|
|
|
};
|
2018-11-02 16:10:38 +13:00
|
|
|
}
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function upgradeFinished() {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_UPGRADE_FINISHED',
|
|
|
|
|
};
|
2018-11-02 16:10:38 +13:00
|
|
|
}
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function localScanStarted() {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_LOCAL_SCAN_STARTED',
|
|
|
|
|
};
|
2018-11-02 16:10:38 +13:00
|
|
|
}
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function localScanFinished() {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_LOCAL_SCAN_FINISHED',
|
|
|
|
|
};
|
2016-12-05 10:20:01 +13:00
|
|
|
}
|
|
|
|
|
|
2018-02-26 10:25:56 +13:00
|
|
|
/**
|
|
|
|
|
* Core play actions
|
2019-09-05 15:36:11 +12:00
|
|
|
* */
|
2018-02-26 10:25:56 +13:00
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function getPlayState() {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_GET_PLAY_STATE',
|
|
|
|
|
};
|
2018-02-26 10:25:56 +13:00
|
|
|
}
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function play() {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_PLAY',
|
|
|
|
|
};
|
2018-02-26 10:25:56 +13:00
|
|
|
}
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function pause() {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_PAUSE',
|
|
|
|
|
};
|
2018-02-26 10:25:56 +13:00
|
|
|
}
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function stop() {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_STOP',
|
|
|
|
|
};
|
2018-02-26 10:25:56 +13:00
|
|
|
}
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function next() {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_NEXT',
|
|
|
|
|
};
|
2018-02-26 10:25:56 +13:00
|
|
|
}
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function previous() {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_PREVIOUS',
|
|
|
|
|
};
|
2018-02-26 10:25:56 +13:00
|
|
|
}
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function getMute() {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_GET_MUTE',
|
|
|
|
|
};
|
2018-02-26 10:25:56 +13:00
|
|
|
}
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function setMute(mute) {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_SET_MUTE',
|
|
|
|
|
mute,
|
|
|
|
|
};
|
2018-02-26 10:25:56 +13:00
|
|
|
}
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function getVolume() {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_GET_VOLUME',
|
|
|
|
|
};
|
2018-02-26 10:25:56 +13:00
|
|
|
}
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function setVolume(volume) {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_SET_VOLUME',
|
|
|
|
|
volume,
|
|
|
|
|
};
|
2018-02-26 10:25:56 +13:00
|
|
|
}
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function getConsume() {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_GET_CONSUME',
|
|
|
|
|
};
|
2018-02-26 10:25:56 +13:00
|
|
|
}
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function setConsume(consume) {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_SET_CONSUME',
|
|
|
|
|
consume,
|
|
|
|
|
};
|
2018-02-26 10:25:56 +13:00
|
|
|
}
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function getRepeat() {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_GET_REPEAT',
|
|
|
|
|
};
|
2018-02-26 10:25:56 +13:00
|
|
|
}
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function setRepeat(repeat) {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_SET_REPEAT',
|
|
|
|
|
repeat,
|
|
|
|
|
};
|
2018-02-26 10:25:56 +13:00
|
|
|
}
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function getRandom() {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_GET_RANDOM',
|
|
|
|
|
};
|
2018-02-26 10:25:56 +13:00
|
|
|
}
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function setRandom(random) {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_SET_RANDOM',
|
|
|
|
|
random,
|
|
|
|
|
};
|
2018-02-26 10:25:56 +13:00
|
|
|
}
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function getTimePosition() {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_GET_TIME_POSITION',
|
|
|
|
|
};
|
2018-02-26 10:25:56 +13:00
|
|
|
}
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function setTimePosition(time_position) {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_SET_TIME_POSITION',
|
|
|
|
|
time_position: parseInt(time_position),
|
|
|
|
|
};
|
2018-02-26 10:25:56 +13:00
|
|
|
}
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function timePosition(time_position) {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_TIME_POSITION',
|
|
|
|
|
time_position: parseInt(time_position),
|
|
|
|
|
};
|
2018-02-26 10:25:56 +13:00
|
|
|
}
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function getUriSchemes() {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_GET_URI_SCHEMES',
|
|
|
|
|
};
|
2018-02-26 10:25:56 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2016-10-21 23:27:50 +13:00
|
|
|
/**
|
2018-02-26 10:25:56 +13:00
|
|
|
* Advanced playback actions
|
2019-09-05 15:36:11 +12:00
|
|
|
* */
|
2016-10-21 23:27:50 +13:00
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function getCurrentTrack() {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_GET_CURRENT_TRACK',
|
|
|
|
|
};
|
2018-02-26 10:25:56 +13:00
|
|
|
}
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function currentTrackLoaded(tl_track) {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_CURRENT_TRACK_LOADED',
|
|
|
|
|
tl_track,
|
|
|
|
|
};
|
2018-04-11 16:44:41 +12:00
|
|
|
}
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function getNextTrack() {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_GET_NEXT_TRACK',
|
|
|
|
|
};
|
2018-04-12 15:55:39 +12:00
|
|
|
}
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function clearCurrentTrack() {
|
|
|
|
|
return {
|
|
|
|
|
type: 'CLEAR_CURRENT_TRACK',
|
|
|
|
|
};
|
2018-04-01 22:06:02 +12:00
|
|
|
}
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function getQueue() {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_GET_QUEUE',
|
|
|
|
|
};
|
2018-02-26 10:25:56 +13:00
|
|
|
}
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function changeTrack(tlid) {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_CHANGE_TRACK',
|
|
|
|
|
tlid,
|
|
|
|
|
};
|
2016-10-16 12:37:37 +13:00
|
|
|
}
|
|
|
|
|
|
2019-03-18 16:26:16 +13:00
|
|
|
/**
|
|
|
|
|
* Playing assets
|
2019-09-05 15:36:11 +12:00
|
|
|
* */
|
2019-03-18 16:26:16 +13:00
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function playURIs(uris = [], from_uri = null, shuffle = false) {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_PLAY_URIS',
|
|
|
|
|
uris,
|
|
|
|
|
from_uri,
|
2020-01-10 09:49:44 +13:00
|
|
|
shuffle,
|
2019-09-05 15:36:11 +12:00
|
|
|
};
|
2016-10-20 21:38:01 +13:00
|
|
|
}
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function playAlbum(uri) {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_PLAY_ALBUM',
|
|
|
|
|
uri,
|
|
|
|
|
};
|
2019-03-18 16:26:16 +13:00
|
|
|
}
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function playPlaylist(uri, shuffle = false) {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_PLAY_PLAYLIST',
|
|
|
|
|
uri,
|
|
|
|
|
shuffle,
|
|
|
|
|
};
|
2019-03-18 16:26:16 +13:00
|
|
|
}
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
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,
|
|
|
|
|
};
|
2016-10-19 14:09:34 +13:00
|
|
|
}
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function enqueueAlbum(uri, next = false, at_position = null) {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_ENQUEUE_ALBUM',
|
|
|
|
|
uri,
|
|
|
|
|
next,
|
|
|
|
|
at_position,
|
|
|
|
|
};
|
2017-05-05 03:56:55 +12:00
|
|
|
}
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function enqueuePlaylist(uri, play_next = false, at_position = null) {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_ENQUEUE_PLAYLIST',
|
|
|
|
|
uri,
|
|
|
|
|
play_next,
|
|
|
|
|
at_position,
|
|
|
|
|
};
|
2017-04-07 10:33:54 +12:00
|
|
|
}
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function enqueueURIsBatchDone() {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_ENQUEUE_URIS_BATCH_DONE',
|
|
|
|
|
};
|
2019-03-18 16:26:16 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Playlist maniopulation
|
2019-09-05 15:36:11 +12:00
|
|
|
* */
|
2019-03-18 16:26:16 +13:00
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function removeTracks(tlids) {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_REMOVE_TRACKS',
|
|
|
|
|
tlids,
|
|
|
|
|
};
|
2016-10-14 22:42:45 +13:00
|
|
|
}
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function reorderTracklist(indexes, insert_before) {
|
2020-03-03 16:39:37 +13:00
|
|
|
const range = createRange(indexes);
|
2019-09-05 15:36:11 +12:00
|
|
|
if (insert_before > range.start) insert_before -= range.length;
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_REORDER_TRACKLIST',
|
|
|
|
|
range_start: range.start,
|
|
|
|
|
range_length: range.length,
|
|
|
|
|
insert_before,
|
|
|
|
|
};
|
2016-11-16 16:30:49 +13:00
|
|
|
}
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function clearTracklist() {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_CLEAR_TRACKLIST',
|
|
|
|
|
};
|
2017-01-22 12:54:20 +13:00
|
|
|
}
|
|
|
|
|
|
2020-04-19 20:57:43 +12:00
|
|
|
export function shuffleTracklist() {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_SHUFFLE_TRACKLIST',
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-21 23:27:50 +13:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Asset-oriented actions
|
2019-09-05 15:36:11 +12:00
|
|
|
* */
|
2016-10-21 23:27:50 +13:00
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function getImages(context, uris) {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_GET_IMAGES',
|
|
|
|
|
context,
|
|
|
|
|
uris,
|
|
|
|
|
};
|
2017-08-03 15:26:54 +12:00
|
|
|
}
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function createPlaylist(name, scheme) {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_CREATE_PLAYLIST',
|
|
|
|
|
name,
|
|
|
|
|
scheme,
|
|
|
|
|
};
|
2017-08-22 20:44:36 +12:00
|
|
|
}
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function deletePlaylist(uri) {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_DELETE_PLAYLIST',
|
|
|
|
|
uri,
|
|
|
|
|
};
|
2016-11-14 11:20:02 +13:00
|
|
|
}
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function getLibraryPlaylists() {
|
|
|
|
|
return { type: 'MOPIDY_GET_LIBRARY_PLAYLISTS' };
|
2016-10-21 23:27:50 +13:00
|
|
|
}
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function getPlaylist(uri) {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_GET_PLAYLIST',
|
|
|
|
|
data: { uri },
|
|
|
|
|
};
|
2016-11-01 07:37:18 +13:00
|
|
|
}
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function getPlaylists(uris, processor = null) {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_GET_PLAYLISTS',
|
|
|
|
|
uris,
|
|
|
|
|
processor,
|
|
|
|
|
};
|
2017-08-13 21:42:19 +12:00
|
|
|
}
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function getDirectory(uri) {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_GET_DIRECTORY',
|
2020-01-22 21:21:49 +13:00
|
|
|
uri,
|
2019-09-05 15:36:11 +12:00
|
|
|
};
|
2016-11-01 11:49:04 +13:00
|
|
|
}
|
|
|
|
|
|
2020-08-03 20:42:17 +12:00
|
|
|
export function getTracks(uris, get_images) {
|
2019-09-05 15:36:11 +12:00
|
|
|
return {
|
2020-08-03 20:42:17 +12:00
|
|
|
type: 'MOPIDY_GET_TRACKS',
|
|
|
|
|
uris,
|
|
|
|
|
get_images,
|
2019-09-05 15:36:11 +12:00
|
|
|
};
|
2017-10-10 11:50:29 +13:00
|
|
|
}
|
|
|
|
|
|
2020-08-03 20:42:17 +12:00
|
|
|
export function getTrack(uri) {
|
|
|
|
|
return getTracks([uri], true);
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function getLibraryArtists(uri = null) {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_GET_LIBRARY_ARTISTS',
|
|
|
|
|
uri,
|
|
|
|
|
};
|
2017-08-13 21:42:19 +12:00
|
|
|
}
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function clearLibraryArtists() {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_CLEAR_LIBRARY_ARTISTS',
|
|
|
|
|
};
|
2018-06-10 10:02:31 +12:00
|
|
|
}
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function getArtist(uri) {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_GET_ARTIST',
|
2020-01-18 07:32:44 +13:00
|
|
|
uri,
|
2019-09-05 15:36:11 +12:00
|
|
|
};
|
2016-11-01 16:41:04 +13:00
|
|
|
}
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function getArtists(uris, processor = null) {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_GET_ARTISTS',
|
|
|
|
|
uris,
|
|
|
|
|
processor,
|
|
|
|
|
};
|
2016-11-01 19:27:59 +13:00
|
|
|
}
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function getAlbum(uri) {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_GET_ALBUM',
|
2020-01-22 21:21:49 +13:00
|
|
|
uri,
|
2019-09-05 15:36:11 +12:00
|
|
|
};
|
2017-01-15 21:06:24 +13:00
|
|
|
}
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function getAlbums(uris, processor = null) {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_GET_ALBUMS',
|
|
|
|
|
uris,
|
|
|
|
|
processor,
|
|
|
|
|
};
|
2017-01-26 08:51:35 +13:00
|
|
|
}
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function getLibraryAlbums(uri = null) {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_GET_LIBRARY_ALBUMS',
|
|
|
|
|
uri,
|
|
|
|
|
};
|
2016-11-02 16:51:00 +13:00
|
|
|
}
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function clearLibraryAlbums() {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_CLEAR_LIBRARY_ALBUMS',
|
|
|
|
|
};
|
2018-06-10 10:02:31 +12:00
|
|
|
}
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function runProcessor(processor) {
|
|
|
|
|
return {
|
|
|
|
|
type: processor,
|
|
|
|
|
};
|
2017-08-10 12:00:08 +12:00
|
|
|
}
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function cancelProcessor(processor) {
|
|
|
|
|
return {
|
|
|
|
|
type: `${processor}_CANCEL`,
|
|
|
|
|
};
|
2017-08-10 12:00:08 +12:00
|
|
|
}
|
|
|
|
|
|
2020-08-03 20:42:17 +12:00
|
|
|
export function view_getRandomTracks(limit = 100) {
|
2020-08-03 07:08:16 +12:00
|
|
|
return {
|
2020-08-03 20:42:17 +12:00
|
|
|
type: 'VIEW__GET_RANDOM_TRACKS',
|
2020-08-03 07:08:16 +12:00
|
|
|
limit,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2016-11-06 18:29:49 +13:00
|
|
|
|
|
|
|
|
/**
|
2017-03-24 23:05:43 +13:00
|
|
|
* Searching
|
2019-09-05 15:36:11 +12:00
|
|
|
* */
|
2016-11-06 18:29:49 +13:00
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function clearSearchResults() {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_CLEAR_SEARCH_RESULTS',
|
|
|
|
|
};
|
2017-09-05 08:26:04 +12:00
|
|
|
}
|
|
|
|
|
|
2020-06-18 21:06:52 +12:00
|
|
|
export function getSearchResults(type, term, limit = 100) {
|
2019-09-05 15:36:11 +12:00
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_GET_SEARCH_RESULTS',
|
2020-06-18 21:06:52 +12:00
|
|
|
query: { type, term },
|
2019-09-05 15:36:11 +12:00
|
|
|
limit,
|
|
|
|
|
};
|
2017-03-24 23:05:43 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Other general actions
|
2019-09-05 15:36:11 +12:00
|
|
|
* */
|
2017-03-24 23:05:43 +13:00
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
export function getQueueHistory() {
|
|
|
|
|
return {
|
|
|
|
|
type: 'MOPIDY_GET_QUEUE_HISTORY',
|
|
|
|
|
};
|
2017-02-10 09:06:41 +13:00
|
|
|
}
|