systeminformation 5.13.1 → 5.13.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.
Files changed (3) hide show
  1. package/lib/audio.js +13 -10
  2. package/lib/cpu.js +4 -2
  3. package/package.json +1 -1
package/lib/audio.js CHANGED
@@ -28,8 +28,10 @@ const _netbsd = (_platform === 'netbsd');
28
28
  const _sunos = (_platform === 'sunos');
29
29
 
30
30
  function parseAudioType(str, input, output) {
31
+ str = str.toLowerCase();
31
32
  let result = '';
32
33
 
34
+ if (str.indexOf('display audio') >= 0) { result = 'Speaker'; }
33
35
  if (str.indexOf('speak') >= 0) { result = 'Speaker'; }
34
36
  if (str.indexOf('laut') >= 0) { result = 'Speaker'; }
35
37
  if (str.indexOf('loud') >= 0) { result = 'Speaker'; }
@@ -55,15 +57,15 @@ function getLinuxAudioPci() {
55
57
  let result = [];
56
58
  try {
57
59
  const parts = execSync(cmd).toString().split('\n\n');
58
- for (let i = 0; i < parts.length; i++) {
59
- const lines = parts[i].split('\n');
60
+ parts.forEach(element => {
61
+ const lines = element.split('\n');
60
62
  if (lines && lines.length && lines[0].toLowerCase().indexOf('audio') >= 0) {
61
63
  const audio = {};
62
64
  audio.slotId = lines[0].split(' ')[0];
63
65
  audio.driver = util.getValue(lines, 'Kernel driver in use', ':', true) || util.getValue(lines, 'Kernel modules', ':', true);
64
66
  result.push(audio);
65
67
  }
66
- }
68
+ });
67
69
  return result;
68
70
  } catch (e) {
69
71
  return result;
@@ -154,13 +156,13 @@ function audio(callback) {
154
156
  if (!error) {
155
157
  const audioPCI = getLinuxAudioPci();
156
158
  const parts = stdout.toString().split('\n\n');
157
- for (let i = 0; i < parts.length; i++) {
158
- const lines = parts[i].split('\n');
159
+ parts.forEach(element => {
160
+ const lines = element.split('\n');
159
161
  if (util.getValue(lines, 'class', ':', true).toLowerCase().indexOf('audio') >= 0) {
160
162
  const audio = parseLinuxAudioPciMM(lines, audioPCI);
161
163
  result.push(audio);
162
164
  }
163
- }
165
+ });
164
166
  }
165
167
  if (callback) {
166
168
  callback(result);
@@ -194,11 +196,12 @@ function audio(callback) {
194
196
  util.powerShell('Get-CimInstance Win32_SoundDevice | select DeviceID,StatusInfo,Name,Manufacturer | fl').then((stdout, error) => {
195
197
  if (!error) {
196
198
  const parts = stdout.toString().split(/\n\s*\n/);
197
- for (let i = 0; i < parts.length; i++) {
198
- if (util.getValue(parts[i].split('\n'), 'name', ':')) {
199
- result.push(parseWindowsAudio(parts[i].split('\n')));
199
+ parts.forEach(element => {
200
+ const lines = element.split('\n');
201
+ if (util.getValue(lines, 'name', ':')) {
202
+ result.push(parseWindowsAudio(lines));
200
203
  }
201
- }
204
+ });
202
205
  }
203
206
  if (callback) {
204
207
  callback(result);
package/lib/cpu.js CHANGED
@@ -1044,13 +1044,15 @@ function cpuTemperature(callback) {
1044
1044
  const value = parts.length > 1 && parts[1] ? parts[1] : '0';
1045
1045
  if (value && (label === undefined || (label && label.toLowerCase().startsWith('core')))) {
1046
1046
  result.cores.push(Math.round(parseInt(value, 10) / 100) / 10);
1047
- } else if (value && label && result.main === null) {
1047
+ } else if (value && label && result.main === null && (label.toLowerCase().indexOf('package') >= 0 || label.toLowerCase().indexOf('physical') >= 0)) {
1048
1048
  result.main = Math.round(parseInt(value, 10) / 100) / 10;
1049
1049
  }
1050
1050
  });
1051
1051
 
1052
1052
  if (result.cores.length > 0) {
1053
- result.main = Math.round(result.cores.reduce((a, b) => a + b, 0) / result.cores.length);
1053
+ if (result.main === null) {
1054
+ result.main = Math.round(result.cores.reduce((a, b) => a + b, 0) / result.cores.length);
1055
+ }
1054
1056
  let maxtmp = Math.max.apply(Math, result.cores);
1055
1057
  result.max = (maxtmp > result.main) ? maxtmp : result.main;
1056
1058
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "systeminformation",
3
- "version": "5.13.1",
3
+ "version": "5.13.3",
4
4
  "description": "Advanced, lightweight system and OS information library",
5
5
  "license": "MIT",
6
6
  "author": "Sebastian Hildebrandt <hildebrandt@plus-innovations.com> (https://plus-innovations.com)",