mixer idling

This commit is contained in:
Ondřej Žára 2020-05-09 10:55:41 +02:00
parent 7ed5317756
commit 0b96e4da31
5 changed files with 9 additions and 37 deletions

View File

@ -283,7 +283,7 @@ async function idle() {
if (current) { return; }
canTerminateIdle = true;
let lines = await command("idle stored_playlist playlist player options");
let lines = await command("idle stored_playlist playlist player options mixer");
canTerminateIdle = false;
let changed = linesToStruct(lines).changed || [];
changed = [].concat(changed);
@ -305,12 +305,6 @@ async function command(cmd) {
});
}
async function commandAndStatus(...args) {
args.push("status");
let lines = await command(args);
return linesToStruct(lines);
}
async function status() {
let lines = await command("status");
return linesToStruct(lines);
@ -425,7 +419,6 @@ async function init(a) {
var mpd = /*#__PURE__*/Object.freeze({
__proto__: null,
command: command,
commandAndStatus: commandAndStatus,
status: status,
currentSong: currentSong,
listQueue: listQueue,
@ -453,10 +446,6 @@ function status$1() {
}
}
function commandAndStatus$1() {
return status$1();
}
function currentSong$1() {
return {
duration: 70,
@ -525,7 +514,6 @@ var mpdMock = /*#__PURE__*/Object.freeze({
__proto__: null,
command: command$1,
status: status$1,
commandAndStatus: commandAndStatus$1,
currentSong: currentSong$1,
listQueue: listQueue$1,
listPlaylists: listPlaylists$1,
@ -979,7 +967,8 @@ class Player extends Component {
case "idle-change":
let hasOptions = e.detail.includes("options");
let hasPlayer = e.detail.includes("player");
(hasOptions || hasPlayer) && this._updateStatus();
let hasMixer = e.detail.includes("mixer");
(hasOptions || hasPlayer || hasMixer) && this._updateStatus();
hasPlayer && this._updateCurrent();
break;
}
@ -1114,11 +1103,7 @@ class Player extends Component {
});
DOM.volume.addEventListener("input", e => this._app.mpd.command(`setvol ${e.target.valueAsNumber}`));
DOM.mute.addEventListener("click", async _ => {
let data = await this._app.mpd.commandAndStatus(`setvol ${this._toggleVolume}`);
this._updateFlags(data);
this._updateVolume(data);
});
DOM.mute.addEventListener("click", _ => this._app.mpd.command(`setvol ${this._toggleVolume}`));
}
_dispatchSongChange(detail) {

View File

@ -31,7 +31,8 @@ class Player extends Component {
case "idle-change":
let hasOptions = e.detail.includes("options");
let hasPlayer = e.detail.includes("player");
(hasOptions || hasPlayer) && this._updateStatus();
let hasMixer = e.detail.includes("mixer");
(hasOptions || hasPlayer || hasMixer) && this._updateStatus();
hasPlayer && this._updateCurrent();
break;
}
@ -166,11 +167,7 @@ class Player extends Component {
});
DOM.volume.addEventListener("input", e => this._app.mpd.command(`setvol ${e.target.valueAsNumber}`));
DOM.mute.addEventListener("click", async _ => {
let data = await this._app.mpd.commandAndStatus(`setvol ${this._toggleVolume}`);
this._updateFlags(data);
this._updateVolume(data);
});
DOM.mute.addEventListener("click", _ => this._app.mpd.command(`setvol ${this._toggleVolume}`));
}
_dispatchSongChange(detail) {

View File

@ -11,10 +11,6 @@ export function status() {
}
}
export function commandAndStatus() {
return status();
}
export function currentSong() {
return {
duration: 70,

View File

@ -46,7 +46,7 @@ async function idle() {
if (current) { return; }
canTerminateIdle = true;
let lines = await command("idle stored_playlist playlist player options");
let lines = await command("idle stored_playlist playlist player options mixer");
canTerminateIdle = false;
let changed = parser.linesToStruct(lines).changed || [];
changed = [].concat(changed);
@ -68,12 +68,6 @@ export async function command(cmd) {
});
}
export async function commandAndStatus(...args) {
args.push("status");
let lines = await command(args);
return parser.linesToStruct(lines);
}
export async function status() {
let lines = await command("status");
return parser.linesToStruct(lines);

View File

@ -6,7 +6,7 @@
"dependencies": {
"custom-range": "^1.1.0",
"node-static": "^0.7.11",
"ws2mpd": "^2.2.0"
"ws2mpd": "^2.2.1"
},
"devDependencies": {
"less": "^3.9.0",