@sebbo2002/node-pyatv 5.0.0 → 5.1.1-develop.1
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 +16 -0
- package/dist/lib/device.d.ts +46 -1
- package/dist/lib/device.js +55 -0
- package/dist/lib/device.js.map +1 -1
- package/dist/lib/index.d.ts +2 -1
- package/dist/lib/index.js +2 -1
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/instance.js +13 -5
- package/dist/lib/instance.js.map +1 -1
- package/dist/lib/types.d.ts +24 -0
- package/docs/coverage/cobertura-coverage.xml +913 -791
- package/docs/coverage/device-event.ts.html +1 -1
- package/docs/coverage/device-events.ts.html +8 -8
- package/docs/coverage/device.ts.html +204 -18
- package/docs/coverage/fake-spawn.ts.html +41 -41
- package/docs/coverage/index.html +30 -30
- package/docs/coverage/index.ts.html +25 -16
- package/docs/coverage/instance.ts.html +51 -33
- package/docs/coverage/tools.ts.html +250 -250
- package/docs/coverage/types.ts.html +82 -4
- package/docs/reference/assets/highlight.css +18 -4
- package/docs/reference/assets/main.js +3 -3
- package/docs/reference/assets/search.js +1 -1
- package/docs/reference/assets/style.css +7 -82
- package/docs/reference/classes/NodePyATVDevice.html +351 -210
- package/docs/reference/classes/NodePyATVDeviceEvent.html +27 -20
- package/docs/reference/classes/{default.html → NodePyATVInstance.html} +66 -55
- package/docs/reference/enums/NodePyATVDeviceState.html +13 -11
- package/docs/reference/enums/NodePyATVExecutableType.html +67 -0
- package/docs/reference/enums/NodePyATVKeys.html +30 -28
- package/docs/reference/enums/NodePyATVListenerState.html +11 -9
- package/docs/reference/enums/NodePyATVMediaType.html +11 -9
- package/docs/reference/enums/NodePyATVPowerState.html +9 -7
- package/docs/reference/enums/NodePyATVProtocol.html +11 -9
- package/docs/reference/enums/NodePyATVRepeatState.html +10 -8
- package/docs/reference/enums/NodePyATVShuffleState.html +10 -8
- package/docs/reference/index.html +59 -6
- package/docs/reference/interfaces/NodePyATVDeviceOptions.html +86 -48
- package/docs/reference/interfaces/NodePyATVFindAndInstanceOptions.html +54 -49
- package/docs/reference/interfaces/NodePyATVFindOptions.html +36 -32
- package/docs/reference/interfaces/NodePyATVGetStateOptions.html +10 -8
- package/docs/reference/interfaces/NodePyATVInstanceOptions.html +25 -22
- package/docs/reference/interfaces/NodePyATVService.html +71 -0
- package/docs/reference/interfaces/NodePyATVState.html +22 -20
- package/docs/reference/interfaces/NodePyATVVersionResponse.html +9 -7
- package/docs/reference/modules.html +23 -8
- package/docs/reference/types/NodePyATVEventValueType.html +9 -6
- package/docs/tests/index.html +1 -1
- package/docs/tests/mochawesome.json +957 -629
- package/package.json +12 -12
- package/src/lib/device.ts +62 -0
- package/src/lib/index.ts +15 -12
- package/src/lib/instance.ts +8 -2
- package/src/lib/types.ts +26 -0
- package/test/device.ts +124 -1
- package/test/instance.ts +84 -5
package/package.json
CHANGED
|
@@ -15,23 +15,23 @@
|
|
|
15
15
|
"@semantic-release/exec": "^6.0.3",
|
|
16
16
|
"@semantic-release/git": "^10.0.1",
|
|
17
17
|
"@types/mocha": "^9.1.1",
|
|
18
|
-
"@types/node": "^18.
|
|
19
|
-
"@types/semver": "^7.3.
|
|
20
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
21
|
-
"@typescript-eslint/parser": "^5.
|
|
22
|
-
"c8": "^7.
|
|
23
|
-
"eslint": "^8.
|
|
24
|
-
"eslint-plugin-jsonc": "^2.
|
|
18
|
+
"@types/node": "^18.7.16",
|
|
19
|
+
"@types/semver": "^7.3.12",
|
|
20
|
+
"@typescript-eslint/eslint-plugin": "^5.36.2",
|
|
21
|
+
"@typescript-eslint/parser": "^5.36.2",
|
|
22
|
+
"c8": "^7.12.0",
|
|
23
|
+
"eslint": "^8.23.0",
|
|
24
|
+
"eslint-plugin-jsonc": "^2.4.0",
|
|
25
25
|
"esm": "^3.2.25",
|
|
26
26
|
"license-checker": "^25.0.1",
|
|
27
27
|
"mocha": "^10.0.0",
|
|
28
28
|
"mochawesome": "^7.1.3",
|
|
29
|
-
"semantic-release": "^19.0.
|
|
29
|
+
"semantic-release": "^19.0.5",
|
|
30
30
|
"semantic-release-license": "^1.0.3",
|
|
31
31
|
"source-map-support": "^0.5.21",
|
|
32
|
-
"ts-node": "^10.
|
|
33
|
-
"typedoc": "^0.23.
|
|
34
|
-
"typescript": "^4.
|
|
32
|
+
"ts-node": "^10.9.1",
|
|
33
|
+
"typedoc": "^0.23.14",
|
|
34
|
+
"typescript": "^4.8.2"
|
|
35
35
|
},
|
|
36
36
|
"engines": {
|
|
37
37
|
"node": "^12.20.0 || >=14.13.1"
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"test": "mocha"
|
|
59
59
|
},
|
|
60
60
|
"type": "module",
|
|
61
|
-
"version": "5.
|
|
61
|
+
"version": "5.1.1-develop.1"
|
|
62
62
|
}
|
package/src/lib/device.ts
CHANGED
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
NodePyATVMediaType,
|
|
11
11
|
NodePyATVProtocol,
|
|
12
12
|
NodePyATVRepeatState,
|
|
13
|
+
NodePyATVService,
|
|
13
14
|
NodePyATVShuffleState,
|
|
14
15
|
NodePyATVState
|
|
15
16
|
} from './types.js';
|
|
@@ -74,6 +75,67 @@ export default class NodePyATVDevice implements EventEmitter{
|
|
|
74
75
|
return this.options.protocol;
|
|
75
76
|
}
|
|
76
77
|
|
|
78
|
+
/**
|
|
79
|
+
* Get the model identifier of the device. Only set, if the
|
|
80
|
+
* device was found using [[find()]]. Requires pyatv ≧ 0.10.3.
|
|
81
|
+
*
|
|
82
|
+
* @example device.model → "Gen4K"
|
|
83
|
+
*/
|
|
84
|
+
get model(): string | undefined {
|
|
85
|
+
return this.options.model;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Get the model name of the device. Only set, if the device
|
|
90
|
+
* was found with [[find()]]. Requires pyatv ≧ 0.10.3.
|
|
91
|
+
*
|
|
92
|
+
* @example device.modelName → "Apple TV 4K"
|
|
93
|
+
*/
|
|
94
|
+
get modelName(): string | undefined {
|
|
95
|
+
return this.options.modelName;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Get the operating system of the device. Only set, if the
|
|
100
|
+
* device was found with [[find()]]. Requires pyatv ≧ 0.10.3.
|
|
101
|
+
*
|
|
102
|
+
* @example device.os → "TvOS"
|
|
103
|
+
*/
|
|
104
|
+
get os(): string | undefined {
|
|
105
|
+
return this.options.os;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Get the device version. Only set, if the device was found
|
|
110
|
+
* during a scan using [[find()]]. Requires pyatv ≧ 0.10.3.
|
|
111
|
+
*
|
|
112
|
+
* @example device.version → "15.5.1"
|
|
113
|
+
*/
|
|
114
|
+
get version(): string | undefined {
|
|
115
|
+
return this.options.version;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Returns a list of services supported by the device. Ony set, if
|
|
120
|
+
* the device was found during a scan using [[find()]]. Requires
|
|
121
|
+
* pyatv ≧ 0.10.3.
|
|
122
|
+
*
|
|
123
|
+
* @example device.services → [
|
|
124
|
+
* {
|
|
125
|
+
* "protocol": "airplay",
|
|
126
|
+
* "port": 7000
|
|
127
|
+
* },
|
|
128
|
+
* {
|
|
129
|
+
* "protocol": "dmap",
|
|
130
|
+
* "port": 3689
|
|
131
|
+
* }
|
|
132
|
+
* ]
|
|
133
|
+
*/
|
|
134
|
+
get services(): NodePyATVService[] | undefined {
|
|
135
|
+
return this.options.services;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
|
|
77
139
|
/**
|
|
78
140
|
* Returns true, if debugging is enabled. Returns the custom
|
|
79
141
|
* logging method, if one was specified. Otherwise, if debug
|
package/src/lib/index.ts
CHANGED
|
@@ -1,26 +1,29 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
export {
|
|
4
|
-
|
|
5
|
-
NodePyATVMediaType,
|
|
4
|
+
NodePyATVDeviceOptions,
|
|
6
5
|
NodePyATVDeviceState,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
NodePyATVKeys,
|
|
10
|
-
NodePyATVInstanceOptions,
|
|
11
|
-
NodePyATVVersionResponse,
|
|
12
|
-
NodePyATVFindOptions,
|
|
6
|
+
NodePyATVEventValueType,
|
|
7
|
+
NodePyATVExecutableType,
|
|
13
8
|
NodePyATVFindAndInstanceOptions,
|
|
14
|
-
|
|
9
|
+
NodePyATVFindOptions,
|
|
15
10
|
NodePyATVGetStateOptions,
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
NodePyATVInstanceOptions,
|
|
12
|
+
NodePyATVKeys,
|
|
18
13
|
NodePyATVListenerState,
|
|
19
|
-
|
|
14
|
+
NodePyATVMediaType,
|
|
15
|
+
NodePyATVPowerState,
|
|
16
|
+
NodePyATVProtocol,
|
|
17
|
+
NodePyATVRepeatState,
|
|
18
|
+
NodePyATVService,
|
|
19
|
+
NodePyATVShuffleState,
|
|
20
|
+
NodePyATVState,
|
|
21
|
+
NodePyATVVersionResponse
|
|
20
22
|
} from './types.js';
|
|
21
23
|
|
|
22
24
|
export {default as NodePyATVDeviceEvent} from './device-event.js';
|
|
23
25
|
export {default as NodePyATVDeviceEvents} from './device-events.js';
|
|
24
26
|
export {default as NodePyATVDevice} from './device.js';
|
|
27
|
+
export {default as NodePyATVInstance} from './instance.js';
|
|
25
28
|
|
|
26
29
|
export {default} from './instance.js';
|
package/src/lib/instance.ts
CHANGED
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
NodePyATVExecutableType,
|
|
11
11
|
NodePyATVFindAndInstanceOptions,
|
|
12
12
|
NodePyATVInstanceOptions,
|
|
13
|
+
NodePyATVInternalScanDevice,
|
|
13
14
|
NodePyATVVersionResponse
|
|
14
15
|
} from './types.js';
|
|
15
16
|
|
|
@@ -117,11 +118,16 @@ export default class NodePyATVInstance {
|
|
|
117
118
|
throw new Error(`Unable to parse pyatv response: ${JSON.stringify(result, null, ' ')}`);
|
|
118
119
|
}
|
|
119
120
|
|
|
120
|
-
const objects = result.devices.map((device:
|
|
121
|
+
const objects = result.devices.map((device: NodePyATVInternalScanDevice) =>
|
|
121
122
|
this.device(Object.assign({}, options, {
|
|
122
123
|
host: device.address,
|
|
123
124
|
id: device.identifier,
|
|
124
|
-
name: device.name
|
|
125
|
+
name: device.name,
|
|
126
|
+
model: device.device_info?.model,
|
|
127
|
+
modelName: device.device_info?.model_str,
|
|
128
|
+
os: device.device_info?.operating_system,
|
|
129
|
+
version: device.device_info?.version,
|
|
130
|
+
services: device.services
|
|
125
131
|
}))
|
|
126
132
|
);
|
|
127
133
|
|
package/src/lib/types.ts
CHANGED
|
@@ -147,12 +147,38 @@ export interface NodePyATVFindAndInstanceOptions extends NodePyATVInstanceOption
|
|
|
147
147
|
export interface NodePyATVDeviceOptions extends NodePyATVFindAndInstanceOptions {
|
|
148
148
|
host: string;
|
|
149
149
|
name: string;
|
|
150
|
+
model?: string;
|
|
151
|
+
modelName?: string;
|
|
152
|
+
os?: string;
|
|
153
|
+
version?: string;
|
|
154
|
+
services?: NodePyATVService[];
|
|
150
155
|
}
|
|
151
156
|
|
|
152
157
|
export interface NodePyATVGetStateOptions {
|
|
153
158
|
maxAge?: number;
|
|
154
159
|
}
|
|
155
160
|
|
|
161
|
+
export interface NodePyATVService {
|
|
162
|
+
protocol: NodePyATVProtocol;
|
|
163
|
+
port: number;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* @internal
|
|
168
|
+
*/
|
|
169
|
+
export interface NodePyATVInternalScanDevice {
|
|
170
|
+
name: string;
|
|
171
|
+
address: string;
|
|
172
|
+
identifier: string;
|
|
173
|
+
device_info?: {
|
|
174
|
+
model: string;
|
|
175
|
+
model_str: string;
|
|
176
|
+
operating_system: string;
|
|
177
|
+
version: string;
|
|
178
|
+
};
|
|
179
|
+
services?: NodePyATVService[];
|
|
180
|
+
}
|
|
181
|
+
|
|
156
182
|
/**
|
|
157
183
|
* @internal
|
|
158
184
|
*/
|
package/test/device.ts
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
NodePyATVShuffleState
|
|
12
12
|
} from '../src/lib/types.js';
|
|
13
13
|
import NodePyATVInstance from '../src/lib/instance.js';
|
|
14
|
-
import {createFakeSpawn} from '../src/lib/fake-spawn.js';
|
|
14
|
+
import { createFakeSpawn } from '../src/lib/fake-spawn.js';
|
|
15
15
|
|
|
16
16
|
describe('NodePyATVDevice', function () {
|
|
17
17
|
describe('get name()', function () {
|
|
@@ -60,6 +60,129 @@ describe('NodePyATVDevice', function () {
|
|
|
60
60
|
});
|
|
61
61
|
});
|
|
62
62
|
|
|
63
|
+
describe('get model()', function () {
|
|
64
|
+
it('should return the model if set by scan', function () {
|
|
65
|
+
const device = new NodePyATVDevice({
|
|
66
|
+
name: 'Vardagsrum',
|
|
67
|
+
host: '10.0.10.81',
|
|
68
|
+
id: 'xxx',
|
|
69
|
+
model: 'Gen4K'
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
assert.strictEqual(device.model, 'Gen4K');
|
|
73
|
+
});
|
|
74
|
+
it('should return undefined otherwise', function () {
|
|
75
|
+
const device = new NodePyATVDevice({
|
|
76
|
+
name: 'Vardagsrum',
|
|
77
|
+
host: '10.0.10.81'
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
assert.strictEqual(device.model, undefined);
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
describe('get modelName()', function () {
|
|
85
|
+
it('should return the model name if set by scan', function () {
|
|
86
|
+
const device = new NodePyATVDevice({
|
|
87
|
+
name: 'Vardagsrum',
|
|
88
|
+
host: '10.0.10.81',
|
|
89
|
+
id: 'xxx',
|
|
90
|
+
modelName: 'Apple TV 4K'
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
assert.strictEqual(device.modelName, 'Apple TV 4K');
|
|
94
|
+
});
|
|
95
|
+
it('should return undefined otherwise', function () {
|
|
96
|
+
const device = new NodePyATVDevice({
|
|
97
|
+
name: 'Vardagsrum',
|
|
98
|
+
host: '10.0.10.81'
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
assert.strictEqual(device.modelName, undefined);
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
describe('get os()', function () {
|
|
106
|
+
it('should return the operating system if set by scan', function () {
|
|
107
|
+
const device = new NodePyATVDevice({
|
|
108
|
+
name: 'Vardagsrum',
|
|
109
|
+
host: '10.0.10.81',
|
|
110
|
+
id: 'xxx',
|
|
111
|
+
os: 'TvOS'
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
assert.strictEqual(device.os, 'TvOS');
|
|
115
|
+
});
|
|
116
|
+
it('should return undefined otherwise', function () {
|
|
117
|
+
const device = new NodePyATVDevice({
|
|
118
|
+
name: 'Vardagsrum',
|
|
119
|
+
host: '10.0.10.81'
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
assert.strictEqual(device.os, undefined);
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
describe('get version()', function () {
|
|
127
|
+
it('should return the version if set by scan', function () {
|
|
128
|
+
const device = new NodePyATVDevice({
|
|
129
|
+
name: 'Vardagsrum',
|
|
130
|
+
host: '10.0.10.81',
|
|
131
|
+
id: 'xxx',
|
|
132
|
+
version: '15.5.1'
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
assert.strictEqual(device.version, '15.5.1');
|
|
136
|
+
});
|
|
137
|
+
it('should return undefined otherwise', function () {
|
|
138
|
+
const device = new NodePyATVDevice({
|
|
139
|
+
name: 'Vardagsrum',
|
|
140
|
+
host: '10.0.10.81'
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
assert.strictEqual(device.version, undefined);
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
describe('get services()', function () {
|
|
148
|
+
it('should return the services if set by scan', function () {
|
|
149
|
+
const device = new NodePyATVDevice({
|
|
150
|
+
name: 'Vardagsrum',
|
|
151
|
+
host: '10.0.10.81',
|
|
152
|
+
id: 'xxx',
|
|
153
|
+
services: [
|
|
154
|
+
{
|
|
155
|
+
protocol: NodePyATVProtocol.mrp,
|
|
156
|
+
port: 49152
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
protocol: NodePyATVProtocol.airplay,
|
|
160
|
+
port: 7000
|
|
161
|
+
}
|
|
162
|
+
]
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
assert.deepStrictEqual(device.services, [
|
|
166
|
+
{
|
|
167
|
+
protocol: 'mrp',
|
|
168
|
+
port: 49152
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
protocol: 'airplay',
|
|
172
|
+
port: 7000
|
|
173
|
+
}
|
|
174
|
+
]);
|
|
175
|
+
});
|
|
176
|
+
it('should return undefined otherwise', function () {
|
|
177
|
+
const device = new NodePyATVDevice({
|
|
178
|
+
name: 'Vardagsrum',
|
|
179
|
+
host: '10.0.10.81'
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
assert.strictEqual(device.services, undefined);
|
|
183
|
+
});
|
|
184
|
+
});
|
|
185
|
+
|
|
63
186
|
describe('get debug()', function () {
|
|
64
187
|
it('should return true if set to true', function () {
|
|
65
188
|
const device = new NodePyATVDevice({
|
package/test/instance.ts
CHANGED
|
@@ -7,15 +7,15 @@ import { fileURLToPath } from 'url';
|
|
|
7
7
|
|
|
8
8
|
import { createFakeSpawn } from '../src/lib/fake-spawn.js';
|
|
9
9
|
import NodePyATVInstance, {
|
|
10
|
-
NodePyATVProtocol,
|
|
11
|
-
NodePyATVMediaType,
|
|
12
10
|
NodePyATVDeviceEvent,
|
|
13
11
|
NodePyATVDeviceState,
|
|
14
|
-
NodePyATVRepeatState,
|
|
15
|
-
NodePyATVShuffleState,
|
|
16
12
|
NodePyATVKeys,
|
|
17
13
|
NodePyATVListenerState,
|
|
18
|
-
|
|
14
|
+
NodePyATVMediaType,
|
|
15
|
+
NodePyATVPowerState,
|
|
16
|
+
NodePyATVProtocol,
|
|
17
|
+
NodePyATVRepeatState,
|
|
18
|
+
NodePyATVShuffleState
|
|
19
19
|
} from '../src/lib/index.js';
|
|
20
20
|
|
|
21
21
|
const __filename = fileURLToPath(import.meta.url);
|
|
@@ -257,6 +257,85 @@ describe('NodePyATVInstance', function () {
|
|
|
257
257
|
});
|
|
258
258
|
}, /Unable to parse pyatv response: /);
|
|
259
259
|
});
|
|
260
|
+
it('should work if devices are without device_info / services', async function () {
|
|
261
|
+
const devices = await NodePyATVInstance.find({
|
|
262
|
+
spawn: createFakeSpawn(cp => {
|
|
263
|
+
cp.stdout({
|
|
264
|
+
result: 'success',
|
|
265
|
+
datetime: '2020-11-06T20:47:30.840022+01:00',
|
|
266
|
+
devices: [
|
|
267
|
+
{
|
|
268
|
+
name: 'Vardagsrum',
|
|
269
|
+
address: '10.0.10.81',
|
|
270
|
+
identifier: 'xxx'
|
|
271
|
+
}
|
|
272
|
+
]
|
|
273
|
+
}).code(1).end();
|
|
274
|
+
})
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
assert.strictEqual(devices.length, 1);
|
|
278
|
+
assert.strictEqual(devices[0].name, 'Vardagsrum');
|
|
279
|
+
assert.strictEqual(devices[0].host, '10.0.10.81');
|
|
280
|
+
assert.strictEqual(devices[0].id, 'xxx');
|
|
281
|
+
assert.strictEqual(devices[0].model, undefined);
|
|
282
|
+
assert.strictEqual(devices[0].modelName, undefined);
|
|
283
|
+
assert.strictEqual(devices[0].os, undefined);
|
|
284
|
+
assert.strictEqual(devices[0].version, undefined);
|
|
285
|
+
assert.deepStrictEqual(devices[0].services, undefined);
|
|
286
|
+
});
|
|
287
|
+
it('should work if devices are with device_info / services', async function () {
|
|
288
|
+
const devices = await NodePyATVInstance.find({
|
|
289
|
+
spawn: createFakeSpawn(cp => {
|
|
290
|
+
cp.stdout({
|
|
291
|
+
result: 'success',
|
|
292
|
+
datetime: '2020-11-06T20:47:30.840022+01:00',
|
|
293
|
+
devices: [
|
|
294
|
+
{
|
|
295
|
+
name: 'Vardagsrum',
|
|
296
|
+
address: '10.0.10.81',
|
|
297
|
+
identifier: 'xxx',
|
|
298
|
+
device_info: {
|
|
299
|
+
'model': 'Gen4K',
|
|
300
|
+
'model_str': 'Apple TV 4K',
|
|
301
|
+
'operating_system': 'TvOS',
|
|
302
|
+
'version': '15.5.1'
|
|
303
|
+
},
|
|
304
|
+
services: [
|
|
305
|
+
{
|
|
306
|
+
protocol: 'mrp',
|
|
307
|
+
port: 49152
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
protocol: 'airplay',
|
|
311
|
+
port: 7000
|
|
312
|
+
}
|
|
313
|
+
]
|
|
314
|
+
}
|
|
315
|
+
]
|
|
316
|
+
}).code(1).end();
|
|
317
|
+
})
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
assert.strictEqual(devices.length, 1);
|
|
321
|
+
assert.strictEqual(devices[0].name, 'Vardagsrum');
|
|
322
|
+
assert.strictEqual(devices[0].host, '10.0.10.81');
|
|
323
|
+
assert.strictEqual(devices[0].id, 'xxx');
|
|
324
|
+
assert.strictEqual(devices[0].model, 'Gen4K');
|
|
325
|
+
assert.strictEqual(devices[0].modelName, 'Apple TV 4K');
|
|
326
|
+
assert.strictEqual(devices[0].os, 'TvOS');
|
|
327
|
+
assert.strictEqual(devices[0].version, '15.5.1');
|
|
328
|
+
assert.deepStrictEqual(devices[0].services, [
|
|
329
|
+
{
|
|
330
|
+
protocol: NodePyATVProtocol.mrp,
|
|
331
|
+
port: 49152
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
protocol: NodePyATVProtocol.airplay,
|
|
335
|
+
port: 7000
|
|
336
|
+
}
|
|
337
|
+
]);
|
|
338
|
+
});
|
|
260
339
|
});
|
|
261
340
|
|
|
262
341
|
describe('static device()', function () {
|