Skip to content

Commit

Permalink
Merge branch 'master' into feature/542-support-multiple-automations
Browse files Browse the repository at this point in the history
  • Loading branch information
TwitchBronBron authored Dec 10, 2024
2 parents 2df014b + be76ac4 commit 07284a2
Show file tree
Hide file tree
Showing 6 changed files with 551 additions and 13 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0



## [2.50.5](https://github.com/rokucommunity/vscode-brightscript-language/compare/v2.50.4...v2.50.5) - 2024-11-06
### Changed
- Show multi-line lsp progress details ([#600](https://github.com/rokucommunity/vscode-brightscript-language/pull/600))
### Fixed
- Fix bug with m.top colorization ([#601](https://github.com/rokucommunity/vscode-brightscript-language/pull/601))



## [2.50.4](https://github.com/rokucommunity/vscode-brightscript-language/compare/v2.50.3...v2.50.4) - 2024-10-18
### Added
- ability to set a device as the current active device via the Deive tree view. ([#597](https://github.com/rokucommunity/vscode-brightscript-language/pull/597))
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 38 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "brightscript",
"displayName": "BrightScript Language",
"version": "2.50.4",
"version": "2.50.5",
"publisher": "RokuCommunity",
"description": "Language support for Roku's BrightScript language.",
"author": {
Expand Down Expand Up @@ -177,9 +177,15 @@
"onCommand:extension.brightscript.pressVolumeDown",
"onCommand:extension.brightscript.pressVolumeMute",
"onCommand:extension.brightscript.pressVolumeUp",
"onCommand:extension.brightscript.setVolume",
"onCommand:extension.brightscript.pressPowerOff",
"onCommand:extension.brightscript.pressChannelUp",
"onCommand:extension.brightscript.pressChannelDown",
"onCommand:extension.brightscript.pressBlue",
"onCommand:extension.brightscript.pressGreen",
"onCommand:extension.brightscript.pressRed",
"onCommand:extension.brightscript.pressYellow",
"onCommand:extension.brightscript.pressExit",
"onCommand:extension.brightscript.changeTvInput",
"onCommand:extension.brightscript.sendRemoteText",
"onCommand:brighterscript.showPreview",
Expand Down Expand Up @@ -2857,6 +2863,12 @@
"title": "Press the VolumeUp button on the Roku remote",
"category": "Brightscript"
},
{
"command": "extension.brightscript.setVolume",
"title": "Set the volume on a volume-enabled Roku device to the specified value (0-100)",
"shortTitle": "Set Volume target volume level",
"category": "Brightscript"
},
{
"command": "extension.brightscript.pressPowerOff",
"title": "Press the PowerOff button on the Roku remote",
Expand All @@ -2877,6 +2889,31 @@
"title": "Press the ChannelDown button on the Roku remote",
"category": "Brightscript"
},
{
"command": "extension.brightscript.pressBlue",
"title": "Press the Blue button on the Roku remote",
"category": "Brightscript"
},
{
"command": "extension.brightscript.pressGreen",
"title": "Press the Green button on the Roku remote",
"category": "Brightscript"
},
{
"command": "extension.brightscript.pressRed",
"title": "Press the Red button on the Roku remote",
"category": "Brightscript"
},
{
"command": "extension.brightscript.pressYellow",
"title": "Press the Yellow button on the Roku remote",
"category": "Brightscript"
},
{
"command": "extension.brightscript.pressExit",
"title": "Press the Exit button on the Roku remote",
"category": "Brightscript"
},
{
"command": "extension.brightscript.changeTvInput",
"title": "Provides a list of possible inputs to change to",
Expand Down
62 changes: 61 additions & 1 deletion src/BrightScriptCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,47 @@ export class BrightScriptCommands {
});

this.registerCommand('pressVolumeUp', async () => {
await this.sendRemoteCommand('FindVolumeUp');
await this.sendRemoteCommand('VolumeUp');
});

this.registerCommand('setVolume', async () => {
let result = await vscode.window.showInputBox({
placeHolder: 'The target volume level (0-100)',
value: '',
validateInput: (text: string) => {
const num = Number(text);
if (isNaN(num)) {
return 'Value must be a number';
} else if (num < 0 || num > 100) {
return 'Please enter a number between 0 and 100';
}
return null;
}
});
const targetVolume = Number(result);

if (!isNaN(targetVolume)) {
await vscode.window.withProgress({
location: vscode.ProgressLocation.Notification,
title: 'Setting volume'
}, async (progress) => {
const totalCommands = 100 + targetVolume;
const incrementValue = 100 / totalCommands;
let executedCommands = 0;

for (let i = 0; i < 100; i++) {
await this.sendRemoteCommand('VolumeDown');
executedCommands++;
progress.report({ increment: incrementValue, message: `decreasing volume - ${Math.round((executedCommands / totalCommands) * 100)}%` });
}

for (let i = 0; i < targetVolume; i++) {
await this.sendRemoteCommand('VolumeUp');
executedCommands++;
progress.report({ increment: incrementValue, message: `increasing volume - ${Math.round((executedCommands / totalCommands) * 100)}%` });
}
});
}
});

this.registerCommand('pressPowerOff', async () => {
Expand All @@ -196,6 +236,26 @@ export class BrightScriptCommands {
await this.sendRemoteCommand('ChannelDown');
});

this.registerCommand('pressBlue', async () => {
await this.sendRemoteCommand('Blue');
});

this.registerCommand('pressGreen', async () => {
await this.sendRemoteCommand('Green');
});

this.registerCommand('pressRed', async () => {
await this.sendRemoteCommand('Red');
});

this.registerCommand('pressYellow', async () => {
await this.sendRemoteCommand('Yellow');
});

this.registerCommand('pressExit', async () => {
await this.sendRemoteCommand('Exit');
});

this.registerCommand('changeTvInput', async (host?: string) => {
const selectedInput = await vscode.window.showQuickPick([
'InputHDMI1',
Expand Down
Loading

0 comments on commit 07284a2

Please sign in to comment.