@gibme/tablo.tv 20.0.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/LICENSE +19 -0
- package/README.md +0 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +33 -0
- package/dist/index.js.map +1 -0
- package/dist/lighthouse.d.ts +155 -0
- package/dist/lighthouse.js +308 -0
- package/dist/lighthouse.js.map +1 -0
- package/dist/live_transcoder.d.ts +92 -0
- package/dist/live_transcoder.js +289 -0
- package/dist/live_transcoder.js.map +1 -0
- package/dist/tablo.d.ts +362 -0
- package/dist/tablo.js +465 -0
- package/dist/tablo.js.map +1 -0
- package/dist/tablo_api.d.ts +101 -0
- package/dist/tablo_api.js +228 -0
- package/dist/tablo_api.js.map +1 -0
- package/dist/types.d.ts +4 -0
- package/dist/types.js +22 -0
- package/dist/types.js.map +1 -0
- package/package.json +67 -0
package/dist/tablo.js
ADDED
|
@@ -0,0 +1,465 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright (c) 2025, Brandon Lehmann <brandonlehmann@gmail.com>
|
|
3
|
+
//
|
|
4
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
// of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
// in the Software without restriction, including without limitation the rights
|
|
7
|
+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
// copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
// furnished to do so, subject to the following conditions:
|
|
10
|
+
//
|
|
11
|
+
// The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
// copies or substantial portions of the Software.
|
|
13
|
+
//
|
|
14
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
// SOFTWARE.
|
|
21
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
22
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
23
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
24
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
25
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
26
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
27
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
31
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
32
|
+
};
|
|
33
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
|
+
exports.Tablo = void 0;
|
|
35
|
+
const tablo_api_1 = __importDefault(require("./tablo_api"));
|
|
36
|
+
const lighthouse_1 = __importDefault(require("./lighthouse"));
|
|
37
|
+
const memory_1 = __importDefault(require("@gibme/cache/memory"));
|
|
38
|
+
/**
|
|
39
|
+
* See https://jessedp.github.io/tablo-api-docs/#tablo-api-introduction
|
|
40
|
+
* for an extensive list of device endpoints
|
|
41
|
+
*
|
|
42
|
+
* Note: this implementation is currently incomplete and is unlikely to have all endpoints implemented.
|
|
43
|
+
*/
|
|
44
|
+
class Tablo extends tablo_api_1.default {
|
|
45
|
+
constructor() {
|
|
46
|
+
super(...arguments);
|
|
47
|
+
this.cache = new memory_1.default({ stdTTL: 10 * 60 * 1000 });
|
|
48
|
+
this.session_channels = new Map();
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Attempts to discover the Tablo devices on the network from which this API is made.
|
|
52
|
+
* @param timeout
|
|
53
|
+
*/
|
|
54
|
+
static discover() {
|
|
55
|
+
return __awaiter(this, arguments, void 0, function* (timeout = 2000) {
|
|
56
|
+
return lighthouse_1.default.listAvailableDevices(timeout);
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Returns the currently available airings
|
|
61
|
+
*
|
|
62
|
+
* Note: This method contains a loop that results in the method taking a bit of time to complete,
|
|
63
|
+
* you may specify a progress callback to help report the progress to the caller.
|
|
64
|
+
*
|
|
65
|
+
* Repeated calls to this method are cached for approximately 10 minutes.
|
|
66
|
+
*
|
|
67
|
+
* @param all if true, will return all airings, otherwise will only return airings that are currently playing.
|
|
68
|
+
* @param timeout
|
|
69
|
+
* @param force_refresh if set to true, will force a refresh of the cache.
|
|
70
|
+
* @param progress_callback
|
|
71
|
+
*/
|
|
72
|
+
airings() {
|
|
73
|
+
return __awaiter(this, arguments, void 0, function* (all = false, timeout = this.timeout, force_refresh = false, progress_callback) {
|
|
74
|
+
var _a, _b;
|
|
75
|
+
const progress = (total, received) => {
|
|
76
|
+
if (progress_callback) {
|
|
77
|
+
progress_callback(total, received);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
const { now, start } = this.currentHour;
|
|
81
|
+
try {
|
|
82
|
+
const result = !force_refresh ? (_a = yield this.cache.get('airings')) !== null && _a !== void 0 ? _a : [] : [];
|
|
83
|
+
if (result.length === 0) {
|
|
84
|
+
let airings = (_b = yield this.get('/guide/airings', undefined, timeout)) !== null && _b !== void 0 ? _b : [];
|
|
85
|
+
const total = airings.length;
|
|
86
|
+
progress(total, result.length);
|
|
87
|
+
while (airings.length > 0) {
|
|
88
|
+
const batch = airings.slice(0, 50);
|
|
89
|
+
airings = airings.slice(50);
|
|
90
|
+
const data = yield this.batch(batch, timeout);
|
|
91
|
+
result.push(...Object.entries(data)
|
|
92
|
+
.map(([, response]) => {
|
|
93
|
+
return {
|
|
94
|
+
show_title: response.airing_details.show_title,
|
|
95
|
+
start_time: new Date(response.airing_details.datetime),
|
|
96
|
+
end_time: new Date(this.calculate_endtime(response.airing_details.datetime, response.airing_details.duration)),
|
|
97
|
+
duration: response.airing_details.duration,
|
|
98
|
+
episode: Object.assign(Object.assign({}, response.episode), { orig_air_date: new Date(response.episode.orig_air_date) }),
|
|
99
|
+
channel: Object.assign({}, response.airing_details.channel.channel)
|
|
100
|
+
};
|
|
101
|
+
}));
|
|
102
|
+
progress(total, result.length);
|
|
103
|
+
}
|
|
104
|
+
yield this.cache.set('airings', result);
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
progress(result.length, result.length);
|
|
108
|
+
}
|
|
109
|
+
return result.filter(airing => {
|
|
110
|
+
if (all) {
|
|
111
|
+
return true;
|
|
112
|
+
}
|
|
113
|
+
const start_time = new Date(airing.start_time).getTime();
|
|
114
|
+
const end_time = new Date(airing.end_time).getTime();
|
|
115
|
+
return start_time >= start && start_time < now && end_time > now;
|
|
116
|
+
}).sort((a, b) => {
|
|
117
|
+
return (a.channel.major + (a.channel.minor * 0.1)) - (b.channel.major + (b.channel.minor * 0.1));
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
catch (error) {
|
|
121
|
+
return [];
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Retrieves account subscription information from the device
|
|
127
|
+
* @param timeout
|
|
128
|
+
*/
|
|
129
|
+
accountSubscription() {
|
|
130
|
+
return __awaiter(this, arguments, void 0, function* (timeout = this.timeout) {
|
|
131
|
+
try {
|
|
132
|
+
const response = yield this.get('/account/subscription', undefined, timeout);
|
|
133
|
+
if (response) {
|
|
134
|
+
return Object.assign(Object.assign({}, response), { subscriptions: response.subscriptions.map(subscription => {
|
|
135
|
+
return Object.assign(Object.assign({}, subscription), { expires: subscription.expires ? new Date(subscription.expires) : null });
|
|
136
|
+
}) });
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
catch (_a) {
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Retrieves the capabilities of the device.
|
|
145
|
+
* @param timeout
|
|
146
|
+
*/
|
|
147
|
+
capabilities() {
|
|
148
|
+
return __awaiter(this, arguments, void 0, function* (timeout = this.timeout) {
|
|
149
|
+
var _a;
|
|
150
|
+
try {
|
|
151
|
+
const response = yield this.get('/server/capabilities', undefined, timeout);
|
|
152
|
+
return (_a = response === null || response === void 0 ? void 0 : response.capabilities) !== null && _a !== void 0 ? _a : [];
|
|
153
|
+
}
|
|
154
|
+
catch (_b) {
|
|
155
|
+
return [];
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
channel(channel_id_1) {
|
|
160
|
+
return __awaiter(this, arguments, void 0, function* (channel_id, timeout = this.timeout) {
|
|
161
|
+
const channels = yield this.channels(timeout);
|
|
162
|
+
return channels.find(elem => elem.channel_identifier === channel_id);
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Returns a list of the available channels on the device.
|
|
167
|
+
* @param timeout
|
|
168
|
+
*/
|
|
169
|
+
channels() {
|
|
170
|
+
return __awaiter(this, arguments, void 0, function* (timeout = this.timeout) {
|
|
171
|
+
var _a;
|
|
172
|
+
try {
|
|
173
|
+
const channels = (_a = yield this.get('/guide/channels')) !== null && _a !== void 0 ? _a : [];
|
|
174
|
+
if (channels.length === 0) {
|
|
175
|
+
return [];
|
|
176
|
+
}
|
|
177
|
+
const channel_data = yield this.batch(channels, timeout);
|
|
178
|
+
return Object.entries(channel_data)
|
|
179
|
+
.map(([, response]) => {
|
|
180
|
+
return Object.assign({}, response.channel);
|
|
181
|
+
})
|
|
182
|
+
.sort((a, b) => {
|
|
183
|
+
return (a.major + (a.minor * 0.1)) - (b.major + (b.minor * 0.1));
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
catch (_b) {
|
|
187
|
+
return [];
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Retrieves information regarding the latest (or a specified) channel scan.
|
|
193
|
+
*
|
|
194
|
+
* @param scan_idx if not specified, will pull the latest channel scan information
|
|
195
|
+
* @param timeout
|
|
196
|
+
*/
|
|
197
|
+
channelScanInfo(scan_idx_1) {
|
|
198
|
+
return __awaiter(this, arguments, void 0, function* (scan_idx, timeout = this.timeout) {
|
|
199
|
+
try {
|
|
200
|
+
if (!scan_idx) {
|
|
201
|
+
const response = yield this.get('/channels/info', undefined, timeout);
|
|
202
|
+
if (response === null || response === void 0 ? void 0 : response.committed_scan) {
|
|
203
|
+
const [, , , scan_idx] = response.committed_scan.split('/');
|
|
204
|
+
return this.channelScanInfo(scan_idx, timeout);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
const response = yield this.get(`/channels/scans/${scan_idx}`);
|
|
209
|
+
if (response) {
|
|
210
|
+
return Object.assign(Object.assign({}, response), { datetime: new Date(response.datetime) });
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
catch (_a) {
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Deletes/stops an existing watch (streaming) session
|
|
220
|
+
* @param tokenOrPlayerSession
|
|
221
|
+
* @param timeout
|
|
222
|
+
*/
|
|
223
|
+
deleteSession(tokenOrPlayerSession_1) {
|
|
224
|
+
return __awaiter(this, arguments, void 0, function* (tokenOrPlayerSession, timeout = this.timeout) {
|
|
225
|
+
const token = typeof tokenOrPlayerSession === 'string' ? tokenOrPlayerSession : tokenOrPlayerSession.token;
|
|
226
|
+
try {
|
|
227
|
+
const success = yield this.delete(`/player/sessions/${token}`, { lh: undefined }, timeout);
|
|
228
|
+
if (success) {
|
|
229
|
+
this.session_channels.delete(token);
|
|
230
|
+
}
|
|
231
|
+
return success;
|
|
232
|
+
}
|
|
233
|
+
catch (_a) {
|
|
234
|
+
return false;
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Retrieves device subscription information.
|
|
240
|
+
* @param timeout
|
|
241
|
+
*/
|
|
242
|
+
deviceSubscription() {
|
|
243
|
+
return __awaiter(this, arguments, void 0, function* (timeout = this.timeout) {
|
|
244
|
+
try {
|
|
245
|
+
const response = yield this.get('/server/subscription', undefined, timeout);
|
|
246
|
+
if (response) {
|
|
247
|
+
return Object.assign(Object.assign({}, response), { expires: response.expires ? new Date(response.expires) : null });
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
catch (_a) {
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Retrieves the guide status from the device
|
|
256
|
+
* @param timeout
|
|
257
|
+
*/
|
|
258
|
+
guideStatus() {
|
|
259
|
+
return __awaiter(this, arguments, void 0, function* (timeout = this.timeout) {
|
|
260
|
+
try {
|
|
261
|
+
const response = yield this.get('/server/guide/status', undefined, timeout);
|
|
262
|
+
if (response) {
|
|
263
|
+
return Object.assign(Object.assign({}, response), { last_update: new Date(response.last_update), limit: new Date(response.limit) });
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
catch (_a) {
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Retrieves a list of the hard drives connected to the device.
|
|
272
|
+
* @param timeout
|
|
273
|
+
*/
|
|
274
|
+
hardDrives() {
|
|
275
|
+
return __awaiter(this, arguments, void 0, function* (timeout = this.timeout) {
|
|
276
|
+
var _a;
|
|
277
|
+
try {
|
|
278
|
+
return ((_a = yield this.get('/server/harddrives', undefined, timeout)) !== null && _a !== void 0 ? _a : []);
|
|
279
|
+
}
|
|
280
|
+
catch (_b) {
|
|
281
|
+
return [];
|
|
282
|
+
}
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Retrieves device information
|
|
287
|
+
* @param timeout
|
|
288
|
+
*/
|
|
289
|
+
info() {
|
|
290
|
+
return __awaiter(this, arguments, void 0, function* (timeout = this.timeout) {
|
|
291
|
+
try {
|
|
292
|
+
return yield this.get('/server/info', undefined, timeout);
|
|
293
|
+
}
|
|
294
|
+
catch (_a) {
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Sends a watch (streaming) session keepalive request so that the session does not time out and stop
|
|
300
|
+
* @param tokenOrPlayerSession
|
|
301
|
+
* @param timeout
|
|
302
|
+
*/
|
|
303
|
+
keepaliveSession(tokenOrPlayerSession_1) {
|
|
304
|
+
return __awaiter(this, arguments, void 0, function* (tokenOrPlayerSession, timeout = this.timeout) {
|
|
305
|
+
const token = typeof tokenOrPlayerSession === 'string' ? tokenOrPlayerSession : tokenOrPlayerSession.token;
|
|
306
|
+
try {
|
|
307
|
+
const channel = this.session_channels.get(token);
|
|
308
|
+
const response = yield this.post(`/player/sessions/${token}/keepalive`, { lh: undefined }, undefined, timeout);
|
|
309
|
+
if (response) {
|
|
310
|
+
return Object.assign(Object.assign({}, response), { channel });
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
catch (_a) {
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Retrieves device location information
|
|
319
|
+
* @param timeout
|
|
320
|
+
*/
|
|
321
|
+
location() {
|
|
322
|
+
return __awaiter(this, arguments, void 0, function* (timeout = this.timeout) {
|
|
323
|
+
try {
|
|
324
|
+
return yield this.get('/server/location', undefined, timeout);
|
|
325
|
+
}
|
|
326
|
+
catch (_a) {
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* Attempts to retrieve an existing watch (streaming) session
|
|
332
|
+
* @param tokenOrPlayerSession
|
|
333
|
+
* @param timeout
|
|
334
|
+
*/
|
|
335
|
+
session(tokenOrPlayerSession_1) {
|
|
336
|
+
return __awaiter(this, arguments, void 0, function* (tokenOrPlayerSession, timeout = this.timeout) {
|
|
337
|
+
const token = typeof tokenOrPlayerSession === 'string' ? tokenOrPlayerSession : tokenOrPlayerSession.token;
|
|
338
|
+
try {
|
|
339
|
+
const channel = this.session_channels.get(token);
|
|
340
|
+
const response = yield this.get(`/player/sessions/${token}`, { lh: undefined }, timeout);
|
|
341
|
+
if (response) {
|
|
342
|
+
return Object.assign(Object.assign({}, response), { channel });
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
catch (_a) {
|
|
346
|
+
}
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* Retrieves the settings of the device.
|
|
351
|
+
* @param timeout
|
|
352
|
+
*/
|
|
353
|
+
settings() {
|
|
354
|
+
return __awaiter(this, arguments, void 0, function* (timeout = this.timeout) {
|
|
355
|
+
try {
|
|
356
|
+
return yield this.get('/settings/info', undefined, timeout);
|
|
357
|
+
}
|
|
358
|
+
catch (_a) {
|
|
359
|
+
}
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Retrieves the list of supported storage types.
|
|
364
|
+
* @param timeout
|
|
365
|
+
*/
|
|
366
|
+
storage() {
|
|
367
|
+
return __awaiter(this, arguments, void 0, function* (timeout = this.timeout) {
|
|
368
|
+
var _a;
|
|
369
|
+
try {
|
|
370
|
+
const response = yield this.get('/storage/info', undefined, timeout);
|
|
371
|
+
return (_a = response === null || response === void 0 ? void 0 : response.supported_kinds) !== null && _a !== void 0 ? _a : [];
|
|
372
|
+
}
|
|
373
|
+
catch (_b) {
|
|
374
|
+
return [];
|
|
375
|
+
}
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* Retrieves tuner information of the device.
|
|
380
|
+
* @param timeout
|
|
381
|
+
*/
|
|
382
|
+
tuners() {
|
|
383
|
+
return __awaiter(this, arguments, void 0, function* (timeout = this.timeout) {
|
|
384
|
+
var _a;
|
|
385
|
+
try {
|
|
386
|
+
// todo: resolve the channel property with actual information
|
|
387
|
+
return ((_a = yield this.get('/server/tuners', undefined, timeout)) !== null && _a !== void 0 ? _a : []);
|
|
388
|
+
}
|
|
389
|
+
catch (_b) {
|
|
390
|
+
return [];
|
|
391
|
+
}
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* Retrieves device update information.
|
|
396
|
+
* @param timeout
|
|
397
|
+
*/
|
|
398
|
+
updateInfo() {
|
|
399
|
+
return __awaiter(this, arguments, void 0, function* (timeout = this.timeout) {
|
|
400
|
+
try {
|
|
401
|
+
const response = yield this.get('/server/update/info', undefined, timeout);
|
|
402
|
+
if (response) {
|
|
403
|
+
return Object.assign(Object.assign({}, response), { last_checked: new Date(response.last_checked), last_update: response.last_update ? new Date(response.last_update) : null });
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
catch (_a) {
|
|
407
|
+
}
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* Retrieves device update progress information.
|
|
412
|
+
* @param timeout
|
|
413
|
+
*/
|
|
414
|
+
updateProgress() {
|
|
415
|
+
return __awaiter(this, arguments, void 0, function* (timeout = this.timeout) {
|
|
416
|
+
try {
|
|
417
|
+
return yield this.get('/server/update/progress', undefined, timeout);
|
|
418
|
+
}
|
|
419
|
+
catch (_a) {
|
|
420
|
+
}
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* Initiates a channel watch (streaming) session on the device which must be managed via
|
|
425
|
+
* `keepaliveSession` and `deleteSession`
|
|
426
|
+
* @param channel_id
|
|
427
|
+
* @param device_info
|
|
428
|
+
* @param timeout
|
|
429
|
+
*/
|
|
430
|
+
watchChannel(channel_id_1) {
|
|
431
|
+
return __awaiter(this, arguments, void 0, function* (channel_id, device_info = {}, timeout = 30000) {
|
|
432
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
433
|
+
var _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
434
|
+
(_a = device_info.device_id) !== null && _a !== void 0 ? _a : (device_info.device_id = this.device_id);
|
|
435
|
+
(_b = device_info.platform) !== null && _b !== void 0 ? _b : (device_info.platform = 'ios');
|
|
436
|
+
(_c = device_info.bandwidth) !== null && _c !== void 0 ? _c : (device_info.bandwidth = null);
|
|
437
|
+
(_d = device_info.extra) !== null && _d !== void 0 ? _d : (device_info.extra = {});
|
|
438
|
+
(_e = (_p = device_info.extra).deviceId) !== null && _e !== void 0 ? _e : (_p.deviceId = '00000000-0000-0000-0000-000000000000');
|
|
439
|
+
(_f = (_q = device_info.extra).width) !== null && _f !== void 0 ? _f : (_q.width = 640);
|
|
440
|
+
(_g = (_r = device_info.extra).height) !== null && _g !== void 0 ? _g : (_r.height = 480);
|
|
441
|
+
(_h = (_s = device_info.extra).deviceModel) !== null && _h !== void 0 ? _h : (_s.deviceModel = 'iPhone15,3');
|
|
442
|
+
(_j = (_t = device_info.extra).lang) !== null && _j !== void 0 ? _j : (_t.lang = 'en_US');
|
|
443
|
+
(_k = (_u = device_info.extra).deviceOS) !== null && _k !== void 0 ? _k : (_u.deviceOS = 'iOS');
|
|
444
|
+
(_l = (_v = device_info.extra).deviceOSVersion) !== null && _l !== void 0 ? _l : (_v.deviceOSVersion = '18.4.1');
|
|
445
|
+
(_m = (_w = device_info.extra).limitedAdTracking) !== null && _m !== void 0 ? _m : (_w.limitedAdTracking = 1);
|
|
446
|
+
(_o = (_x = device_info.extra).deviceMake) !== null && _o !== void 0 ? _o : (_x.deviceMake = 'Apple');
|
|
447
|
+
const info = yield this.info();
|
|
448
|
+
const channel = yield this.channel(channel_id);
|
|
449
|
+
if (info && channel) {
|
|
450
|
+
try {
|
|
451
|
+
const response = yield this.post(`/guide/channels/${channel_id}/watch`, { lh: undefined }, device_info, timeout);
|
|
452
|
+
if (response) {
|
|
453
|
+
this.session_channels.set(response.token, channel);
|
|
454
|
+
return Object.assign(Object.assign({}, response), { expires: new Date(response.expires), channel });
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
catch (_y) {
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
});
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
exports.Tablo = Tablo;
|
|
464
|
+
exports.default = Tablo;
|
|
465
|
+
//# sourceMappingURL=tablo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tablo.js","sourceRoot":"","sources":["../src/tablo.ts"],"names":[],"mappings":";AAAA,iEAAiE;AACjE,EAAE;AACF,+EAA+E;AAC/E,gFAAgF;AAChF,+EAA+E;AAC/E,4EAA4E;AAC5E,wEAAwE;AACxE,2DAA2D;AAC3D,EAAE;AACF,iFAAiF;AACjF,kDAAkD;AAClD,EAAE;AACF,6EAA6E;AAC7E,2EAA2E;AAC3E,8EAA8E;AAC9E,yEAAyE;AACzE,gFAAgF;AAChF,gFAAgF;AAChF,YAAY;;;;;;;;;;;;;;;AAEZ,4DAAmC;AACnC,8DAAsC;AAEtC,iEAAwC;AAExC;;;;;GAKG;AACH,MAAa,KAAM,SAAQ,mBAAQ;IAAnC;;QACqB,UAAK,GAAG,IAAI,gBAAK,CAAC,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC;QAC9C,qBAAgB,GAAG,IAAI,GAAG,EAAyB,CAAC;IA+dzE,CAAC;IA7dG;;;OAGG;IACI,MAAM,CAAO,QAAQ;6DAAE,OAAO,GAAG,IAAI;YACxC,OAAO,oBAAU,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;QACpD,CAAC;KAAA;IAED;;;;;;;;;;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CAAC,OAAO,CAAC,EACnC,OAAO,IACT;oBACN,CAAC;gBACL,CAAC;gBAAC,WAAM,CAAC;gBACT,CAAC;YACL,CAAC;QACL,CAAC;KAAA;CACJ;AAjeD,sBAieC;AAmPD,kBAAe,KAAK,CAAC"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import type { Tablo } from './tablo';
|
|
2
|
+
type Credentials = {
|
|
3
|
+
access_key: string;
|
|
4
|
+
secret_key: string;
|
|
5
|
+
};
|
|
6
|
+
export declare class TabloAPI {
|
|
7
|
+
private readonly options;
|
|
8
|
+
readonly device_id: string;
|
|
9
|
+
private readonly base_uri;
|
|
10
|
+
private readonly keys;
|
|
11
|
+
readonly timeout: number;
|
|
12
|
+
/**
|
|
13
|
+
* Constructs a new instance of the base API to interact with a Tablo device
|
|
14
|
+
* @param hostOrUri
|
|
15
|
+
* @param options
|
|
16
|
+
*/
|
|
17
|
+
constructor(hostOrUri: string, options: Partial<TabloAPI.Options> & Credentials);
|
|
18
|
+
/**
|
|
19
|
+
* Calculates the end time based upon the specified start time and duration
|
|
20
|
+
* @param start_time
|
|
21
|
+
* @param duration
|
|
22
|
+
* @protected
|
|
23
|
+
*/
|
|
24
|
+
protected calculate_endtime(start_time: string, duration: number): string;
|
|
25
|
+
/**
|
|
26
|
+
* Returns the current hour timestamps
|
|
27
|
+
* @protected
|
|
28
|
+
*/
|
|
29
|
+
protected get currentHour(): {
|
|
30
|
+
now: number;
|
|
31
|
+
start: number;
|
|
32
|
+
end: number;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Batch operations are much faster than a bunch of single operations.
|
|
36
|
+
* For example, instead of making 50 requests for the first 50 recordings
|
|
37
|
+
* returned by Recordings - Get Airings, you can take those 50 paths
|
|
38
|
+
* and make 1 request to /batch to receive all the same data.
|
|
39
|
+
* @param endpoints
|
|
40
|
+
* @param timeout
|
|
41
|
+
* @protected
|
|
42
|
+
*/
|
|
43
|
+
protected batch<ResponseType = any>(endpoints: string[], timeout?: number): Promise<Record<string, Tablo.Batched.Root & ResponseType>>;
|
|
44
|
+
/**
|
|
45
|
+
* Performs a DELETE request against the Tablo device
|
|
46
|
+
* @param endpoint
|
|
47
|
+
* @param params
|
|
48
|
+
* @param timeout
|
|
49
|
+
* @protected
|
|
50
|
+
*/
|
|
51
|
+
protected delete(endpoint: string, params?: Record<string, any>, timeout?: number): Promise<boolean>;
|
|
52
|
+
/**
|
|
53
|
+
* Performs a GET request against the Tablo device
|
|
54
|
+
* @param endpoint
|
|
55
|
+
* @param params
|
|
56
|
+
* @param timeout
|
|
57
|
+
* @param json
|
|
58
|
+
* @protected
|
|
59
|
+
*/
|
|
60
|
+
protected get<ResponseType = any>(endpoint: string, params?: Record<string, any>, timeout?: number, json?: boolean): Promise<ResponseType | undefined>;
|
|
61
|
+
/**
|
|
62
|
+
* Performs a PUT request against the Tablo device
|
|
63
|
+
* @param endpoint
|
|
64
|
+
* @param params
|
|
65
|
+
* @param payload
|
|
66
|
+
* @param timeout
|
|
67
|
+
* @param json
|
|
68
|
+
* @protected
|
|
69
|
+
*/
|
|
70
|
+
protected post<ResponseType = any>(endpoint: string, params?: Record<string, any>, payload?: object, timeout?: number, json?: boolean): Promise<ResponseType | undefined>;
|
|
71
|
+
/**
|
|
72
|
+
* Executes an API call to the Tablo device
|
|
73
|
+
* @param method
|
|
74
|
+
* @param endpoint
|
|
75
|
+
* @param params
|
|
76
|
+
* @param payload
|
|
77
|
+
* @param keys
|
|
78
|
+
* @param timeout
|
|
79
|
+
* @private
|
|
80
|
+
*/
|
|
81
|
+
private execute;
|
|
82
|
+
/**
|
|
83
|
+
* Generates the authentication header required for some of the Tablo device API calls
|
|
84
|
+
* @param method
|
|
85
|
+
* @param path
|
|
86
|
+
* @param body
|
|
87
|
+
* @param keys
|
|
88
|
+
* @private
|
|
89
|
+
*/
|
|
90
|
+
private generateAuthHeader;
|
|
91
|
+
}
|
|
92
|
+
export declare namespace TabloAPI {
|
|
93
|
+
type Options = {
|
|
94
|
+
ssl: boolean;
|
|
95
|
+
device_id: string;
|
|
96
|
+
timeout: number;
|
|
97
|
+
request_logging: boolean;
|
|
98
|
+
port: number;
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
export default TabloAPI;
|