mlbserver 2021.10.6 → 2021.10.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # mlbserver
2
2
 
3
- Current version 2021.10.6
3
+ Current version 2021.10.10
4
4
 
5
5
  Credit to https://github.com/tonycpsu/streamglob and https://github.com/mafintosh/hls-decryptor
6
6
 
package/index.js CHANGED
@@ -1061,8 +1061,13 @@ app.get('/', async function(req, res) {
1061
1061
  if ( ((typeof cache_data.dates[0].games[j].content.media.epg[k].items[x].mediaFeedType) == 'undefined') || (cache_data.dates[0].games[j].content.media.epg[k].items[x].mediaFeedType.indexOf('IN_MARKET_') == -1) ) {
1062
1062
  if ( ((typeof cache_data.dates[0].games[j].content.media.epg[k].items[x].language) == 'undefined') || (cache_data.dates[0].games[j].content.media.epg[k].items[x].language == language) ) {
1063
1063
  let teamabbr
1064
- if ( ((typeof cache_data.dates[0].games[j].content.media.epg[k].items[x].mediaFeedType) != 'undefined') && (cache_data.dates[0].games[j].content.media.epg[k].items[x].mediaFeedType == 'NATIONAL') ) {
1064
+ if ( (((typeof cache_data.dates[0].games[j].content.media.epg[k].items[x].mediaFeedType) != 'undefined') && (cache_data.dates[0].games[j].content.media.epg[k].items[x].mediaFeedType == 'NATIONAL')) || ((mediaType == 'MLBTV') && cache_data.dates[0].games[j].gameUtils.isPostSeason) ) {
1065
1065
  teamabbr = 'NATIONAL'
1066
+ if ( (typeof cache_data.dates[0].games[j].content.media.epg[k].items[x].mediaFeedType) != 'undefined' ) {
1067
+ if ( cache_data.dates[0].games[j].content.media.epg[k].items[x][mediaFeedType] == 'AWAY' ) {
1068
+ teamabbr += '*'
1069
+ }
1070
+ }
1066
1071
  } else {
1067
1072
  teamabbr = hometeam
1068
1073
  if ( cache_data.dates[0].games[j].content.media.epg[k].items[x][mediaFeedType] == 'AWAY' ) {
@@ -1103,7 +1108,12 @@ app.get('/', async function(req, res) {
1103
1108
  }
1104
1109
  querystring += content_protect_b
1105
1110
  multiviewquerystring += content_protect_b
1106
- body += teamabbr + ': <a href="' + thislink + querystring + '">' + station + '</a>'
1111
+ if ( teamabbr.endsWith('*') ) {
1112
+ body += '<span class="tooltip">' + teamabbr + '<span class="tooltiptext">* includes the away team\'s alternate audio, instead of the default home team\'s</span></span>'
1113
+ } else {
1114
+ body += teamabbr
1115
+ }
1116
+ body += ': <a href="' + thislink + querystring + '">' + station + '</a>'
1107
1117
  if ( mediaType == 'MLBTV' ) {
1108
1118
  body += '<input type="checkbox" value="' + server + '/stream.m3u8' + multiviewquerystring + '" onclick="addmultiview(this)">'
1109
1119
  }
@@ -1126,7 +1136,12 @@ app.get('/', async function(req, res) {
1126
1136
  body += ', '
1127
1137
  }
1128
1138
  } else {
1129
- body += teamabbr + ': ' + station + ', '
1139
+ if ( teamabbr.endsWith('*') ) {
1140
+ body += '<span class="tooltip">' + teamabbr + '<span class="tooltiptext">* will include the away team\'s alternate audio, instead of the default home team\'s</span></span>'
1141
+ } else {
1142
+ body += teamabbr
1143
+ }
1144
+ body += ': ' + station + ', '
1130
1145
  }
1131
1146
  }
1132
1147
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mlbserver",
3
- "version": "2021.10.6",
3
+ "version": "2021.10.10",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",
package/session.js CHANGED
@@ -935,13 +935,13 @@ class sessionClass {
935
935
  let mediaId = false
936
936
  let contentId = false
937
937
 
938
- // First check if cached day data is available and non-expired
938
+ // First check if national game or if cached day data is available and non-expired
939
939
  // if not, just get data for this team
940
940
  let cache_data
941
941
  let cache_name = gameDate
942
942
  let cache_file = path.join(CACHE_DIRECTORY, gameDate+'.json')
943
943
  let currentDate = new Date()
944
- if ( fs.existsSync(cache_file) && this.cache && this.cache.dates && this.cache.dates[cache_name] && this.cache.dates[cache_name].dateCacheExpiry && (currentDate <= new Date(this.cache.dates[cache_name].dateCacheExpiry)) ) {
944
+ if ( (team.toUpperCase().indexOf('NATIONAL.') == 0) || (fs.existsSync(cache_file) && this.cache && this.cache.dates && this.cache.dates[cache_name] && this.cache.dates[cache_name].dateCacheExpiry && (currentDate <= new Date(this.cache.dates[cache_name].dateCacheExpiry))) ) {
945
945
  cache_data = await this.getDayData(gameDate)
946
946
  } else {
947
947
  cache_data = await this.getDayData(gameDate, team)
@@ -958,7 +958,7 @@ class sessionClass {
958
958
  for (var x = 0; x < cache_data.dates[0].games[j].content.media.epg[k].items.length; x++) {
959
959
  if ( (cache_data.dates[0].games[j].content.media.epg[k].items[x].mediaState == 'MEDIA_ON') || ((mediaDate) && ((cache_data.dates[0].games[j].content.media.epg[k].items[x].mediaState == 'MEDIA_ARCHIVE') || (cache_data.dates[0].games[j].status.abstractGameState == 'Final'))) ) {
960
960
  if ( ((typeof cache_data.dates[0].games[j].content.media.epg[k].items[x].mediaFeedType) == 'undefined') || (cache_data.dates[0].games[j].content.media.epg[k].items[x].mediaFeedType.indexOf('IN_MARKET_') == -1) ) {
961
- if ( (team.toUpperCase().indexOf('NATIONAL.') == 0) && (cache_data.dates[0].games[j].content.media.epg[k].items[x][mediaFeedType] == 'NATIONAL') ) {
961
+ if ( (team.toUpperCase().indexOf('NATIONAL.') == 0) && ((cache_data.dates[0].games[j].content.media.epg[k].items[x][mediaFeedType] == 'NATIONAL') || ((mediaType == 'MLBTV') && cache_data.dates[0].games[j].gameUtils.isPostSeason)) ) {
962
962
  nationalCount += 1
963
963
  let nationalArray = team.split('.')
964
964
  if ( (nationalArray.length == 2) && (nationalArray[1] == nationalCount) ) {
@@ -1242,6 +1242,9 @@ class sessionClass {
1242
1242
  for (var x = 0; x < cache_data.dates[i].games[j].content.media.epg[k].items.length; x++) {
1243
1243
  if ( ((((typeof cache_data.dates[i].games[j].content.media.epg[k].items[x].mediaFeedType) == 'undefined') || (cache_data.dates[i].games[j].content.media.epg[k].items[x].mediaFeedType.indexOf('IN_MARKET_') == -1)) && (((typeof cache_data.dates[i].games[j].content.media.epg[k].items[x].language) == 'undefined') || (cache_data.dates[i].games[j].content.media.epg[k].items[x].language != 'es'))) ) {
1244
1244
  let teamType = cache_data.dates[i].games[j].content.media.epg[k].items[x][mediaFeedType]
1245
+ if ( (mediaType == 'MLBTV') && cache_data.dates[i].games[j].gameUtils.isPostSeason ) {
1246
+ teamType = 'NATIONAL'
1247
+ }
1245
1248
  let team
1246
1249
  let opponent_team
1247
1250
  if ( teamType == 'NATIONAL' ) {
@@ -1396,6 +1399,9 @@ class sessionClass {
1396
1399
  for (var x = 0; x < cache_data.dates[i].games[j].content.media.epg[k].items.length; x++) {
1397
1400
  if ( ((((typeof cache_data.dates[i].games[j].content.media.epg[k].items[x].mediaFeedType) == 'undefined') || (cache_data.dates[i].games[j].content.media.epg[k].items[x].mediaFeedType.indexOf('IN_MARKET_') == -1)) && (((typeof cache_data.dates[i].games[j].content.media.epg[k].items[x].language) == 'undefined') || (cache_data.dates[i].games[j].content.media.epg[k].items[x].language != 'es'))) ) {
1398
1401
  let teamType = cache_data.dates[i].games[j].content.media.epg[k].items[x][mediaFeedType]
1402
+ if ( (mediaType == 'MLBTV') && cache_data.dates[i].games[j].gameUtils.isPostSeason ) {
1403
+ teamType = 'NATIONAL'
1404
+ }
1399
1405
  let team
1400
1406
  let opponent_team
1401
1407
  if ( teamType == 'NATIONAL' ) {
@@ -1457,6 +1463,14 @@ class sessionClass {
1457
1463
  }
1458
1464
  description += '. '
1459
1465
  }
1466
+ if ( teamType == 'NATIONAL' ) {
1467
+ if ( cache_data.dates[i].games[j].content.media.epg[k].items[x][mediaFeedType] == 'AWAY' ) {
1468
+ description += cache_data.dates[i].games[j].teams['away'].team.teamName
1469
+ } else {
1470
+ description += cache_data.dates[i].games[j].teams['home'].team.teamName
1471
+ }
1472
+ description += ' alternate audio. '
1473
+ }
1460
1474
 
1461
1475
  let gameDate = new Date(cache_data.dates[i].games[j].gameDate)
1462
1476
  let gameHours = 3