mirror of
https://github.com/onyx-and-iris/meld-cli.git
synced 2025-07-12 02:11:46 +00:00
add virtualcam toggle
This commit is contained in:
parent
90bf51f363
commit
6545221ccc
19
index.js
19
index.js
@ -8,8 +8,9 @@ import { sceneHelp, sceneList, sceneSwitch, sceneCurrent } from './utils/scene.j
|
||||
import { audioHelp, audioList, audioMute, audioUnmute, audioToggle, audioStatus } from './utils/audio.js'
|
||||
import { streamHelp, streamStart, streamStop, streamToggle, streamStatus } from './utils/stream.js'
|
||||
import { recordHelp, recordStart, recordStop, recordToggle, recordStatus } from './utils/record.js'
|
||||
import { clipHelp, saveClip } from './utils/clip.js'
|
||||
import { screenshotHelp, takeScreenshot } from './utils/screenshot.js'
|
||||
import { clipHelp, clipSave } from './utils/clip.js'
|
||||
import { screenshotHelp, screenshotTake } from './utils/screenshot.js'
|
||||
import { virtualcamHelp, virtualcamToggle } from './utils/virtualcam.js'
|
||||
|
||||
const input = cli.input
|
||||
const flags = cli.flags
|
||||
@ -66,7 +67,8 @@ socket.onopen = function () {
|
||||
stream: streamHelp,
|
||||
record: recordHelp,
|
||||
clip: clipHelp,
|
||||
screenshot: screenshotHelp
|
||||
screenshot: screenshotHelp,
|
||||
virtualcam: virtualcamHelp
|
||||
}
|
||||
|
||||
if (flags.help && helpMap[command]) {
|
||||
@ -170,17 +172,24 @@ socket.onopen = function () {
|
||||
} else if (command === 'clip') {
|
||||
const clipCommand = input[1]
|
||||
if (clipCommand === 'save') {
|
||||
withChannel(socket, (channel) => saveClip(channel))
|
||||
withChannel(socket, (channel) => clipSave(channel))
|
||||
} else {
|
||||
printHelp(clipHelp)
|
||||
}
|
||||
} else if (command === 'screenshot') {
|
||||
const screenshotCommand = input[1]
|
||||
if (screenshotCommand === 'take') {
|
||||
withChannel(socket, (channel) => takeScreenshot(channel))
|
||||
withChannel(socket, (channel) => screenshotTake(channel))
|
||||
} else {
|
||||
printHelp(screenshotHelp)
|
||||
}
|
||||
} else if (command === 'virtualcam') {
|
||||
const virtualcamCommand = input[1]
|
||||
if (virtualcamCommand === 'toggle') {
|
||||
withChannel(socket, (channel) => virtualcamToggle(channel))
|
||||
} else {
|
||||
printHelp(virtualcamHelp)
|
||||
}
|
||||
} else {
|
||||
printHelp(cli.help)
|
||||
socket.close()
|
||||
|
@ -49,11 +49,6 @@
|
||||
"docs",
|
||||
"doc"
|
||||
],
|
||||
"env": {
|
||||
"browser": true,
|
||||
"node": true,
|
||||
"es2021": true
|
||||
},
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 12,
|
||||
"sourceType": "module"
|
||||
|
@ -19,6 +19,9 @@ const commands = {
|
||||
},
|
||||
screenshot: {
|
||||
desc: 'Take a screenshot'
|
||||
},
|
||||
virtualcam: {
|
||||
desc: 'Manage virtual camera settings'
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,9 +18,9 @@ const clipHelp = meowHelp({
|
||||
defaults: false
|
||||
})
|
||||
|
||||
async function saveClip (channel) {
|
||||
async function clipSave (channel) {
|
||||
await channel.objects.meld.sendCommand('meld.recordClip')
|
||||
return 'Clip command sent successfully.'
|
||||
return 'Clip saved successfully.'
|
||||
}
|
||||
|
||||
export { clipHelp, saveClip }
|
||||
export { clipHelp, clipSave }
|
||||
|
@ -18,9 +18,9 @@ const screenshotHelp = meowHelp({
|
||||
defaults: false
|
||||
})
|
||||
|
||||
async function takeScreenshot (channel) {
|
||||
async function screenshotTake (channel) {
|
||||
await channel.objects.meld.sendCommand('meld.screenshot')
|
||||
return 'Screenshot command sent successfully.'
|
||||
return 'Screenshot taken successfully.'
|
||||
}
|
||||
|
||||
export { screenshotHelp, takeScreenshot }
|
||||
export { screenshotHelp, screenshotTake }
|
||||
|
30
utils/virtualcam.js
Normal file
30
utils/virtualcam.js
Normal file
@ -0,0 +1,30 @@
|
||||
import meowHelp from 'cli-meow-help'
|
||||
|
||||
const commands = {
|
||||
toggle: {
|
||||
desc: 'Toggle the virtual camera on or off'
|
||||
}
|
||||
}
|
||||
|
||||
const flags = {
|
||||
help: {
|
||||
type: 'boolean',
|
||||
shortFlag: 'h',
|
||||
desc: 'Display help information'
|
||||
}
|
||||
}
|
||||
|
||||
const virtualcamHelp = meowHelp({
|
||||
name: 'virtualcam',
|
||||
flags,
|
||||
commands,
|
||||
desc: 'Manage virtual camera settings in Meld',
|
||||
defaults: false
|
||||
})
|
||||
|
||||
async function virtualcamToggle (channel) {
|
||||
await channel.objects.meld.sendCommand('meld.toggleVirtualCameraAction')
|
||||
return 'Virtual camera toggled successfully.'
|
||||
}
|
||||
|
||||
export { virtualcamHelp, virtualcamToggle }
|
Loading…
x
Reference in New Issue
Block a user