Skip to content

Commit

Permalink
Added support for FloSports
Browse files Browse the repository at this point in the history
  • Loading branch information
m0ngr31 committed Sep 7, 2024
1 parent 60580e8 commit 272948a
Show file tree
Hide file tree
Showing 10 changed files with 370 additions and 42 deletions.
8 changes: 7 additions & 1 deletion 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: **2.2.0**
Current version: **2.3.0**

# About
This takes ESPN/ESPN+, FOX Sports, Paramount+, MSG+, B1G+, 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,6 +66,12 @@ Use if you would like to login with Paramount+
|---|---|---|---|
| PARAMOUNTPLUS | Set if you would like CBS Sports events | False | False |

#### FloSports
Use if you would like to login with FloSports
| Environment Variable | Description | Required? | Default |
|---|---|---|---|
| FLOSPORTS | Set if you would like FloSports events | False | False |

#### B1G+
Use if you would like to login with your B1G+ account
| Environment Variable | Description | Default |
Expand Down
6 changes: 6 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {espnHandler} from './services/espn-handler';
import {foxHandler} from './services/fox-handler';
import {mlbHandler} from './services/mlb-handler';
import {b1gHandler} from './services/b1g-handler';
import {floSportsHandler} from './services/flo-handler';
import {paramountHandler} from './services/paramount-handler';
import {msgHandler} from './services/msg-handler';
import {cleanEntries, removeChannelStatus} from './services/shared-helpers';
Expand All @@ -34,6 +35,7 @@ const schedule = async () => {
await foxHandler.getSchedule();
await mlbHandler.getSchedule();
await b1gHandler.getSchedule();
await floSportsHandler.getSchedule();
await paramountHandler.getSchedule();
await msgHandler.getSchedule();

Expand Down Expand Up @@ -214,6 +216,9 @@ process.on('SIGINT', shutDown);
await b1gHandler.initialize();
await b1gHandler.refreshTokens();

await floSportsHandler.initialize();
await floSportsHandler.refreshTokens();

await paramountHandler.initialize();
await paramountHandler.refreshTokens();

Expand All @@ -237,6 +242,7 @@ setInterval(async () => {
await foxHandler.refreshTokens();
await mlbHandler.refreshTokens();
await b1gHandler.refreshTokens();
await floSportsHandler.refreshTokens();
await paramountHandler.refreshTokens();
await msgHandler.refreshTokens();
}, 1000 * 60 * 30);
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": "2.2.0",
"version": "2.3.0",
"description": "",
"scripts": {
"start": "ts-node index.ts",
Expand Down
2 changes: 1 addition & 1 deletion services/b1g-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const parseAirings = async (events: IB1GEvent[]) => {

if (!entryExists) {
const start = moment(event.startTime);
const end = moment(event.startTime).add(5, 'hours');
const end = moment(event.startTime).add(4, 'hours');

if (end.isBefore(now) || content.enableDrmProtection) {
continue;
Expand Down
42 changes: 5 additions & 37 deletions services/build-schedule.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import fs from 'fs';

import {NUM_OF_CHANNELS, START_CHANNEL} from './channels';
import {db, IDocument, linearDb} from './database';
import {db, IDocument} from './database';
import {IChannel, IEntry} from './shared-interfaces';

const scheduleEntry = async (entry: IEntry & IDocument, startChannel: number): Promise<void> => {
Expand Down Expand Up @@ -34,41 +32,11 @@ const scheduleEntry = async (entry: IEntry & IDocument, startChannel: number): P
};

export const scheduleEntries = async (): Promise<void> => {
let needReschedule = false;

try {
// Check to see if we still have linear channels scheduled
const linearChannelNums = await db.linear?.remove({}, {multi: true});

if (linearChannelNums > 0) {
needReschedule = true;
fs.rmSync(linearDb);
}
} catch (e) {}

if (needReschedule) {
console.log('');
console.log('====================================================================');
console.log('=== ===');
console.log('=== Need to rebuild the schedule because the USE_LINEAR variable ===');
console.log('=== is no longer being used. ===');
console.log('=== ===');
console.log('====================================================================');
console.log('=== THIS WILL BREAK SCHEDULED RECORDINGS IN YOUR DVR SOFTWARE ===');
console.log('====================================================================');
console.log('');
const unscheduledEntries = await db.entries.find<IEntry>({channel: {$exists: false}}).sort({start: 1});

await db.entries.update<IEntry>({}, {$unset: {channel: true}}, {multi: true});
await db.schedule.remove({}, {multi: true});
unscheduledEntries.length > 0 && console.log(`Scheduling ${unscheduledEntries.length} entries...`);

return await scheduleEntries();
} else {
const unscheduledEntries = await db.entries.find<IEntry>({channel: {$exists: false}}).sort({start: 1});

unscheduledEntries.length > 0 && console.log(`Scheduling ${unscheduledEntries.length} entries...`);

for (const entry of unscheduledEntries) {
await scheduleEntry(entry, START_CHANNEL);
}
for (const entry of unscheduledEntries) {
await scheduleEntry(entry, START_CHANNEL);
}
};
Loading

0 comments on commit 272948a

Please sign in to comment.