@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 ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2025 Brandon Lehmann
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
package/README.md ADDED
File without changes
@@ -0,0 +1,5 @@
1
+ import Tablo from './tablo';
2
+ import Lighthouse from './lighthouse';
3
+ import LiveTranscoder from './live_transcoder';
4
+ export { Lighthouse, LiveTranscoder, Tablo };
5
+ export default Tablo;
package/dist/index.js ADDED
@@ -0,0 +1,33 @@
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 __importDefault = (this && this.__importDefault) || function (mod) {
22
+ return (mod && mod.__esModule) ? mod : { "default": mod };
23
+ };
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ exports.Tablo = exports.LiveTranscoder = exports.Lighthouse = void 0;
26
+ const tablo_1 = __importDefault(require("./tablo"));
27
+ exports.Tablo = tablo_1.default;
28
+ const lighthouse_1 = __importDefault(require("./lighthouse"));
29
+ exports.Lighthouse = lighthouse_1.default;
30
+ const live_transcoder_1 = __importDefault(require("./live_transcoder"));
31
+ exports.LiveTranscoder = live_transcoder_1.default;
32
+ exports.default = tablo_1.default;
33
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.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,oDAA4B;AAOxB,gBAPG,eAAK,CAOH;AANT,8DAAsC;AAIlC,qBAJG,oBAAU,CAIH;AAHd,wEAA+C;AAI3C,yBAJG,yBAAc,CAIH;AAIlB,kBAAe,eAAK,CAAC"}
@@ -0,0 +1,155 @@
1
+ import { Logo } from './types';
2
+ export declare class Lighthouse {
3
+ private readonly email;
4
+ private readonly password;
5
+ readonly timeout: number;
6
+ private readonly request_logging;
7
+ private static readonly base_uri;
8
+ private token?;
9
+ private context_token;
10
+ constructor(email: string, password: string, timeout?: number, request_logging?: boolean);
11
+ get authenticated(): boolean;
12
+ private get base_uri();
13
+ static execute<ResponseType = any>(method: string, endpoint: string, params?: Record<string, any>, payload?: Record<string, any> | string, timeout?: number): Promise<ResponseType>;
14
+ /**
15
+ * Retrieves a list of devices associated with the network from which this API call is made.
16
+ * @param timeout
17
+ */
18
+ static listAvailableDevices(timeout?: number): Promise<Lighthouse.Device[]>;
19
+ /**
20
+ * Retrieves a list of virtual devices associated with the network from which this API call is made.
21
+ * @param timeout
22
+ */
23
+ static listVirtualDevices(timeout?: number): Promise<Lighthouse.Device[]>;
24
+ /**
25
+ * Attempts to retrieve the specified virtual device associated with the network from which this API call is made.
26
+ * @param server_id
27
+ * @param timeout
28
+ */
29
+ static virtualDevice(server_id: string, timeout?: number): Promise<Lighthouse.Device | undefined>;
30
+ private static get;
31
+ /**
32
+ * Retrieves the account information
33
+ */
34
+ accountInfo(timeout?: number): Promise<Lighthouse.AccountInfo | undefined>;
35
+ /**
36
+ * Retrieves the current airing information for the specified channel within the specified device context
37
+ * @param channel_id
38
+ * @param context_token
39
+ * @param timeout
40
+ */
41
+ channelAirings(channel_id: string, context_token?: string, timeout?: number): Promise<Lighthouse.GuideAiring[]>;
42
+ /**
43
+ * Retrieves the list of live airings for the specified device context
44
+ * @param context_token
45
+ * @param timeout
46
+ */
47
+ currentLiveAirings(context_token?: string, timeout?: number): Promise<Lighthouse.LiveAiring[]>;
48
+ /**
49
+ * Retrieves a list of the devices associated with the account
50
+ */
51
+ devices(timeout?: number): Promise<Lighthouse.Device[]>;
52
+ /**
53
+ * Retrieves the list of channels available within the specified device context
54
+ * @param context_token
55
+ * @param timeout
56
+ */
57
+ guideChannels(context_token?: string, timeout?: number): Promise<Lighthouse.GuideChannel[]>;
58
+ /**
59
+ * Attempts to retrieve information regarding a specific device associated with the account
60
+ * @param server_id
61
+ * @param timeout
62
+ */
63
+ resolveDevice(server_id: string, timeout?: number): Promise<Lighthouse.Device | undefined>;
64
+ /**
65
+ * Selects the device context based upon the specified `profile_id` and `server_id`.
66
+ * @param profile_id
67
+ * @param server_id
68
+ * @param timeout
69
+ */
70
+ selectDeviceContext(profile_id: string, server_id: string, timeout?: number): Promise<string | undefined>;
71
+ protected get<ResponseType = any>(endpoint: string, params?: Record<string, any>, timeout?: number, token?: string): Promise<ResponseType>;
72
+ protected post<ResponseType = any>(endpoint: string, payload?: object, timeout?: number, token?: string): Promise<ResponseType>;
73
+ private authenticate;
74
+ private execute;
75
+ }
76
+ export declare namespace Lighthouse {
77
+ export type Device = {
78
+ serverId: string;
79
+ name: string;
80
+ type: string;
81
+ product: string;
82
+ version: string;
83
+ buildNumber: number;
84
+ registrationStatus: string;
85
+ lastSeen: string;
86
+ reachability: string;
87
+ url: string;
88
+ };
89
+ export type Profile = {
90
+ identifier: string;
91
+ name: string;
92
+ date_joined: string;
93
+ preferences: Record<string, any>;
94
+ };
95
+ export type AccountInfo = {
96
+ identifier: string;
97
+ is_verified: boolean;
98
+ email: string;
99
+ firstName: string;
100
+ lastName: string;
101
+ postalCode: string;
102
+ dma: string;
103
+ devices: Device[];
104
+ profiles: Profile[];
105
+ };
106
+ type OTA = {
107
+ major: number;
108
+ minor: number;
109
+ callsign: string;
110
+ network: string;
111
+ };
112
+ export type GuideChannel = {
113
+ identifier: string;
114
+ name: string;
115
+ kind: string;
116
+ logos: Logo[];
117
+ ota: OTA;
118
+ };
119
+ export type GuideAiring = {
120
+ identifier: string;
121
+ title: string;
122
+ channel: {
123
+ identifier: string;
124
+ };
125
+ datetime: string;
126
+ onnow: string;
127
+ description: string;
128
+ kind: string;
129
+ qualifiers: number;
130
+ genres: string[];
131
+ images: Logo[];
132
+ duration: number;
133
+ show: {
134
+ identifier: string;
135
+ title: string;
136
+ sortTitle: string;
137
+ sectionTitle: string;
138
+ };
139
+ episode: {
140
+ season: {
141
+ kind: string;
142
+ number: number;
143
+ };
144
+ episodeNumber: number;
145
+ originalAirDate: string;
146
+ rating: string;
147
+ };
148
+ };
149
+ export type LiveAiring = {
150
+ channel: GuideChannel;
151
+ airing: GuideAiring;
152
+ };
153
+ export {};
154
+ }
155
+ export default Lighthouse;
@@ -0,0 +1,308 @@
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.Lighthouse = void 0;
35
+ const fetch_1 = __importDefault(require("@gibme/fetch"));
36
+ const logger_1 = __importDefault(require("@gibme/logger"));
37
+ class Lighthouse {
38
+ // eslint-disable-next-line no-useless-constructor
39
+ constructor(email, password, timeout = 2000, request_logging = false) {
40
+ this.email = email;
41
+ this.password = password;
42
+ this.timeout = timeout;
43
+ this.request_logging = request_logging;
44
+ this.context_token = '';
45
+ }
46
+ get authenticated() {
47
+ return !!this.token;
48
+ }
49
+ get base_uri() {
50
+ return Lighthouse.base_uri;
51
+ }
52
+ static execute(method_1, endpoint_1) {
53
+ return __awaiter(this, arguments, void 0, function* (method, endpoint, params = {}, payload, timeout = 2000) {
54
+ const qs = new URLSearchParams();
55
+ for (const [key, value] of Object.entries(params)) {
56
+ qs.set(key, value);
57
+ }
58
+ const url = endpoint.includes('://')
59
+ ? `${endpoint}?${qs.toString()}`
60
+ : `${this.base_uri}${endpoint}?${qs.toString()}`;
61
+ const response = yield (0, fetch_1.default)(url, {
62
+ json: (method === 'PATCH' || method === 'POST' || method === 'PUT') ? payload : undefined,
63
+ method,
64
+ timeout
65
+ });
66
+ if (!response.ok) {
67
+ throw new Error(`${response.url} [${response.status}] ${response.statusText}`);
68
+ }
69
+ return yield response.json();
70
+ });
71
+ }
72
+ /**
73
+ * Retrieves a list of devices associated with the network from which this API call is made.
74
+ * @param timeout
75
+ */
76
+ static listAvailableDevices() {
77
+ return __awaiter(this, arguments, void 0, function* (timeout = 2000) {
78
+ var _a;
79
+ try {
80
+ return ((_a = yield this.get('/devices/', undefined, timeout)) !== null && _a !== void 0 ? _a : []);
81
+ }
82
+ catch (_b) {
83
+ return [];
84
+ }
85
+ });
86
+ }
87
+ /**
88
+ * Retrieves a list of virtual devices associated with the network from which this API call is made.
89
+ * @param timeout
90
+ */
91
+ static listVirtualDevices() {
92
+ return __awaiter(this, arguments, void 0, function* (timeout = 2000) {
93
+ var _a;
94
+ try {
95
+ return ((_a = yield this.get('/devices/virtual/', undefined, timeout)) !== null && _a !== void 0 ? _a : []);
96
+ }
97
+ catch (_b) {
98
+ return [];
99
+ }
100
+ });
101
+ }
102
+ /**
103
+ * Attempts to retrieve the specified virtual device associated with the network from which this API call is made.
104
+ * @param server_id
105
+ * @param timeout
106
+ */
107
+ static virtualDevice(server_id_1) {
108
+ return __awaiter(this, arguments, void 0, function* (server_id, timeout = 2000) {
109
+ try {
110
+ return yield this.get(`/devices/virtual/${server_id}/`, undefined, timeout);
111
+ }
112
+ catch (_a) {
113
+ }
114
+ });
115
+ }
116
+ static get(endpoint_1) {
117
+ return __awaiter(this, arguments, void 0, function* (endpoint, params = {}, timeout = 2000) {
118
+ return this.execute('GET', endpoint, params, undefined, timeout);
119
+ });
120
+ }
121
+ /**
122
+ * Retrieves the account information
123
+ */
124
+ accountInfo() {
125
+ return __awaiter(this, arguments, void 0, function* (timeout = this.timeout) {
126
+ try {
127
+ return yield this.get('/account/', undefined, timeout);
128
+ }
129
+ catch (_a) {
130
+ }
131
+ });
132
+ }
133
+ /**
134
+ * Retrieves the current airing information for the specified channel within the specified device context
135
+ * @param channel_id
136
+ * @param context_token
137
+ * @param timeout
138
+ */
139
+ channelAirings(channel_id_1) {
140
+ return __awaiter(this, arguments, void 0, function* (channel_id, context_token = this.context_token, timeout = this.timeout) {
141
+ var _a;
142
+ try {
143
+ return ((_a = yield this.get(`/account/guide/channels/${channel_id}/live/`, undefined, timeout, context_token)) !== null && _a !== void 0 ? _a : []);
144
+ }
145
+ catch (_b) {
146
+ return [];
147
+ }
148
+ });
149
+ }
150
+ /**
151
+ * Retrieves the list of live airings for the specified device context
152
+ * @param context_token
153
+ * @param timeout
154
+ */
155
+ currentLiveAirings() {
156
+ return __awaiter(this, arguments, void 0, function* (context_token = this.context_token, timeout = this.timeout) {
157
+ var _a;
158
+ try {
159
+ return ((_a = yield this.get(`/account/${context_token}/guide/channels/live/`, undefined, timeout, context_token)) !== null && _a !== void 0 ? _a : []);
160
+ }
161
+ catch (_b) {
162
+ return [];
163
+ }
164
+ });
165
+ }
166
+ /**
167
+ * Retrieves a list of the devices associated with the account
168
+ */
169
+ devices() {
170
+ return __awaiter(this, arguments, void 0, function* (timeout = this.timeout) {
171
+ var _a;
172
+ try {
173
+ return ((_a = yield this.get('/account/devices/', undefined, timeout)) !== null && _a !== void 0 ? _a : []);
174
+ }
175
+ catch (_b) {
176
+ return [];
177
+ }
178
+ });
179
+ }
180
+ /**
181
+ * Retrieves the list of channels available within the specified device context
182
+ * @param context_token
183
+ * @param timeout
184
+ */
185
+ guideChannels() {
186
+ return __awaiter(this, arguments, void 0, function* (context_token = this.context_token, timeout = this.timeout) {
187
+ var _a;
188
+ try {
189
+ return ((_a = yield this.get(`/account/${context_token}/guide/channels/`, undefined, timeout, context_token)) !== null && _a !== void 0 ? _a : []);
190
+ }
191
+ catch (_b) {
192
+ return [];
193
+ }
194
+ });
195
+ }
196
+ /**
197
+ * Attempts to retrieve information regarding a specific device associated with the account
198
+ * @param server_id
199
+ * @param timeout
200
+ */
201
+ resolveDevice(server_id_1) {
202
+ return __awaiter(this, arguments, void 0, function* (server_id, timeout = this.timeout) {
203
+ try {
204
+ return yield this.get(`/account/devices/${server_id}/resolve/`, undefined, timeout);
205
+ }
206
+ catch (_a) {
207
+ }
208
+ });
209
+ }
210
+ /**
211
+ * Selects the device context based upon the specified `profile_id` and `server_id`.
212
+ * @param profile_id
213
+ * @param server_id
214
+ * @param timeout
215
+ */
216
+ selectDeviceContext(profile_id_1, server_id_1) {
217
+ return __awaiter(this, arguments, void 0, function* (profile_id, server_id, timeout = this.timeout) {
218
+ try {
219
+ const { token } = yield this.post('/account/select/', {
220
+ pid: profile_id,
221
+ sid: server_id
222
+ }, timeout);
223
+ if (token) {
224
+ this.context_token = token;
225
+ }
226
+ return token;
227
+ }
228
+ catch (_a) {
229
+ }
230
+ });
231
+ }
232
+ get(endpoint_1) {
233
+ return __awaiter(this, arguments, void 0, function* (endpoint, params = {}, timeout = this.timeout, token) {
234
+ return this.execute('GET', endpoint, params, undefined, timeout, token);
235
+ });
236
+ }
237
+ post(endpoint_1, payload_1) {
238
+ return __awaiter(this, arguments, void 0, function* (endpoint, payload, timeout = this.timeout, token) {
239
+ return this.execute('POST', endpoint, {}, payload, timeout, token);
240
+ });
241
+ }
242
+ authenticate() {
243
+ return __awaiter(this, arguments, void 0, function* (timeout = this.timeout) {
244
+ try {
245
+ const response = yield (0, fetch_1.default)(`${this.base_uri}/login/`, {
246
+ method: 'POST',
247
+ json: {
248
+ email: this.email,
249
+ password: this.password
250
+ },
251
+ timeout
252
+ });
253
+ if (response.ok) {
254
+ this.token = yield response.json();
255
+ return true;
256
+ }
257
+ delete this.token;
258
+ return false;
259
+ }
260
+ catch (_a) {
261
+ return false;
262
+ }
263
+ });
264
+ }
265
+ execute(method_1, endpoint_1) {
266
+ return __awaiter(this, arguments, void 0, function* (method, endpoint, params = {}, payload, timeout = this.timeout, token, is_retry = false) {
267
+ var _a, _b;
268
+ if (!this.token && !(yield this.authenticate(timeout))) {
269
+ throw new Error('Failed to authenticate with Lighthouse API');
270
+ }
271
+ const headers = {
272
+ Accept: 'application/json',
273
+ Authorization: `${(_a = this.token) === null || _a === void 0 ? void 0 : _a.token_type} ${(_b = this.token) === null || _b === void 0 ? void 0 : _b.access_token}`
274
+ };
275
+ if (token) {
276
+ headers.Lighthouse = token;
277
+ }
278
+ const qs = new URLSearchParams();
279
+ for (const [key, value] of Object.entries(params)) {
280
+ qs.set(key, value);
281
+ }
282
+ const url = endpoint.includes('://')
283
+ ? `${endpoint}?${qs.toString()}`
284
+ : `${this.base_uri}${endpoint}?${qs.toString()}`;
285
+ if (this.request_logging) {
286
+ logger_1.default.debug('%s %s %s %s', method, JSON.stringify(headers), url, payload ? JSON.stringify(payload) : '');
287
+ }
288
+ const response = yield (0, fetch_1.default)(url, {
289
+ headers,
290
+ json: (method === 'PATCH' || method === 'POST' || method === 'PUT') ? payload : undefined,
291
+ method
292
+ });
293
+ if (!response.ok) {
294
+ if (response.status === 401 && !is_retry) {
295
+ if (yield this.authenticate(timeout)) {
296
+ return this.execute(method, endpoint, params, payload, timeout, token, true);
297
+ }
298
+ }
299
+ throw new Error(`${response.url} [${response.status}] ${response.statusText}`);
300
+ }
301
+ return yield response.json();
302
+ });
303
+ }
304
+ }
305
+ exports.Lighthouse = Lighthouse;
306
+ Lighthouse.base_uri = 'https://lighthousetv.ewscloud.com/api/v2';
307
+ exports.default = Lighthouse;
308
+ //# sourceMappingURL=lighthouse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lighthouse.js","sourceRoot":"","sources":["../src/lighthouse.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,yDAAiC;AACjC,2DAAmC;AASnC,MAAa,UAAU;IAKnB,kDAAkD;IAClD,YAC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AAI,CAAC,QAAQ,EAAE,CAAC;oBACvC,IAAI,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,CAAC;wBACnC,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;oBACjF,CAAC;gBACL,CAAC;gBAED,MAAM,IAAI,KAAK,CAAC,GAAG,QAAQ,CAAC,GAAG,KAAK,QAAQ,CAAC,MAAM,KAAK,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;YACnF,CAAC;YAED,OAAO,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QACjC,CAAC;KAAA;;AAjUL,gCAkUC;AAjU2B,mBAAQ,GAAG,0CAA0C,AAA7C,CAA8C;AAmZlF,kBAAe,UAAU,CAAC"}
@@ -0,0 +1,92 @@
1
+ import { EventEmitter } from 'events';
2
+ import type { Tablo } from './tablo';
3
+ export default class LiveTranscoder extends EventEmitter {
4
+ readonly id: string;
5
+ private readonly device;
6
+ private readonly channel_id;
7
+ readonly output_path: string;
8
+ readonly filename: string;
9
+ readonly auto_restart: boolean;
10
+ private static readonly instances;
11
+ private readonly ffmpeg_path;
12
+ private process?;
13
+ private timer?;
14
+ private emitter;
15
+ /**
16
+ * Creates a new live transcoder instance.
17
+ *
18
+ * The `output_path` must be a valid path to a directory on the local filesystem.
19
+ *
20
+ * The `channel_id` must be a valid channel ID for the specified `device`.
21
+ *
22
+ * The `device` must be a valid `Device` instance.
23
+ * @param id
24
+ * @param device
25
+ * @param channel_id
26
+ * @param output_path
27
+ * @param filename
28
+ * @param auto_restart
29
+ */
30
+ protected constructor(id: string, device: Tablo, channel_id: string, output_path: string, filename?: string, auto_restart?: boolean);
31
+ private _use_count;
32
+ get use_count(): number;
33
+ private _active;
34
+ get active(): boolean;
35
+ private set active(value);
36
+ private _full_path;
37
+ get full_path(): string;
38
+ private set full_path(value);
39
+ private _session?;
40
+ get session(): Tablo.PlayerSession | undefined;
41
+ private set session(value);
42
+ get channel(): Tablo.Channel | undefined;
43
+ get relative_path(): string;
44
+ /**
45
+ * Retrieves an existing instance of a live transcoder or creates a new instance if one does not exist.
46
+ *
47
+ * The `device` must be a valid `Device` instance.
48
+ *
49
+ * The `channel_id` must be a valid channel ID for the specified `device`.
50
+ *
51
+ * The `output_path` must be a valid path to a directory on the local filesystem.
52
+ *
53
+ * The `filename` is the name of the output file.
54
+ *
55
+ * @param device
56
+ * @param channel_id
57
+ * @param output_path
58
+ * @param filename
59
+ * @param auto_restart
60
+ */
61
+ static instance(device: Tablo, channel_id: string, output_path: string, filename?: string, auto_restart?: boolean): Promise<LiveTranscoder>;
62
+ on(event: 'error', listener: (error: Error) => void): this;
63
+ on(event: 'exit', listener: (code: number | null) => void): this;
64
+ on(event: 'ready', listener: () => void): this;
65
+ on(event: 'stopped', listener: () => void): this;
66
+ once(event: 'error', listener: (error: Error) => void): this;
67
+ once(event: 'exit', listener: (code: number | null) => void): this;
68
+ once(event: 'ready', listener: () => void): this;
69
+ once(event: 'stopped', listener: () => void): this;
70
+ off(event: 'error', listener: (error: Error) => void): this;
71
+ off(event: 'exit', listener: (code: number | null) => void): this;
72
+ off(event: 'ready', listener: () => void): this;
73
+ off(event: 'stopped', listener: () => void): this;
74
+ /**
75
+ * Starts the live transcoder.
76
+ *
77
+ * The live transcoder will attempt to start a new session for the specified `channel_id` on the specified `device`.
78
+ *
79
+ * If a session is successfully started, the live transcoder will attempt to start a new transcoding process.
80
+ */
81
+ start(): Promise<boolean>;
82
+ /**
83
+ * Stops the live transcoder.
84
+ */
85
+ stop(): void;
86
+ /**
87
+ * Attempts to start the FFMpeg process
88
+ * @private
89
+ */
90
+ private start_ffmpeg;
91
+ }
92
+ export { LiveTranscoder };