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

View file

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

View file

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

View file

@ -46,7 +46,7 @@ async function idle() {
if (current) { return; } if (current) { return; }
canTerminateIdle = true; 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; canTerminateIdle = false;
let changed = parser.linesToStruct(lines).changed || []; let changed = parser.linesToStruct(lines).changed || [];
changed = [].concat(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() { export async function status() {
let lines = await command("status"); let lines = await command("status");
return parser.linesToStruct(lines); return parser.linesToStruct(lines);

View file

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