@raphiiko/wavelink-cli 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -5642,12 +5642,7 @@ async function setSingleOutputForMix(client, deviceId, mixId) {
5642
5642
  const mix = await requireMix(client, mixId);
5643
5643
  const targetDevice = await requireOutputDevice(client, deviceId);
5644
5644
  const { outputDevices } = await client.getOutputDevices();
5645
- const { mixes } = await client.getMixes();
5646
- const otherMix = mixes.find((m) => m.id !== mix.id);
5647
- if (!otherMix) {
5648
- exitWithError("Cannot use 'single' command with only one mix available. At least two mixes are required.");
5649
- }
5650
- let devicesReassigned = 0;
5645
+ let devicesRemoved = 0;
5651
5646
  let targetDeviceAssigned = false;
5652
5647
  for (const device of outputDevices) {
5653
5648
  for (const output of device.outputs) {
@@ -5656,17 +5651,17 @@ async function setSingleOutputForMix(client, deviceId, mixId) {
5656
5651
  await client.switchOutputMix(device.id, output.id, mix.id);
5657
5652
  targetDeviceAssigned = true;
5658
5653
  } else if (!isTargetDevice && output.mixId === mix.id) {
5659
- await client.switchOutputMix(device.id, output.id, otherMix.id);
5660
- devicesReassigned++;
5654
+ await client.removeOutputFromMix(device.id, output.id);
5655
+ devicesRemoved++;
5661
5656
  }
5662
5657
  }
5663
5658
  }
5664
- if (targetDeviceAssigned && devicesReassigned > 0) {
5665
- console.log(`Successfully set '${targetDevice.deviceId}' as the only output for mix '${mix.name}' ` + `(reassigned ${devicesReassigned} other device(s) to '${otherMix.name}')`);
5659
+ if (targetDeviceAssigned && devicesRemoved > 0) {
5660
+ console.log(`Successfully set '${targetDevice.deviceId}' as the only output for mix '${mix.name}' ` + `(removed ${devicesRemoved} other device(s) from the mix)`);
5666
5661
  } else if (targetDeviceAssigned) {
5667
- console.log(`Successfully assigned '${targetDevice.deviceId}' to mix '${mix.name}' ` + `(it was already the only device on this mix)`);
5668
- } else if (devicesReassigned > 0) {
5669
- console.log(`'${targetDevice.deviceId}' was already assigned to mix '${mix.name}'. ` + `Reassigned ${devicesReassigned} other device(s) to '${otherMix.name}'`);
5662
+ console.log(`Successfully assigned '${targetDevice.deviceId}' to mix '${mix.name}' ` + `(it is now the only device on this mix)`);
5663
+ } else if (devicesRemoved > 0) {
5664
+ console.log(`'${targetDevice.deviceId}' was already assigned to mix '${mix.name}'. ` + `Removed ${devicesRemoved} other device(s) from the mix.`);
5670
5665
  } else {
5671
5666
  console.log(`'${targetDevice.deviceId}' is already the only output for mix '${mix.name}'`);
5672
5667
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raphiiko/wavelink-cli",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "Command line interface for Elgato Wave Link 3.0",
5
5
  "author": "Raphiiko",
6
6
  "license": "MIT",
package/src/index.ts CHANGED
@@ -336,16 +336,8 @@ async function setSingleOutputForMix(
336
336
  const targetDevice = await requireOutputDevice(client, deviceId);
337
337
 
338
338
  const { outputDevices } = await client.getOutputDevices();
339
- const { mixes } = await client.getMixes();
340
-
341
- const otherMix = mixes.find((m) => m.id !== mix.id);
342
- if (!otherMix) {
343
- exitWithError(
344
- "Cannot use 'single' command with only one mix available. At least two mixes are required."
345
- );
346
- }
347
339
 
348
- let devicesReassigned = 0;
340
+ let devicesRemoved = 0;
349
341
  let targetDeviceAssigned = false;
350
342
 
351
343
  for (const device of outputDevices) {
@@ -356,26 +348,26 @@ async function setSingleOutputForMix(
356
348
  await client.switchOutputMix(device.id, output.id, mix.id);
357
349
  targetDeviceAssigned = true;
358
350
  } else if (!isTargetDevice && output.mixId === mix.id) {
359
- await client.switchOutputMix(device.id, output.id, otherMix.id);
360
- devicesReassigned++;
351
+ await client.removeOutputFromMix(device.id, output.id);
352
+ devicesRemoved++;
361
353
  }
362
354
  }
363
355
  }
364
356
 
365
- if (targetDeviceAssigned && devicesReassigned > 0) {
357
+ if (targetDeviceAssigned && devicesRemoved > 0) {
366
358
  console.log(
367
359
  `Successfully set '${targetDevice.deviceId}' as the only output for mix '${mix.name}' ` +
368
- `(reassigned ${devicesReassigned} other device(s) to '${otherMix.name}')`
360
+ `(removed ${devicesRemoved} other device(s) from the mix)`
369
361
  );
370
362
  } else if (targetDeviceAssigned) {
371
363
  console.log(
372
364
  `Successfully assigned '${targetDevice.deviceId}' to mix '${mix.name}' ` +
373
- `(it was already the only device on this mix)`
365
+ `(it is now the only device on this mix)`
374
366
  );
375
- } else if (devicesReassigned > 0) {
367
+ } else if (devicesRemoved > 0) {
376
368
  console.log(
377
369
  `'${targetDevice.deviceId}' was already assigned to mix '${mix.name}'. ` +
378
- `Reassigned ${devicesReassigned} other device(s) to '${otherMix.name}'`
370
+ `Removed ${devicesRemoved} other device(s) from the mix.`
379
371
  );
380
372
  } else {
381
373
  console.log(`'${targetDevice.deviceId}' is already the only output for mix '${mix.name}'`);