Skip to content

Commit

Permalink
v2.0.19 - fix for issue with duration
Browse files Browse the repository at this point in the history
  • Loading branch information
m0ngr31 committed Oct 27, 2023
1 parent 950b65b commit 27b3474
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 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.0.18**
Current version: **2.0.19**

# About
This takes ESPN/ESPN+, FOX Sports, and 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), [Channels](https://getchannels.com), or [xTeVe](https://github.com/xteve-project/xTeVe).
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.0.18",
"version": "2.0.19",
"description": "",
"scripts": {
"start": "ts-node index.ts",
Expand Down
5 changes: 3 additions & 2 deletions services/espn-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ const parseAirings = async events => {
const entryExists = await db.entries.findOne<IEntry>({id: event.id});

if (!entryExists) {
const start = moment(event.startDateTime);
const end = moment(event.startDateTime).add(event.duration, 'seconds').add(1, 'hour');

if (end.isBefore(now)) {
Expand All @@ -276,7 +277,7 @@ const parseAirings = async events => {

await db.entries.insert<IEntry>({
categories: parseCategories(event),
duration: event.duration,
duration: end.diff(start, 'seconds'),
end: end.valueOf(),
feed: event.feedName,
from: 'espn',
Expand All @@ -285,7 +286,7 @@ const parseAirings = async events => {
name: event.name,
network: event.network?.name || 'ESPN+',
sport: event.subcategory?.name,
start: new Date(event.startDateTime).valueOf(),
start: start.valueOf(),
url: event.source?.url,
});
}
Expand Down
5 changes: 3 additions & 2 deletions services/fox-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ const parseAirings = async (events: IFoxEvent[]) => {
const entryExists = await db.entries.findOne<IEntry>({id: event.id});

if (!entryExists) {
const start = moment(event.startDate);
const end = moment(event.endDate).add(1, 'hour');

if (end.isBefore(now)) {
Expand All @@ -122,14 +123,14 @@ const parseAirings = async (events: IFoxEvent[]) => {

await db.entries.insert<IEntry>({
categories: parseCategories(event),
duration: end.diff(moment(event.startDate), 'seconds'),
duration: end.diff(start, 'seconds'),
end: end.valueOf(),
from: 'foxsports',
id: event.id,
image: event.images.logo?.FHD || event.images.seriesDetail?.FHD,
name: event.name,
network: event.callSign,
start: new Date(event.startDate).valueOf(),
start: start.valueOf(),
});
}
}
Expand Down
6 changes: 4 additions & 2 deletions services/mlb-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ const parseAirings = async (events: IGame[]) => {
continue;
}

const start = moment(event.gameDate);
const end = moment(event.gameDate).add(5, 'hours');

if (end.isBefore(now)) {
Expand All @@ -212,14 +213,15 @@ const parseAirings = async (events: IGame[]) => {

await db.entries.insert<IEntry>({
categories: ['Baseball', 'MLB', event.teams.home.team.name, event.teams.away.team.name],
duration: 60 * 60 * 5,
duration: end.diff(start, 'seconds'),
end: end.valueOf(),
from: 'mlbtv',
id: item.contentId,
image: generateThumb(event.teams.home, event.teams.away),
name: gameName,
network: item.callLetters,
start: new Date(event.gameDate).valueOf(),
sport: 'MLB',
start: start.valueOf(),
});
}
}
Expand Down

0 comments on commit 27b3474

Please sign in to comment.