2019-03-22 23:52:59 +00:00
|
|
|
'use strict';
|
2019-03-23 00:29:36 +00:00
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
2019-06-09 01:43:14 +00:00
|
|
|
const os_1 = require("os");
|
|
|
|
const systeminformation_1 = require("systeminformation");
|
2019-06-22 15:52:36 +00:00
|
|
|
const electron_1 = require("electron");
|
2019-03-22 23:52:59 +00:00
|
|
|
//private
|
2019-06-09 01:43:14 +00:00
|
|
|
const exec_1 = require("exec");
|
2019-03-22 23:52:59 +00:00
|
|
|
/**
|
|
|
|
* Evaluates system dependencies for digital
|
|
|
|
* projector features by executing processes with
|
|
|
|
* --help flag. If they do not exist, log to console
|
2019-03-23 00:29:36 +00:00
|
|
|
*
|
2019-03-22 23:52:59 +00:00
|
|
|
* @param {string} platform Operating system type
|
|
|
|
**/
|
2019-03-23 00:29:36 +00:00
|
|
|
async function dependencies(platform) {
|
|
|
|
let obj = {};
|
|
|
|
try {
|
2019-06-09 01:43:14 +00:00
|
|
|
await exec_1.exec('ffmpeg -h');
|
2019-03-23 00:29:36 +00:00
|
|
|
obj.ffmpeg = 'ffmpeg';
|
|
|
|
}
|
|
|
|
catch (err) {
|
|
|
|
//return exit('ffmpeg is not installed', 3);
|
|
|
|
return console.error('ffmpeg is not installed', err);
|
|
|
|
}
|
|
|
|
//if linux
|
|
|
|
if (platform === 'nix') {
|
|
|
|
try {
|
2019-06-09 01:43:14 +00:00
|
|
|
await exec_1.exec('eog -h');
|
2019-03-23 00:29:36 +00:00
|
|
|
obj.eog = 'eog';
|
|
|
|
}
|
|
|
|
catch (err) {
|
|
|
|
//return exit('eog is not installed', 4);
|
|
|
|
return console.error('eog is not installed', err);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return obj;
|
2019-03-22 23:52:59 +00:00
|
|
|
}
|
2019-03-23 00:29:36 +00:00
|
|
|
function displayMap(obj) {
|
|
|
|
const sm = {
|
|
|
|
width: obj.resolutionx,
|
|
|
|
height: obj.resolutiony
|
|
|
|
};
|
|
|
|
return sm;
|
|
|
|
}
|
|
|
|
async function displays() {
|
2019-06-09 01:43:14 +00:00
|
|
|
const obj = await systeminformation_1.graphics();
|
2019-03-23 00:29:36 +00:00
|
|
|
const arr = obj.displays;
|
2019-06-22 15:52:36 +00:00
|
|
|
const displays = electron_1.screen.getAllDisplays();
|
|
|
|
const siarr = arr.map(displayMap);
|
|
|
|
console.dir(arr);
|
|
|
|
console.dir(displays);
|
2019-03-22 23:52:59 +00:00
|
|
|
}
|
|
|
|
/**
|
|
|
|
* Profile the current system and return an object with
|
|
|
|
* data about the displays and dependencies for the digital
|
|
|
|
* projector feature.
|
|
|
|
*
|
|
|
|
* @returns {object} Object containing system information
|
2019-03-23 00:29:36 +00:00
|
|
|
*/
|
|
|
|
async function system() {
|
|
|
|
const obj = {};
|
|
|
|
let platform;
|
|
|
|
try {
|
2019-06-09 01:43:14 +00:00
|
|
|
obj.tmp = os_1.tmpdir();
|
2019-03-23 00:29:36 +00:00
|
|
|
}
|
|
|
|
catch (err) {
|
|
|
|
obj.tmp = '/tmp';
|
|
|
|
}
|
2019-06-09 01:43:14 +00:00
|
|
|
platform = os_1.type();
|
2019-03-23 00:29:36 +00:00
|
|
|
if (platform === 'Darwin') {
|
|
|
|
obj.platform = 'osx';
|
|
|
|
}
|
|
|
|
else if (platform === 'Windows_NT') {
|
|
|
|
obj.platform = 'win';
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
obj.platform = 'nix';
|
|
|
|
}
|
|
|
|
obj.displays = await displays();
|
|
|
|
obj.deps = await dependencies(obj.platform);
|
|
|
|
return obj;
|
2019-03-22 23:52:59 +00:00
|
|
|
}
|
2019-03-23 00:29:36 +00:00
|
|
|
module.exports = system;
|
|
|
|
//# sourceMappingURL=index.js.map
|