Skip to content

Commit

Permalink
Version 2.2.0
Browse files Browse the repository at this point in the history
GitOrigin-RevId: f34084301c298bb494e20c5a59b363b2691cb9fa
  • Loading branch information
Interfaced authored and l1bbcsg committed Dec 28, 2019
1 parent 25b05e9 commit e6829f8
Show file tree
Hide file tree
Showing 22 changed files with 2,024 additions and 1,097 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
webpack.config.js
16 changes: 11 additions & 5 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,20 @@ module.exports = {
extends: 'interfaced/esm',
settings: {
'import/resolver': 'zombiebox'
},
globals: {
// see externs
'PalmServiceBridge': 'readonly',
'PalmSystem': 'readonly'
}
},
{
files: ['index.js', 'cli/webos.js'],
extends: 'interfaced/node',
rules: {
'require-atomic-updates': 'off' // Too aggressive with way too many false positives: https://github.com/eslint/eslint/issues/11899
},
files: ['index.js', 'cli/**/*.js'],
extends: 'interfaced/node'
},
{
files: ['externs/**/*.js'],
extends: 'interfaced/externs'
}
]
};
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
\.idea
tester/dist
node_modules
webpack.config.js
47 changes: 46 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,51 @@
# Changelog

## 2.1.1 (18.09.2019)
## 2.2.0 (28.12.2019)

Functionally identical to `2.2.0-rc.1`. Changes listed are since last stable release (`2.1.2`)

* Introduced `IStatefulVideo` implementation with state machine and DRM support
* CLI refactored, `cli/ares.js` now exposes pure functions to work with webOS ares utilities
* CLI device and app id arguments are now positional to be more consistent with other platforms
* Disable unnecessary second minification step when building `.ipk`

## 2.2.0-rc.1 (27.12.2019)

* Fix issues with CLI tools on Windows
* DRM stability improved
* Added webOS `MediaOption` API `PrepareOption`
* Disable unnecessary second minification step when building `.ipk`

## 2.2.0-alpha.5 (19.12.2019)
* Improve stability of DRM operations

## 2.2.0-alpha.5 (16.12.2019)
* Updated `Viewport` to always deal in app coordinates
* Implement `getPanelResolution` and `getOSDResolution` in `Info`

## 2.2.0-alpha.4 (12.12.2019)

### Improvements
* CLI refactored, `cli/ares.js` now exposes pure functions to work with webOS ares utilities.
* CLI device and app id arguments are now positional to be more consistent with other platforms.

## 2.2.0-alpha.3 (05.12.2019)

### Improvements
* Verimatrix VCAS DRM support

## 2.2.0-alpha.2 (02.12.2019)

### Improvements
* Add base DRM and PlayReady support

## 2.2.0-alpha.1 (19.11.2019)

### Improvements

* `StatefulVideo` introduced with ZombieBox 2.3.0

## 2.1.2 (18.09.2019)

### Fixes
* Fixed `launch` and `inspect` CLI commands not being able to demand app id.
Expand Down
165 changes: 165 additions & 0 deletions cli/ares.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
/*
* This file is part of the ZombieBox package.
*
* Copyright (c) 2014-2019, Interfaced
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
const path = require('path');
const execa = require('execa');


/**
* @param {string} toolsDir
* @param {string} executable
* @return {string}
*/
function getExecutable(toolsDir, executable) {
const base = toolsDir || process.env.WEBOS_CLI_TV || '';
return path.join(base, executable);
}


/**
* @param {string} toolsDir
* @param {string} command
* @param {Array<string>} args
* @param {string=} expectedSuccessMessage
* @return {Promise}
*/
async function exec(toolsDir, command, args, expectedSuccessMessage) {
const executable = getExecutable(toolsDir, command);

const result = await execa(
executable,
args,
{
all: true
}
);

if (expectedSuccessMessage && !result.stdout.includes(expectedSuccessMessage)) {
console.log(result.stdout);
console.error(result.stderr);

throw new Error(`${command} failed`);
}

return result.all;
}


/**
* @param {string} toolsDir
* @param {string} deviceName
* @return {Promise<Array<string>, Error<string>>}
*/
async function getInstalledApps(toolsDir, deviceName) {
const result = await exec(
toolsDir,
'ares-install',
['-d', deviceName, '-l']
);

return result.split(/\s+/);
}

/**
* @param {string} toolsDir
* @param {string} srcDir
* @param {string=} outDir
* @return {Promise}
* @protected
*/
async function build(toolsDir, srcDir, outDir = srcDir) {
await exec(
toolsDir,
'ares-package',
[srcDir, '--outdir', outDir, '--no-minify']
);

console.log(`The ipk package was built into ${outDir}`);
}


/**
* @param {string} toolsDir
* @param {string} ipk
* @param {string} deviceName
* @return {Promise}
*/
async function install(toolsDir, ipk, deviceName) {
await exec(
toolsDir,
'ares-install',
[ipk, '-d', deviceName],
'Success'
);
console.log(`Installed ${path.basename(ipk)}`);
}


/**
* @param {string} toolsDir
* @param {string} appId
* @param {string} deviceName
* @return {Promise}
*/
async function launch(toolsDir, appId, deviceName) {
await exec(
toolsDir,
'ares-launch',
[appId, '-d', deviceName],
'Launched'
);
console.log(`Launched ${appId}`);
}


/**
* @param {string} toolsDir
* @param {string} appId
* @param {string} deviceName
* @return {Promise}
*/
async function inspect(toolsDir, appId, deviceName) {
const executable = getExecutable(toolsDir, 'ares-inspect');

const subprocess = execa(
executable,
['-d', deviceName, appId],
{
all: true
}
);

subprocess.stdout.pipe(process.stdout);
await subprocess;
}


/**
* @param {string} toolsDir
* @param {string} appId
* @param {string} deviceName
* @return {Promise}
*/
async function uninstall(toolsDir, appId, deviceName) {
await exec(
toolsDir,
'ares-install',
['-d', deviceName, '--remove', appId]
);
console.log(`Uninstalled ${appId}`);
}


module.exports = {
getInstalledApps,
build,
install,
launch,
inspect,
uninstall
};
Loading

0 comments on commit e6829f8

Please sign in to comment.