@cldmv/node-android-tv-remote 1.5.5 → 2.1.0
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/README.md +297 -17
- package/index.cjs +30 -0
- package/index.mjs +24 -0
- package/package.json +26 -5
- package/scripts/{postinstall.js → postinstall.mjs} +15 -2
- package/scripts/{setup-device.js → setup-device.mjs} +15 -5
- package/scripts/wake-tv.mjs +51 -0
- package/src/data/keyboard-keys.json +73 -0
- package/src/lib/android-tv-remote.mjs +1804 -0
- package/.gitattributes +0 -8
- package/.prettierrc +0 -15
- package/docs/KEYBOARD_KEYS.md +0 -80
- package/docs/KEYCODES.md +0 -55
- package/eslint.config.mjs +0 -45
- package/scripts/test-keycodes.js +0 -0
- package/src/lib/adb/setup.js +0 -144
- package/src/lib/android-tv-remote.js +0 -859
- package/test/android-tv-remote.test.js +0 -74
- package/test/api-surface.test.js +0 -50
- package/test/connect-readall.js +0 -35
- package/test/interactive-remote.js +0 -69
package/README.md
CHANGED
|
@@ -18,7 +18,21 @@
|
|
|
18
18
|
|
|
19
19
|
## Overview
|
|
20
20
|
|
|
21
|
-
A Node.js module for controlling Android TV devices via ADB. Supports sending keycodes, keyboard input, and remote control commands. Designed for compatibility with a wide range of Android TV devices, including Fire TV, Chromecast with Google TV, and more.
|
|
21
|
+
A modern, **event-driven** Node.js module for controlling Android TV devices via ADB. Supports sending keycodes, comprehensive keyboard input (71 characters with smart shift detection), and remote control commands. Designed for compatibility with a wide range of Android TV devices, including Fire TV, Chromecast with Google TV, and more.
|
|
22
|
+
|
|
23
|
+
### Key Features
|
|
24
|
+
|
|
25
|
+
- 🎯 **Event-driven architecture** - Comprehensive event system with structured data
|
|
26
|
+
- ⌨️ **Comprehensive keyboard input** - 71 characters with smart shift detection and special symbols
|
|
27
|
+
- 🔄 **ESM & CommonJS support** - Works with both `import` and `require`
|
|
28
|
+
- 🛡️ **Error resilience** - Errors emit events instead of crashing your app
|
|
29
|
+
- 🔗 **Method chaining** - Fluent API for event listener management
|
|
30
|
+
- 📊 **Structured logging** - Timestamped, categorized log events with source tracking
|
|
31
|
+
- 🚀 **Promise-based** - Modern async/await support with callback compatibility
|
|
32
|
+
- 📸 **Advanced screencap** - High-performance PNG screenshots with resizing and thumbnails
|
|
33
|
+
- ⚡ **Performance optimized** - Direct PNG streaming with 20x speed improvements
|
|
34
|
+
- 🔄 **Device management** - Reboot, wake, settings configuration with event tracking
|
|
35
|
+
- 📱 **Universal compatibility** - Works with Fire TV, Chromecast, Shield, and more
|
|
22
36
|
|
|
23
37
|
## Installation
|
|
24
38
|
|
|
@@ -61,34 +75,300 @@ npm install android-tv-remote
|
|
|
61
75
|
|
|
62
76
|
## Usage
|
|
63
77
|
|
|
78
|
+
### Basic Usage
|
|
79
|
+
|
|
80
|
+
```js
|
|
64
81
|
```js
|
|
82
|
+
// ESM (Node.js with type: "module" in package.json)
|
|
83
|
+
import createRemote from "android-tv-remote";
|
|
84
|
+
|
|
85
|
+
// CommonJS
|
|
65
86
|
const createRemote = require("android-tv-remote");
|
|
66
|
-
const remote = createRemote({ ip: "192.168.1.100" });
|
|
67
87
|
|
|
68
|
-
//
|
|
69
|
-
await
|
|
88
|
+
// Create remote (async function)
|
|
89
|
+
const remote = await createRemote({ ip: "192.168.1.100" });
|
|
90
|
+
|
|
91
|
+
// Use with async/await (recommended)
|
|
92
|
+
await remote.press.home();
|
|
93
|
+
await remote.press.up();
|
|
94
|
+
await remote.press.ok();
|
|
95
|
+
|
|
96
|
+
// Or chain promises
|
|
97
|
+
createRemote({ ip: "192.168.1.100" })
|
|
98
|
+
.then(remote => remote.press.home())
|
|
99
|
+
.then(() => remote.press.up())
|
|
100
|
+
.then(() => remote.press.ok());
|
|
101
|
+
```
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Event-Driven Usage (Recommended)
|
|
105
|
+
|
|
106
|
+
This module uses an **event-driven architecture** instead of console logging. All operations emit structured events that you can listen to:
|
|
107
|
+
|
|
108
|
+
```js
|
|
109
|
+
import createRemote from "android-tv-remote";
|
|
110
|
+
|
|
111
|
+
const remote = await createRemote({ ip: "192.168.1.100" });
|
|
112
|
+
|
|
113
|
+
// Listen for log events (info, warn, error, debug)
|
|
114
|
+
remote.on("log", (data) => {
|
|
115
|
+
console.log(`[${data.level}] ${data.source}: ${data.message}`);
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
// Listen for error events
|
|
119
|
+
remote.on("error", (data) => {
|
|
120
|
+
console.error(`ERROR from ${data.source}:`, data.error.message);
|
|
121
|
+
|
|
122
|
+
// Handle specific error types
|
|
123
|
+
if (data.error.message.includes("device unauthorized")) {
|
|
124
|
+
console.log("Please authorize ADB on your Android TV device");
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
// Listen for screenshot events
|
|
129
|
+
remote.on("screencap-complete", (data) => {
|
|
130
|
+
console.log(`Screenshot completed in ${data.timing.total}ms`);
|
|
131
|
+
});
|
|
70
132
|
|
|
71
|
-
//
|
|
133
|
+
// Use the remote
|
|
72
134
|
await remote.press.home();
|
|
135
|
+
await remote.screencap({ filepath: './screenshot.png' });
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Async Initialization
|
|
139
|
+
|
|
140
|
+
The createRemote function is async and returns a Promise:
|
|
141
|
+
|
|
142
|
+
```js
|
|
143
|
+
import createRemote from "android-tv-remote";
|
|
144
|
+
|
|
145
|
+
// Async initialization with await
|
|
146
|
+
const remote = await createRemote({ ip: "192.168.1.100" });
|
|
147
|
+
remote.on("log", console.log);
|
|
148
|
+
await remote.press.play();
|
|
149
|
+
|
|
150
|
+
// Or use .then()
|
|
151
|
+
createRemote({ ip: "192.168.1.100" })
|
|
152
|
+
.then(remote => {
|
|
153
|
+
remote.on("log", console.log);
|
|
154
|
+
return remote.press.play();
|
|
155
|
+
});
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Screenshot Functionality
|
|
159
|
+
|
|
160
|
+
Advanced screencap with resizing, thumbnails, and file saving:
|
|
161
|
+
|
|
162
|
+
```js
|
|
163
|
+
import createRemote from "android-tv-remote";
|
|
164
|
+
|
|
165
|
+
const remote = await createRemote({ ip: "192.168.1.100" });
|
|
166
|
+
|
|
167
|
+
// Basic screenshot (returns PNG stream)
|
|
168
|
+
const stream = await remote.screencap();
|
|
169
|
+
|
|
170
|
+
// Screenshot with resizing
|
|
171
|
+
const resizedStream = await remote.screencap({ width: 1280, height: 720 });
|
|
172
|
+
|
|
173
|
+
// Save screenshot to file (non-blocking)
|
|
174
|
+
await remote.screencap({ filepath: './screenshot.png' });
|
|
175
|
+
|
|
176
|
+
// Resized screenshot saved to file
|
|
177
|
+
await remote.screencap({
|
|
178
|
+
width: 640,
|
|
179
|
+
height: 360,
|
|
180
|
+
filepath: './thumbnail.png'
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
// Quick thumbnail (default 240px width)
|
|
184
|
+
const thumbStream = await remote.thumbnail();
|
|
73
185
|
|
|
74
|
-
//
|
|
75
|
-
await remote.
|
|
186
|
+
// Custom thumbnail dimensions
|
|
187
|
+
const customThumb = await remote.thumbnail({
|
|
188
|
+
width: 320,
|
|
189
|
+
height: 180,
|
|
190
|
+
filepath: './thumb.png'
|
|
191
|
+
});
|
|
76
192
|
|
|
77
|
-
//
|
|
193
|
+
// Access last screenshot data
|
|
194
|
+
console.log('Last screenshot available:', !!remote.lastScreencapData);
|
|
195
|
+
|
|
196
|
+
// Listen for screenshot events
|
|
197
|
+
remote.on('screencap-complete', (data) => {
|
|
198
|
+
console.log(`Screenshot completed in ${data.timing.total}ms`);
|
|
199
|
+
});
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### Device Management
|
|
203
|
+
|
|
204
|
+
Comprehensive device control with event tracking:
|
|
205
|
+
|
|
206
|
+
```js
|
|
207
|
+
import createRemote from "android-tv-remote";
|
|
208
|
+
|
|
209
|
+
const remote = await createRemote({ ip: "192.168.1.100" });
|
|
210
|
+
|
|
211
|
+
// Reboot the device
|
|
212
|
+
await remote.reboot();
|
|
213
|
+
|
|
214
|
+
// Ensure device is awake and responsive
|
|
215
|
+
const isAwake = await remote.ensureAwake();
|
|
216
|
+
|
|
217
|
+
// Configure optimal settings for remote control
|
|
218
|
+
await remote.setSettings(); // Set optimal settings
|
|
219
|
+
await remote.setSettings('get'); // Get current settings
|
|
220
|
+
|
|
221
|
+
// Wait for device to finish booting (after reboot)
|
|
222
|
+
await remote.waitBootComplete(60000); // 60 second timeout
|
|
223
|
+
|
|
224
|
+
// Connection management
|
|
225
|
+
await remote.connect();
|
|
226
|
+
console.log('Connected:', remote.isConnected);
|
|
78
227
|
await remote.disconnect();
|
|
228
|
+
|
|
229
|
+
// Listen for device management events
|
|
230
|
+
remote.on('log', (data) => {
|
|
231
|
+
if (data.source === 'reboot') {
|
|
232
|
+
console.log(`Reboot: ${data.message}`);
|
|
233
|
+
}
|
|
234
|
+
if (data.source === 'ensureAwake') {
|
|
235
|
+
console.log(`Wake: ${data.message}`);
|
|
236
|
+
}
|
|
237
|
+
});
|
|
79
238
|
```
|
|
80
239
|
|
|
81
|
-
|
|
240
|
+
### Keyboard Input
|
|
82
241
|
|
|
83
|
-
|
|
242
|
+
Comprehensive text input with individual key support and smart shift detection:
|
|
243
|
+
|
|
244
|
+
```js
|
|
245
|
+
import createRemote from "android-tv-remote";
|
|
246
|
+
|
|
247
|
+
const remote = await createRemote({ ip: "192.168.1.100" });
|
|
248
|
+
|
|
249
|
+
// Text input (recommended for typing sentences)
|
|
250
|
+
await remote.keyboard.text("Hello World!");
|
|
251
|
+
await remote.keyboard.text("user@example.com");
|
|
252
|
+
|
|
253
|
+
// Individual character input
|
|
254
|
+
await remote.keyboard.key.h(); // Types "h"
|
|
255
|
+
await remote.keyboard.key.e(); // Types "e"
|
|
256
|
+
await remote.keyboard.key.l(); // Types "l"
|
|
257
|
+
await remote.keyboard.key.l(); // Types "l"
|
|
258
|
+
await remote.keyboard.key.o(); // Types "o"
|
|
259
|
+
|
|
260
|
+
// Shifted characters (only available for keys that change when shifted)
|
|
261
|
+
await remote.keyboard.key.shift.h(); // Types "H"
|
|
262
|
+
await remote.keyboard.key.shift.one(); // Types "!"
|
|
263
|
+
await remote.keyboard.key.shift.semicolon(); // Types ":"
|
|
264
|
+
|
|
265
|
+
// Special characters and symbols
|
|
266
|
+
await remote.keyboard.key.space(); // Types " "
|
|
267
|
+
await remote.keyboard.key.exclamation(); // Types "!"
|
|
268
|
+
await remote.keyboard.key.at(); // Types "@"
|
|
269
|
+
await remote.keyboard.key.hash(); // Types "#"
|
|
270
|
+
await remote.keyboard.key.dollar(); // Types "$"
|
|
271
|
+
|
|
272
|
+
// Control keys
|
|
273
|
+
await remote.keyboard.key.tab(); // Tab character
|
|
274
|
+
await remote.keyboard.key.enter(); // Enter/Return
|
|
275
|
+
await remote.keyboard.key.backspace(); // Backspace
|
|
276
|
+
|
|
277
|
+
// Using keycode fallback (when available for regular keys)
|
|
278
|
+
await remote.keyboard.key.a.keycode(); // Sends keycode instead of character
|
|
279
|
+
|
|
280
|
+
// Note: Shift variants are only available for keys that actually change
|
|
281
|
+
// when shifted (letters, numbers, and some symbols). Special characters
|
|
282
|
+
// like @, #, !, etc. don't have shift variants since they're already
|
|
283
|
+
// the shifted form. Shift keys only support text input, not keycodes,
|
|
284
|
+
// since Android ADB doesn't support sending multiple keycodes simultaneously.
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
### Event Data Structure
|
|
288
|
+
|
|
289
|
+
**Log Events:**
|
|
290
|
+
|
|
291
|
+
```js
|
|
292
|
+
{
|
|
293
|
+
level: 'info' | 'warn' | 'error' | 'debug',
|
|
294
|
+
message: 'Human readable message',
|
|
295
|
+
source: 'connect' | 'disconnect' | 'screencap' | 'reboot' | 'ensureAwake' | etc,
|
|
296
|
+
timestamp: '2025-10-15T18:37:44.854Z',
|
|
297
|
+
data?: any // Optional additional data
|
|
298
|
+
}
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
**Error Events:**
|
|
302
|
+
|
|
303
|
+
```js
|
|
304
|
+
{
|
|
305
|
+
error: Error, // The actual error object
|
|
306
|
+
source: 'connect' | 'adb' | 'screencap' | 'reboot' | etc,
|
|
307
|
+
message: 'Human readable error message',
|
|
308
|
+
timestamp: '2025-10-15T18:37:44.854Z'
|
|
309
|
+
}
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
**Screenshot Events:**
|
|
313
|
+
|
|
314
|
+
```js
|
|
315
|
+
// screencap-complete event
|
|
316
|
+
{
|
|
317
|
+
timestamp: '2025-10-15T18:37:44.854Z',
|
|
318
|
+
filepath?: './screenshot.png', // If saved to file
|
|
319
|
+
processed: true, // Whether Sharp processing was used
|
|
320
|
+
width?: 1280,
|
|
321
|
+
height?: 720,
|
|
322
|
+
timing: {
|
|
323
|
+
capture: 25.4, // ADB capture time in ms
|
|
324
|
+
sharpProcess?: 1.2, // Sharp processing time in ms
|
|
325
|
+
total: 26.6 // Total operation time in ms
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
## API
|
|
84
331
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
- `
|
|
88
|
-
- `
|
|
89
|
-
- `keyboard.
|
|
90
|
-
- `
|
|
91
|
-
- `
|
|
332
|
+
### Main Methods
|
|
333
|
+
|
|
334
|
+
- `connect()` / `disconnect()` - Device connection management
|
|
335
|
+
- `press.<key>()` / `press.long.<key>()` - Remote control buttons
|
|
336
|
+
- `keyboard.text(text)` - Text input
|
|
337
|
+
- `keyboard.key.<key>()` / `keyboard.key.<key>.keycode()` - Individual keys (71 available)
|
|
338
|
+
- `keyboard.key.shift.<key>()` - Shifted keys (47 available, text input only)
|
|
339
|
+
- `inputKeycode(code)` - Raw Android keycodes
|
|
340
|
+
- `reboot()` - Reboot the Android TV device
|
|
341
|
+
- `ensureAwake()` - Ensure device is awake and responsive
|
|
342
|
+
- `setSettings(mode)` - Configure optimal Android TV settings
|
|
343
|
+
- `waitBootComplete(timeout)` - Wait for device boot completion
|
|
344
|
+
- `screencap(options)` - Take PNG screenshots with optional resizing and file saving
|
|
345
|
+
- `thumbnail(options)` - Take thumbnail screenshots (default 240px width)
|
|
346
|
+
|
|
347
|
+
### Event Methods
|
|
348
|
+
|
|
349
|
+
- `on(event, listener)` - Add event listener (returns remote for chaining)
|
|
350
|
+
- `off(event, listener)` - Remove event listener (returns remote for chaining)
|
|
351
|
+
- `once(event, listener)` - Add one-time event listener (returns remote for chaining)
|
|
352
|
+
- `emit(event, ...args)` - Emit custom events
|
|
353
|
+
|
|
354
|
+
### Events
|
|
355
|
+
|
|
356
|
+
- `log` - Emitted for all operations (info, warn, error, debug levels)
|
|
357
|
+
- `error` - Emitted when errors occur (structured error data)
|
|
358
|
+
- `screencap-start` - Emitted when screenshot capture begins
|
|
359
|
+
- `screencap-captured` - Emitted when raw screenshot is captured
|
|
360
|
+
- `screencap-processing` - Emitted when image processing begins
|
|
361
|
+
- `screencap-ready` - Emitted when processed stream is ready
|
|
362
|
+
- `screencap-saved` - Emitted when screenshot is saved to file
|
|
363
|
+
- `screencap-complete` - Emitted when entire screenshot operation completes
|
|
364
|
+
|
|
365
|
+
### Properties
|
|
366
|
+
|
|
367
|
+
- `isConnected` - Boolean indicating connection status
|
|
368
|
+
- `initPromise` - Promise that resolves when initialization completes
|
|
369
|
+
- `lastScreencapData` - Buffer/Stream containing the last captured screenshot data
|
|
370
|
+
|
|
371
|
+
See JSDoc comments in source code for full API documentation.
|
|
92
372
|
|
|
93
373
|
## Supported Devices
|
|
94
374
|
|
package/index.cjs
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @Project: @cldmv/node-android-tv-remote
|
|
3
|
+
* @Filename: /index.cjs
|
|
4
|
+
* @Date: 2025-10-15 10:29:19 -07:00 (1760549359)
|
|
5
|
+
* @Author: Nate Hyson <CLDMV>
|
|
6
|
+
* @Email: <Shinrai@users.noreply.github.com>
|
|
7
|
+
* -----
|
|
8
|
+
* @Last modified by: Nate Hyson <CLDMV> (Shinrai@users.noreply.github.com)
|
|
9
|
+
* @Last modified time: 2025-10-15 10:39:45 -07:00 (1760549985)
|
|
10
|
+
* -----
|
|
11
|
+
* @Copyright: Copyright (c) 2013-2025 Catalyzed Motivation Inc. All rights reserved.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* CommonJS entry point for @cldmv/node-android-tv-remote
|
|
16
|
+
*
|
|
17
|
+
* This file provides CommonJS (require) support for the Android TV Remote Library.
|
|
18
|
+
* It imports and re-exports the main createRemote function from the ESM module.
|
|
19
|
+
*
|
|
20
|
+
* @module @cldmv/node-android-tv-remote/cjs
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
const { createRequire } = require("module");
|
|
24
|
+
const requireESM = createRequire(__filename);
|
|
25
|
+
|
|
26
|
+
const { default: createRemote } = requireESM("./index.mjs");
|
|
27
|
+
|
|
28
|
+
module.exports = createRemote;
|
|
29
|
+
module.exports.createRemote = createRemote;
|
|
30
|
+
module.exports.default = createRemote;
|
package/index.mjs
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @Project: @cldmv/node-android-tv-remote
|
|
3
|
+
* @Filename: /index.mjs
|
|
4
|
+
* @Date: 2025-10-15 10:29:19 -07:00 (1760549359)
|
|
5
|
+
* @Author: Nate Hyson <CLDMV>
|
|
6
|
+
* @Email: <Shinrai@users.noreply.github.com>
|
|
7
|
+
* -----
|
|
8
|
+
* @Last modified by: Nate Hyson <CLDMV> (Shinrai@users.noreply.github.com)
|
|
9
|
+
* @Last modified time: 2025-10-15 10:40:23 -07:00 (1760550023)
|
|
10
|
+
* -----
|
|
11
|
+
* @Copyright: Copyright (c) 2013-2025 Catalyzed Motivation Inc. All rights reserved.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* ES Module entry point for @cldmv/node-android-tv-remote
|
|
16
|
+
*
|
|
17
|
+
* This file provides ES Module (import) support for the Android TV Remote Library.
|
|
18
|
+
* It imports and re-exports the main createRemote function and helper classes.
|
|
19
|
+
*
|
|
20
|
+
* @module @cldmv/node-android-tv-remote/esm
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
export { default } from "./src/lib/android-tv-remote.mjs";
|
|
24
|
+
export { default as createRemote, createAndroidTVRemote } from "./src/lib/android-tv-remote.mjs";
|
package/package.json
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cldmv/node-android-tv-remote",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "A Node.js library for controlling Android TV devices via ADB keycodes and text input.",
|
|
5
|
-
"
|
|
5
|
+
"type": "module",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"import": "./index.mjs",
|
|
9
|
+
"require": "./index.cjs"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
6
12
|
"scripts": {
|
|
7
13
|
"test": "jest",
|
|
8
|
-
"postinstall": "node scripts/postinstall.
|
|
9
|
-
"setup-device": "node scripts/setup-device.
|
|
14
|
+
"postinstall": "node scripts/postinstall.mjs",
|
|
15
|
+
"setup-device": "node scripts/setup-device.mjs"
|
|
10
16
|
},
|
|
11
17
|
"keywords": [
|
|
12
18
|
"android",
|
|
@@ -36,10 +42,25 @@
|
|
|
36
42
|
},
|
|
37
43
|
"homepage": "https://github.com/CLDMV/node-android-tv-remote#readme",
|
|
38
44
|
"license": "MIT",
|
|
45
|
+
"files": [
|
|
46
|
+
"src/",
|
|
47
|
+
"scripts/",
|
|
48
|
+
"index.mjs",
|
|
49
|
+
"index.cjs",
|
|
50
|
+
"README.md",
|
|
51
|
+
"package.json"
|
|
52
|
+
],
|
|
39
53
|
"dependencies": {
|
|
40
|
-
"adbkit": "
|
|
54
|
+
"@devicefarmer/adbkit": "^3.3.8",
|
|
55
|
+
"sharp": "^0.34.4"
|
|
41
56
|
},
|
|
42
57
|
"devDependencies": {
|
|
43
58
|
"jest": "^30.0.5"
|
|
59
|
+
},
|
|
60
|
+
"publishConfig": {
|
|
61
|
+
"access": "public"
|
|
62
|
+
},
|
|
63
|
+
"engines": {
|
|
64
|
+
"node": "^18.17.0 || ^20.3.0 || >=21.0.0"
|
|
44
65
|
}
|
|
45
66
|
}
|
|
@@ -1,8 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @Project: @cldmv/node-android-tv-remote
|
|
3
|
+
* @Filename: /scripts/postinstall.mjs
|
|
4
|
+
* @Date: 2025-10-15 10:19:05 -07:00 (1760548745)
|
|
5
|
+
* @Author: Nate Hyson <CLDMV>
|
|
6
|
+
* @Email: <Shinrai@users.noreply.github.com>
|
|
7
|
+
* -----
|
|
8
|
+
* @Last modified by: Nate Hyson <CLDMV> (Shinrai@users.noreply.github.com)
|
|
9
|
+
* @Last modified time: 2025-10-16 06:45:20 -07:00 (1760622320)
|
|
10
|
+
* -----
|
|
11
|
+
* @Copyright: Copyright (c) 2013-2025 Catalyzed Motivation Inc. All rights reserved.
|
|
12
|
+
*/
|
|
13
|
+
|
|
1
14
|
/**
|
|
2
15
|
* Postinstall script to check for adb and print install instructions if missing.
|
|
3
16
|
*/
|
|
4
|
-
|
|
5
|
-
|
|
17
|
+
import { execSync } from "child_process";
|
|
18
|
+
import os from "os";
|
|
6
19
|
|
|
7
20
|
function hasAdb() {
|
|
8
21
|
try {
|
|
@@ -1,7 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @Project: @cldmv/node-android-tv-remote
|
|
3
|
+
* @Filename: /scripts/setup-device.mjs
|
|
4
|
+
* @Date: 2025-10-15 10:19:05 -07:00 (1760548745)
|
|
5
|
+
* @Author: Nate Hyson <CLDMV>
|
|
6
|
+
* @Email: <Shinrai@users.noreply.github.com>
|
|
7
|
+
* -----
|
|
8
|
+
* @Last modified by: Nate Hyson <CLDMV> (Shinrai@users.noreply.github.com)
|
|
9
|
+
* @Last modified time: 2025-10-16 06:45:06 -07:00 (1760622306)
|
|
10
|
+
* -----
|
|
11
|
+
* @Copyright: Copyright (c) 2013-2025 Catalyzed Motivation Inc. All rights reserved.
|
|
12
|
+
*/
|
|
13
|
+
import readline from "readline";
|
|
14
|
+
import AndroidTVSetup from "../src/lib/adb/setup.mjs";
|
|
5
15
|
|
|
6
16
|
/**
|
|
7
17
|
* Interactive CLI for setting up a new Android TV device.
|
|
@@ -33,7 +43,7 @@ async function main() {
|
|
|
33
43
|
await setup.disconnect();
|
|
34
44
|
console.log("\nSetup complete!");
|
|
35
45
|
} catch (err) {
|
|
36
|
-
|
|
46
|
+
console.error("Error:", err.message || err);
|
|
37
47
|
process.exit(1);
|
|
38
48
|
}
|
|
39
49
|
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @Project: @cldmv/node-android-tv-remote
|
|
3
|
+
* @Filename: /scripts/wake-tv.mjs
|
|
4
|
+
* @Date: 2025-10-15 20:44:49 -07:00 (1760586289)
|
|
5
|
+
* @Author: Nate Hyson <CLDMV>
|
|
6
|
+
* @Email: <Shinrai@users.noreply.github.com>
|
|
7
|
+
* -----
|
|
8
|
+
* @Last modified by: Nate Hyson <CLDMV> (Shinrai@users.noreply.github.com)
|
|
9
|
+
* @Last modified time: 2025-10-15 20:46:13 -07:00 (1760586373)
|
|
10
|
+
* -----
|
|
11
|
+
* @Copyright: Copyright (c) 2013-2025 Catalyzed Motivation Inc. All rights reserved.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Wake up Android TV/Fire TV script
|
|
16
|
+
* Usage: node wake-tv.mjs <ip_address>
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import createRemote from "../src/lib/android-tv-remote.mjs";
|
|
20
|
+
|
|
21
|
+
// Get IP address from command line arguments
|
|
22
|
+
const ip = process.argv[2];
|
|
23
|
+
|
|
24
|
+
if (!ip) {
|
|
25
|
+
console.error("❌ Usage: node wake-tv.mjs <ip_address>");
|
|
26
|
+
console.error(" Example: node wake-tv.mjs 10.6.0.133");
|
|
27
|
+
process.exit(1);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
console.log(`🔌 Waking up TV at ${ip}...`);
|
|
31
|
+
|
|
32
|
+
try {
|
|
33
|
+
const remote = await createRemote({
|
|
34
|
+
ip: ip,
|
|
35
|
+
autoConnect: true,
|
|
36
|
+
quiet: false
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
console.log("✅ Connected to device");
|
|
40
|
+
|
|
41
|
+
// Wake up the device
|
|
42
|
+
await remote.ensureAwake();
|
|
43
|
+
console.log("🎉 TV should now be awake and ready!");
|
|
44
|
+
|
|
45
|
+
// Disconnect
|
|
46
|
+
await remote.disconnect();
|
|
47
|
+
console.log("✅ Disconnected from device");
|
|
48
|
+
} catch (error) {
|
|
49
|
+
console.error("❌ Failed to wake up TV:", error.message);
|
|
50
|
+
process.exit(1);
|
|
51
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
{
|
|
2
|
+
"a": "a",
|
|
3
|
+
"b": "b",
|
|
4
|
+
"c": "c",
|
|
5
|
+
"d": "d",
|
|
6
|
+
"e": "e",
|
|
7
|
+
"f": "f",
|
|
8
|
+
"g": "g",
|
|
9
|
+
"h": "h",
|
|
10
|
+
"i": "i",
|
|
11
|
+
"j": "j",
|
|
12
|
+
"k": "k",
|
|
13
|
+
"l": "l",
|
|
14
|
+
"m": "m",
|
|
15
|
+
"n": "n",
|
|
16
|
+
"o": "o",
|
|
17
|
+
"p": "p",
|
|
18
|
+
"q": "q",
|
|
19
|
+
"r": "r",
|
|
20
|
+
"s": "s",
|
|
21
|
+
"t": "t",
|
|
22
|
+
"u": "u",
|
|
23
|
+
"v": "v",
|
|
24
|
+
"w": "w",
|
|
25
|
+
"x": "x",
|
|
26
|
+
"y": "y",
|
|
27
|
+
"z": "z",
|
|
28
|
+
"0": "0",
|
|
29
|
+
"1": "1",
|
|
30
|
+
"2": "2",
|
|
31
|
+
"3": "3",
|
|
32
|
+
"4": "4",
|
|
33
|
+
"5": "5",
|
|
34
|
+
"6": "6",
|
|
35
|
+
"7": "7",
|
|
36
|
+
"8": "8",
|
|
37
|
+
"9": "9",
|
|
38
|
+
"space": " ",
|
|
39
|
+
"comma": ",",
|
|
40
|
+
"period": ".",
|
|
41
|
+
"semicolon": ";",
|
|
42
|
+
"apostrophe": "'",
|
|
43
|
+
"slash": "/",
|
|
44
|
+
"backslash": "\\",
|
|
45
|
+
"leftBracket": "[",
|
|
46
|
+
"rightBracket": "]",
|
|
47
|
+
"minus": "-",
|
|
48
|
+
"equals": "=",
|
|
49
|
+
"grave": "`",
|
|
50
|
+
"tab": "\t",
|
|
51
|
+
"enter": "\n",
|
|
52
|
+
"exclamation": "!",
|
|
53
|
+
"at": "@",
|
|
54
|
+
"hash": "#",
|
|
55
|
+
"dollar": "$",
|
|
56
|
+
"percent": "%",
|
|
57
|
+
"caret": "^",
|
|
58
|
+
"ampersand": "&",
|
|
59
|
+
"asterisk": "*",
|
|
60
|
+
"leftParen": "(",
|
|
61
|
+
"rightParen": ")",
|
|
62
|
+
"underscore": "_",
|
|
63
|
+
"plus": "+",
|
|
64
|
+
"leftBrace": "{",
|
|
65
|
+
"rightBrace": "}",
|
|
66
|
+
"pipe": "|",
|
|
67
|
+
"colon": ":",
|
|
68
|
+
"quote": "\"",
|
|
69
|
+
"lessThan": "<",
|
|
70
|
+
"greaterThan": ">",
|
|
71
|
+
"question": "?",
|
|
72
|
+
"tilde": "~"
|
|
73
|
+
}
|