Skip to content

Commit b62bb60

Browse files
author
Your Name
committed
Finish up gotham integration
1 parent aaae708 commit b62bb60

File tree

5 files changed

+25
-784
lines changed

5 files changed

+25
-784
lines changed

services/gotham-handler.ts

+8-24
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,10 @@ const parseAirings = async (events: any[]) => {
156156
const start = moment(event.start);
157157
const end = moment(event.end);
158158

159+
if (!useLinear) {
160+
start.subtract(30, 'minutes'); // For Pre-game
161+
}
162+
159163
if (end.isBefore(now) || start.isAfter(inTwoDays)) {
160164
continue;
161165
}
@@ -270,7 +274,6 @@ class GothamHandler {
270274
return;
271275
}
272276

273-
await this.getNewTokens();
274277
await this.authenticateRegCode();
275278

276279
if (moment().add(20, 'hours').isAfter(this.expiresIn)) {
@@ -391,7 +394,7 @@ class GothamHandler {
391394
categories: ['Gotham', 'HD', 'Sports', airing.net || 'MSG', airing.aw_tm, airing.hm_tm, airing.spt_lg],
392395
contentId: `${airing.id}----${airing.cid}`,
393396
end: airing.ev_ed_dt,
394-
network: airing.net,
397+
network: `${airing.pn}`.toUpperCase(),
395398
sport: airing.spt_lg,
396399
start: airing.ev_st_dt,
397400
title: eventName,
@@ -408,7 +411,7 @@ class GothamHandler {
408411

409412
public getEventData = async (eventId: string): Promise<[string, IHeaders]> => {
410413
try {
411-
const [contentId, channelId] = eventId.split('----');
414+
const [, channelId] = eventId.split('----');
412415

413416
const event = await db.entries.findOne<IEntry>({id: eventId});
414417

@@ -425,8 +428,8 @@ class GothamHandler {
425428
const {data} = await axios.post(
426429
`${authUrl}`,
427430
{
428-
catalogType: useLinear ? 'channel' : 'liveevent',
429-
contentId: useLinear ? channelId : contentId,
431+
catalogType: 'channel',
432+
contentId: channelId,
430433
contentTypeId: 'live',
431434
delivery: 'streaming',
432435
deviceId: this.device_id,
@@ -859,8 +862,6 @@ class GothamHandler {
859862

860863
this.save();
861864

862-
// await this.refreshProviderToken();
863-
864865
const adobeId = await this.getAdobeId();
865866
const adobeUserMeta = await this.getUserMetadata();
866867

@@ -971,23 +972,6 @@ class GothamHandler {
971972
}
972973
};
973974

974-
private refreshProviderToken = async (): Promise<void> => {
975-
if (!this.adobe_token) {
976-
return;
977-
}
978-
979-
// const renewUrl = [`${BASE_ADOBE_URL}/tokens/authn`, `?deviceId=${this.device_id}`, '&requestor=Gotham'].join('');
980-
981-
// try {
982-
// await axios.get(renewUrl, {
983-
// headers: {
984-
// Authorization: `Bearer ${this.adobe_token}`,
985-
// 'User-Agent': okHttpUserAgent,
986-
// },
987-
// });
988-
// } catch (e) {}
989-
};
990-
991975
private save = async () => {
992976
await db.providers.update(
993977
{name: 'gotham'},

0 commit comments

Comments
 (0)