Skip to content

Commit

Permalink
Fix MSG scheduling and add support for MSG linear channels
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed Oct 4, 2024
1 parent 69f28d3 commit 5f9461e
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 8 deletions.
4 changes: 2 additions & 2 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.2.2**
Current version: **3.2.3**

# About
This takes ESPN/ESPN+, FOX Sports, Paramount+, MSG+, NFL+, B1G+, NESN, Mountain West, 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 @@ -99,7 +99,7 @@ Use if you would like to login with your B1G+ account
Use if you would like to login with your MSG+ account
| Environment Variable | Description | Default |
|---|---|---|
| MSGPLUS | Set if you would like to use MSG+ | False |
| MSGPLUS*** | Set if you would like to use MSG+ | False |
| MSGPLUS_USER | MSG+ Username | False |
| MSGPLUS_PASS | MSG+ Password | False |

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.2.2",
"version": "3.2.3",
"description": "",
"scripts": {
"start": "ts-node index.ts",
Expand Down
33 changes: 33 additions & 0 deletions services/channels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
useEspnU,
useFoxSports,
useMLBtv,
useMsgPlus,
useNesn,
useNfl,
useParamount,
Expand Down Expand Up @@ -183,6 +184,38 @@ export const CHANNEL_MAP = {
stationId: '63516',
tvgName: 'NESNPLD',
},
60: {
canUse: useMsgPlus,
id: 'MSG',
logo: 'https://tmsimg.fancybits.co/assets/s10979_ll_h15_ab.png?w=360&h=270',
name: 'MSG',
stationId: '10979',
tvgName: 'MSG',
},
61: {
canUse: useMsgPlus,
id: 'MSGSN',
logo: 'https://tmsimg.fancybits.co/assets/s11105_ll_h15_ac.png?w=360&h=270',
name: 'MSG Sportsnet HD',
stationId: '15273',
tvgName: 'MSGSNNP',
},
62: {
canUse: useMsgPlus,
id: 'MSG2',
logo: 'https://tmsimg.fancybits.co/assets/s70283_ll_h15_aa.png?w=360&h=270',
name: 'MSG2 HD',
stationId: '70283',
tvgName: 'MSG2HD',
},
63: {
canUse: useMsgPlus,
id: 'MSGSN2',
logo: 'https://tmsimg.fancybits.co/assets/s70285_ll_h15_ab.png?w=360&h=270',
name: 'MSG Sportsnet 2 HD',
stationId: '70285',
tvgName: 'MSG2SNH',
},
};
/* eslint-enable sort-keys-custom-order-fix/sort-keys-custom-order-fix */

Expand Down
32 changes: 29 additions & 3 deletions services/msg-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {getRandomUUID} from './shared-helpers';
import {db} from './database';
import {IEntry, IHeaders} from './shared-interfaces';
import {okHttpUserAgent} from './user-agent';
import {useLinear} from './channels';

const API_KEY = [
'c',
Expand Down Expand Up @@ -108,9 +109,13 @@ const parseAirings = async (events: any[]) => {
const entryExists = await db.entries.findOne<IEntry>({id: `${event.contentId}`});

if (!entryExists) {
const start = moment(event.start).subtract(30, 'minutes'); // For Pregrame
const start = moment(event.start);
const end = moment(event.end);

if (!useLinear) {
start.subtract(30, 'minutes'); // For Pre-game
}

if (end.isBefore(now) || start.isAfter(inTwoDays)) {
continue;
}
Expand All @@ -128,6 +133,10 @@ const parseAirings = async (events: any[]) => {
network: event.network,
sport: event.sport,
start: start.valueOf(),
...(event.linear && {
channel: event.channel,
linear: true,
}),
});
}
}
Expand Down Expand Up @@ -239,17 +248,34 @@ class MSGHandler {

(data.data || []).forEach(channel => {
(channel.airing || []).forEach(airing => {
if (airing.ev_live === 'true' && airing.ca_ty === 'game') {
const eventName = airing.pgm.lon[0].n.replace(/\n/g, '');

if (useLinear && eventName !== 'NO PROGRAMMING - OFF AIR') {
entries.push({
artwork: `https://image-resizer-cloud-cdn.api.msgncms.quickplay.com/image/${airing.cid}/3-16x9.png?width=400`,
categories: ['MSG', 'MSG+', 'HD', 'Sports', airing?.pgm?.spt_lg, airing?.pgm?.spt_ty],
channel: channel.cs.split('_')[1],
contentId: `${airing.id}----${airing.cid}`,
end: airing.sc_ed_dt,
linear: true,
network: airing.net,
sport: airing.pgm?.spt_lg,
start: airing.sc_st_dt,
title: airing.pgm.lon[0].n,
title: eventName,
});
} else {
if (airing.ev_live === 'true' && (airing.ca_ty === 'game' || airing.pgm.lon[0].n.indexOf(' vs') > -1)) {
entries.push({
artwork: `https://image-resizer-cloud-cdn.api.msgncms.quickplay.com/image/${airing.cid}/3-16x9.png?width=400`,
categories: ['MSG', 'MSG+', 'HD', 'Sports', airing?.pgm?.spt_lg, airing?.pgm?.spt_ty],
contentId: `${airing.id}----${airing.cid}`,
end: airing.sc_ed_dt,
network: airing.net,
sport: airing.pgm?.spt_lg,
start: airing.sc_st_dt,
title: eventName,
});
}
}
});
});
Expand Down

0 comments on commit 5f9461e

Please sign in to comment.