Skip to content

Commit 9fe077c

Browse files
author
tonywagner
committed
[4.10.4] FOX network event scheduling fix
1 parent c2f300c commit 9fe077c

File tree

3 files changed

+41
-7
lines changed

3 files changed

+41
-7
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<img src="https://i.imgur.com/FIGZdR3.png">
33
</p>
44

5-
Current version: **4.10.3**
5+
Current version: **4.10.4**
66

77
# About
88
This takes programming from various providers and transforms it into a "live TV" experience with virtual linear channels. It will discover what is on, and generate a schedule of channels that will give you M3U and XMLTV files that you can import into something like [Jellyfin](https://jellyfin.org) or [Channels](https://getchannels.com).

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "eplustv",
3-
"version": "4.10.3",
3+
"version": "4.10.4",
44
"description": "",
55
"scripts": {
66
"start": "ts-node -r tsconfig-paths/register index.tsx",

services/fox-handler.ts

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ interface IFoxMeta {
7878
only4k?: boolean;
7979
uhd?: boolean;
8080
dtc_events?: boolean;
81+
local_station_call_sign?: string;
8182
}
8283

8384
const EPG_API_KEY = [
@@ -212,11 +213,11 @@ const willAuthTokenExpire = (token: IAdobeAuthFox): boolean =>
212213

213214
const checkEventNetwork = (entitlements, event: IFoxEvent): boolean => {
214215
if (event.network) {
215-
for(let i=0; i<entitlements.length; i++) {
216-
if (entitlements[i].split('-')[0] == event.network) {
217-
return true;
216+
for (let i=0; i<entitlements.length; i++) {
217+
if ( (entitlements[i].split('-')[0] == event.network) || ((event.network == 'fox') && entitlements.includes('foxSports')) ) {
218+
return true;
219+
}
218220
}
219-
}
220221
}
221222

222223
return false;
@@ -275,6 +276,7 @@ class FoxHandler {
275276
meta: {
276277
only4k: useFoxOnly4k,
277278
uhd: getMaxRes(process.env.MAX_RESOLUTION) === 'UHD/HDR',
279+
local_station_call_sign: '',
278280
},
279281
name: 'foxsports',
280282
tokens: data,
@@ -455,6 +457,38 @@ class FoxHandler {
455457
await this.getAppConfig();
456458
}
457459

460+
// get local station call sign
461+
let local_station_call_sign_parameter = '';
462+
try {
463+
const {meta} = await db.providers.findOneAsync<IProvider<any, IFoxMeta>>({name: 'foxsports'});
464+
if ( !meta.local_station_call_sign || (meta.local_station_call_sign == '') ) {
465+
console.log('Fetching local FOX station call sign');
466+
let local_station_call_sign = 'none';
467+
const {data} = await axios.get(
468+
'https://api-sps.foxsports.com/locator/v1/location',
469+
{
470+
headers: {
471+
'User-Agent': userAgent,
472+
'x-api-key': EPG_API_KEY,
473+
},
474+
},
475+
);
476+
477+
if ( data.data.results[0].local_station_call_sign ) {
478+
local_station_call_sign = data.data.results[0].local_station_call_sign;
479+
console.log('Found local FOX station call sign ' + local_station_call_sign);
480+
local_station_call_sign_parameter = '%2C' + local_station_call_sign;
481+
} else {
482+
console.log('No local FOX station call sign found');
483+
}
484+
await db.providers.updateAsync({name: 'foxsports'}, {$set: {'meta.local_station_call_sign': local_station_call_sign}});
485+
} else if ( (meta.local_station_call_sign != 'none') ) {
486+
local_station_call_sign_parameter = '%2C' + meta.local_station_call_sign;
487+
}
488+
} catch (e) {
489+
console.log(e);
490+
}
491+
458492
const useLinear = await usesLinear();
459493

460494
const events: IFoxEvent[] = [];
@@ -470,7 +504,7 @@ class FoxHandler {
470504

471505
for (let page = 1; page <= pages; page++) {
472506
const {data} = await axios.get<IFoxEventsData>(
473-
`https://api.fox.com/fs/product/curated/v1/sporting/keystone/detail/by_filters?callsign=BTN%2CBTN-DIGITAL%2CFOX%2CFOX-DIGITAL%2CFOXDEP%2CFOXDEP-DIGITAL%2CFS1%2CFS1-DIGITAL%2CFS2%2CFS2-DIGITAL%2CFSP&end_date=${endTime}&page=${page}&size=${max_items_per_page}&start_date=${startTime}&video_type=listing`,
507+
`https://api.fox.com/fs/product/curated/v1/sporting/keystone/detail/by_filters?callsign=BTN%2CBTN-DIGITAL%2CFOX%2CFOX-DIGITAL%2CFOXDEP%2CFOXDEP-DIGITAL%2CFS1%2CFS1-DIGITAL%2CFS2%2CFS2-DIGITAL%2CFSP${local_station_call_sign_parameter}&end_date=${endTime}&page=${page}&size=${max_items_per_page}&start_date=${startTime}&video_type=listing`,
474508
{
475509
headers: {
476510
'User-Agent': userAgent,

0 commit comments

Comments
 (0)