Skip to content

Commit

Permalink
Small logic updates
Browse files Browse the repository at this point in the history
  • Loading branch information
m0ngr31 committed Sep 10, 2024
1 parent bd86e48 commit 246be6e
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 11 deletions.
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<img src="https://i.imgur.com/FIGZdR3.png">
</p>

Current version: **3.0.0**
Current version: **3.0.1**

# About
This takes ESPN/ESPN+, FOX Sports, Paramount+, MSG+, NFL+, B1G+, FloSports, or MLB.tv programming 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).
Expand Down Expand Up @@ -66,14 +66,16 @@ Use if you would like to login with Paramount+
| Environment Variable | Description | Required? | Default |
|---|---|---|---|
| PARAMOUNTPLUS | Set if you would like CBS Sports events | False | False |
| CBSSPORTSHQ* | Set if you would like the CBS Sports HQ channel (only available with LINEAR_CHANNELS) | False | False |
| GOLAZO* | Set if you would like the Golazo Network channel (only available with LINEAR_CHANNELS) | False | False |
| CBSSPORTSHQ* | Set if you would like the CBS Sports HQ channel (only available with `LINEAR_CHANNELS`) | False | False |
| GOLAZO* | Set if you would like the Golazo Network channel (only available with `LINEAR_CHANNELS`) | False | False |

#### NFL+
Use if you would like to login with NFL+
| Environment Variable | Description | Required? | Default |
|---|---|---|---|
| NFLPLUS** | Set if you would like NFL+ events<br><br> ** Please note: NFL Network will only be scheduled as a linear channel. NFL RedZone can be either one depending on what `LINEAR_CHANNELS` is set to, but requires NFL+ Premium| False | False |
| NFLPLUS | Set if you would like NFL+ events | False | False |
| NFLNETWORK* | Set if you would like the NFL Network channel (only available with `LINEAR_CHANNELS`) | False | False |
| NFLREDZONE*** | Set if you would like NFL RedZone (have to have NFL+ Premium) | False | False |

#### B1G+
Use if you would like to login with your B1G+ account
Expand Down Expand Up @@ -108,7 +110,7 @@ Use if you would like to login with your MLB.tv account
### Notes
`*`: Dedicated linear channel - Will only schedule when `LINEAR_CHANNELS` is set

`**`: Some events are on linear channels and some aren't. If you're using `LINEAR_CHANNELS`: For FOX Sports, FOX events will be scheduled normally, everything else will be on the linear channels. For NFL+, NFL Network and NFL RedZone will be scheduled as linear channels, while all games are scheduled as normal.
`**`: Some events are on linear channels and some aren't. If you use `LINEAR_CHANNELS`, only events that are on FOX will be scheduled normally. All other events will be scheduled to linear channels

`***`: Will create a dedicated linear channel if requested, if not, will schedule events normally

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eplustv",
"version": "3.0.0",
"version": "3.0.1",
"description": "",
"scripts": {
"start": "ts-node index.ts",
Expand Down
9 changes: 9 additions & 0 deletions services/build-schedule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,16 @@ export const scheduleEntries = async (): Promise<void> => {
console.log('====================================================================');
console.log('');

// Remove schedule
await db.schedule.remove({}, {multi: true});

// Remove all dedicated linear channel entries
await db.entries.remove(
{$or: [{channel: 'cbssportshq'}, {channel: 'golazo'}, {channel: 'NFLNETWORK'}]},
{multi: true},
);

// Remove channel and linear props from existing entries
await db.entries.update<IEntry>({}, {$unset: {channel: true, linear: true}}, {multi: true});

return await scheduleEntries();
Expand Down
2 changes: 2 additions & 0 deletions services/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ export const useGolazo = process.env.GOLAZO?.toLowerCase() === 'true' ? true : f
export const useMsgPlus = process.env.MSGPLUS?.toLowerCase() === 'true' ? true : false;

export const useNflPlus = process.env.NFLPLUS?.toLowerCase() === 'true' ? true : false;
export const useNflNetwork = process.env.NFLNETWORK?.toLowerCase() === 'true' ? true : false;
export const useNflRedZone = process.env.NFLREDZONE?.toLowerCase() === 'true' ? true : false;

export const requiresEspnProvider =
useEspn1 || useEspn2 || useEspn3 || useEspnU || useSec || useSecPlus || useAccN || useAccNx || useEspnews;
Expand Down
8 changes: 5 additions & 3 deletions services/nfl-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import jwt_decode from 'jwt-decode';

import {okHttpUserAgent} from './user-agent';
import {configPath} from './config';
import {useNflPlus} from './networks';
import {useNflNetwork, useNflPlus, useNflRedZone} from './networks';
import {IEntry, IHeaders} from './shared-interfaces';
import {db} from './database';
import {getRandomUUID} from './shared-helpers';
Expand Down Expand Up @@ -186,7 +186,9 @@ class NflHandler {

const {dmaCode, plans}: {dmaCode: string; plans: {plan: string; status: string}[]} = jwt_decode(this.access_token);

const redZoneAccess = plans.findIndex(p => p.plan === 'NFL_PLUS_PREMIUM' && p.status === 'ACTIVE') > -1;
const redZoneAccess =
plans.findIndex(p => p.plan === 'NFL_PLUS_PREMIUM' && p.status === 'ACTIVE') > -1 && useNflRedZone;
const nflNetworkAccess = useLinear && useNflNetwork;

if (!dmaCode) {
console.log('DMA Code not found for NFL+. Not searching for events');
Expand Down Expand Up @@ -222,7 +224,7 @@ class NflHandler {
redZoneAccess
) {
events.push(i);
} else if (i.callSign === 'NFLNETWORK' && moment(i.startTime).isBefore(endSchedule) && useLinear) {
} else if (i.callSign === 'NFLNETWORK' && moment(i.startTime).isBefore(endSchedule) && nflNetworkAccess) {
events.push(i);
}
});
Expand Down

0 comments on commit 246be6e

Please sign in to comment.