punktdateien/kde/plasma/plasmoids/com.siezi.plasma.mpdWidget/contents/logic/ExecMpc.qml

22 lines
531 B
QML
Raw Normal View History

2024-02-14 21:14:16 +01:00
ExecGeneric {
id: root
/**
* Executes mpc commands
*
* @param {string} command Command to execute
* @param {function} callback Callback to execute after the command
*/
function execMpc(command, callback) {
if (mpcAvailable !== true || mpcConnectionAvailable !== true) {
return
}
let cmd = ["mpc"]
if (cfgMpdHost !== "") {
cmd.push("--host=" + cfgMpdHost)
}
cmd.push(command)
exec(cmd.join(" "), callback)
}
}