@sebbo2002/node-pyatv 4.2.0 → 4.3.0-develop.2
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/CHANGELOG.md +28 -0
- package/LICENSE +1 -1
- package/dist/lib/device.d.ts +12 -0
- package/dist/lib/device.js +24 -3
- package/dist/lib/device.js.map +1 -1
- package/dist/lib/types.d.ts +6 -2
- package/dist/lib/types.js +4 -0
- package/dist/lib/types.js.map +1 -1
- package/docs/coverage/cobertura-coverage.xml +380 -364
- package/docs/coverage/device-event.ts.html +1 -1
- package/docs/coverage/device-events.ts.html +6 -6
- package/docs/coverage/device.ts.html +91 -25
- package/docs/coverage/fake-spawn.ts.html +22 -22
- package/docs/coverage/index.html +20 -20
- package/docs/coverage/index.ts.html +2 -2
- package/docs/coverage/instance.ts.html +1 -1
- package/docs/coverage/tools.ts.html +100 -100
- package/docs/coverage/types.ts.html +18 -6
- package/docs/reference/assets/search.js +1 -1
- package/docs/reference/classes/NodePyATVDevice.html +63 -59
- package/docs/reference/classes/NodePyATVDeviceEvent.html +5 -5
- package/docs/reference/classes/default.html +10 -10
- package/docs/reference/enums/NodePyATVDeviceState.html +1 -1
- package/docs/reference/enums/NodePyATVKeys.html +1 -1
- package/docs/reference/enums/NodePyATVListenerState.html +1 -1
- package/docs/reference/enums/NodePyATVMediaType.html +1 -1
- package/docs/reference/enums/NodePyATVPowerState.html +1 -1
- package/docs/reference/enums/NodePyATVProtocol.html +1 -1
- package/docs/reference/enums/NodePyATVRepeatState.html +1 -1
- package/docs/reference/enums/NodePyATVShuffleState.html +1 -1
- package/docs/reference/index.html +1 -1
- package/docs/reference/interfaces/NodePyATVDeviceOptions.html +1 -1
- package/docs/reference/interfaces/NodePyATVFindAndInstanceOptions.html +1 -1
- package/docs/reference/interfaces/NodePyATVFindOptions.html +1 -1
- package/docs/reference/interfaces/NodePyATVGetStateOptions.html +1 -1
- package/docs/reference/interfaces/NodePyATVInstanceOptions.html +1 -1
- package/docs/reference/interfaces/NodePyATVState.html +1 -1
- package/docs/reference/interfaces/NodePyATVVersionResponse.html +1 -1
- package/docs/reference/modules.html +1 -1
- package/docs/tests/index.html +1 -1
- package/docs/tests/mochawesome.json +686 -608
- package/package.json +11 -11
- package/src/lib/device.ts +28 -6
- package/src/lib/types.ts +6 -2
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"author": "Sebastian Pekarek <
|
|
2
|
+
"author": "Sebastian Pekarek <mail@sebbo.net>",
|
|
3
3
|
"bugs": {
|
|
4
4
|
"email": "sheeboothohmoolaiquu@e.sebbo.net",
|
|
5
5
|
"url": "http://github.com/sebbo2002/node-pyatv/issues"
|
|
@@ -12,25 +12,25 @@
|
|
|
12
12
|
"@amanda-mitchell/semantic-release-npm-multiple": "^2.15.0",
|
|
13
13
|
"@qiwi/semantic-release-gh-pages-plugin": "^5.2.0",
|
|
14
14
|
"@semantic-release/changelog": "^6.0.1",
|
|
15
|
-
"@semantic-release/exec": "^6.0.
|
|
15
|
+
"@semantic-release/exec": "^6.0.3",
|
|
16
16
|
"@semantic-release/git": "^10.0.1",
|
|
17
17
|
"@types/mocha": "^9.0.0",
|
|
18
|
-
"@types/node": "^
|
|
18
|
+
"@types/node": "^17.0.8",
|
|
19
19
|
"@types/semver": "^7.3.9",
|
|
20
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
21
|
-
"@typescript-eslint/parser": "^5.
|
|
22
|
-
"eslint": "^8.
|
|
20
|
+
"@typescript-eslint/eslint-plugin": "^5.9.1",
|
|
21
|
+
"@typescript-eslint/parser": "^5.9.1",
|
|
22
|
+
"eslint": "^8.7.0",
|
|
23
23
|
"eslint-plugin-jsonc": "^2.0.0",
|
|
24
24
|
"license-checker": "^25.0.1",
|
|
25
|
-
"mocha": "^9.1.
|
|
25
|
+
"mocha": "^9.1.4",
|
|
26
26
|
"mochawesome": "^7.0.1",
|
|
27
27
|
"nyc": "^15.1.0",
|
|
28
|
-
"semantic-release": "^18.0.
|
|
28
|
+
"semantic-release": "^18.0.1",
|
|
29
29
|
"semantic-release-license": "^1.0.3",
|
|
30
30
|
"source-map-support": "^0.5.21",
|
|
31
31
|
"ts-node": "^10.4.0",
|
|
32
|
-
"typedoc": "^0.22.
|
|
33
|
-
"typescript": "^4.5.
|
|
32
|
+
"typedoc": "^0.22.10",
|
|
33
|
+
"typescript": "^4.5.4"
|
|
34
34
|
},
|
|
35
35
|
"engines": {
|
|
36
36
|
"node": ">=12.0.0"
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"postinstall": "./check.sh",
|
|
56
56
|
"test": "mocha"
|
|
57
57
|
},
|
|
58
|
-
"version": "4.
|
|
58
|
+
"version": "4.3.0-develop.2"
|
|
59
59
|
}
|
package/src/lib/device.ts
CHANGED
|
@@ -5,7 +5,8 @@ import {
|
|
|
5
5
|
NodePyATVDeviceState,
|
|
6
6
|
NodePyATVExecutableType,
|
|
7
7
|
NodePyATVGetStateOptions,
|
|
8
|
-
NodePyATVInternalKeys,
|
|
8
|
+
NodePyATVInternalKeys,
|
|
9
|
+
NodePyATVKeys,
|
|
9
10
|
NodePyATVMediaType,
|
|
10
11
|
NodePyATVProtocol,
|
|
11
12
|
NodePyATVRepeatState,
|
|
@@ -13,8 +14,8 @@ import {
|
|
|
13
14
|
NodePyATVState
|
|
14
15
|
} from './types';
|
|
15
16
|
|
|
16
|
-
import {addRequestId, getParamters, parseState, removeRequestId, request} from './tools';
|
|
17
|
-
import {
|
|
17
|
+
import { addRequestId, getParamters, parseState, removeRequestId, request } from './tools';
|
|
18
|
+
import { NodePyATVDeviceEvent, NodePyATVDeviceEvents } from '../lib';
|
|
18
19
|
import { EventEmitter } from 'events';
|
|
19
20
|
|
|
20
21
|
/**
|
|
@@ -315,12 +316,15 @@ export default class NodePyATVDevice implements EventEmitter{
|
|
|
315
316
|
return state.appId;
|
|
316
317
|
}
|
|
317
318
|
|
|
318
|
-
private async _pressKey(key: NodePyATVInternalKeys) {
|
|
319
|
+
private async _pressKey(key: NodePyATVInternalKeys, executableType = NodePyATVExecutableType.atvscript) {
|
|
319
320
|
const id = addRequestId();
|
|
320
321
|
const parameters = getParamters(this.options);
|
|
321
322
|
|
|
322
|
-
const result = await request(id,
|
|
323
|
-
if (
|
|
323
|
+
const result = await request(id, executableType, [...parameters, key], this.options);
|
|
324
|
+
if (
|
|
325
|
+
executableType === NodePyATVExecutableType.atvscript &&
|
|
326
|
+
(typeof result !== 'object' || result.result !== 'success')
|
|
327
|
+
) {
|
|
324
328
|
throw new Error(`Unable to parse pyatv response: ${JSON.stringify(result, null, ' ')}`);
|
|
325
329
|
}
|
|
326
330
|
|
|
@@ -478,6 +482,7 @@ export default class NodePyATVDevice implements EventEmitter{
|
|
|
478
482
|
/**
|
|
479
483
|
* Send the "suspend" command
|
|
480
484
|
* @category Control
|
|
485
|
+
* @deprecated
|
|
481
486
|
*/
|
|
482
487
|
async suspend(): Promise<void> {
|
|
483
488
|
await this._pressKey(NodePyATVInternalKeys.suspend);
|
|
@@ -518,11 +523,28 @@ export default class NodePyATVDevice implements EventEmitter{
|
|
|
518
523
|
/**
|
|
519
524
|
* Send the "wakeup" command
|
|
520
525
|
* @category Control
|
|
526
|
+
* @deprecated
|
|
521
527
|
*/
|
|
522
528
|
async wakeup(): Promise<void> {
|
|
523
529
|
await this._pressKey(NodePyATVInternalKeys.wakeup);
|
|
524
530
|
}
|
|
525
531
|
|
|
532
|
+
/**
|
|
533
|
+
* Send the "turn_off" command
|
|
534
|
+
* @category Control
|
|
535
|
+
*/
|
|
536
|
+
async turnOff(): Promise<void> {
|
|
537
|
+
await this._pressKey(NodePyATVInternalKeys.turnOff, NodePyATVExecutableType.atvremote);
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
/**
|
|
541
|
+
* Send the "turn_on" command
|
|
542
|
+
* @category Control
|
|
543
|
+
*/
|
|
544
|
+
async turnOn(): Promise<void> {
|
|
545
|
+
await this._pressKey(NodePyATVInternalKeys.turnOn, NodePyATVExecutableType.atvremote);
|
|
546
|
+
}
|
|
547
|
+
|
|
526
548
|
/**
|
|
527
549
|
* Add an event listener. Will start the event subscription with the
|
|
528
550
|
* Apple TV as long as there are listeners for any event registered.
|
package/src/lib/types.ts
CHANGED
|
@@ -67,7 +67,9 @@ export enum NodePyATVKeys {
|
|
|
67
67
|
up = 'up',
|
|
68
68
|
volumeDown = 'volumeDown',
|
|
69
69
|
volumeUp = 'volumeUp',
|
|
70
|
-
wakeup = 'wakeup'
|
|
70
|
+
wakeup = 'wakeup',
|
|
71
|
+
turnOff = 'turnOff',
|
|
72
|
+
turnOn = 'turnOn'
|
|
71
73
|
}
|
|
72
74
|
|
|
73
75
|
/**
|
|
@@ -94,7 +96,9 @@ export enum NodePyATVInternalKeys {
|
|
|
94
96
|
up = 'up',
|
|
95
97
|
volumeDown = 'volume_down',
|
|
96
98
|
volumeUp = 'volume_up',
|
|
97
|
-
wakeup = 'wakeup'
|
|
99
|
+
wakeup = 'wakeup',
|
|
100
|
+
turnOff = 'turn_off',
|
|
101
|
+
turnOn = 'turn_on'
|
|
98
102
|
}
|
|
99
103
|
|
|
100
104
|
export enum NodePyATVListenerState {
|