mlbserver 2024.6.26 → 2024.6.29

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 2024.06.26
3
+ Current version 2024.06.29
4
4
 
5
5
  Credit to https://github.com/tonycpsu/streamglob and https://github.com/mafintosh/hls-decryptor
6
6
 
package/index.js CHANGED
@@ -355,16 +355,23 @@ app.get('/stream.m3u8', async function(req, res) {
355
355
  }
356
356
 
357
357
  // resolve any alternate audio mediaIds into playlist URLs, if necessary
358
- if ( options.alternate_audio_tracks ) {
359
- for (const [key, value] of Object.entries(options.alternate_audio_tracks)) {
360
- if ( (options.audio_track == VALID_AUDIO_TRACKS[0]) || (options.audio_track == key) ) {
361
- let audioStreamURL = await session.getStreamURL(value)
362
- let audioPlaylistURL = audioStreamURL.replace(/\/(master_radio_complete|master_radio)/g,'/48K/48_complete')
363
- options.alternate_audio_tracks[key] = audioPlaylistURL
364
- } else {
358
+ try {
359
+ if ( options.alternate_audio_tracks ) {
360
+ for (const [key, value] of Object.entries(options.alternate_audio_tracks)) {
361
+ if ( (options.audio_track == VALID_AUDIO_TRACKS[0]) || (options.audio_track == key) ) {
362
+ session.debuglog('stream request attempting to add alternate audio from ' + value)
363
+ let audioStreamURL = await session.getStreamURL(value)
364
+ if ( audioStreamURL ) {
365
+ let audioPlaylistURL = audioStreamURL.replace(/\/(master_radio_complete|master_radio)/g,'/48K/48_complete')
366
+ options.alternate_audio_tracks[key] = audioPlaylistURL
367
+ continue
368
+ }
369
+ }
365
370
  delete options.alternate_audio_tracks[key]
366
371
  }
367
372
  }
373
+ } catch (e) {
374
+ session.debuglog('stream request alternate audio error : ' + e.message)
368
375
  }
369
376
 
370
377
  if ( (options.inning_half != VALID_INNING_HALF[0]) || (options.inning_number != VALID_INNING_NUMBER[0]) || (options.skip != VALID_SKIP[0]) ) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mlbserver",
3
- "version": "2024.06.26",
3
+ "version": "2024.06.29",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",
package/session.js CHANGED
@@ -37,9 +37,9 @@ const LEVELS = { 'MLB': '1', 'AAA': '11', 'AA': '12', 'A+': '13', 'A': '14', 'Al
37
37
  const BREAK_TYPES = ['Game Advisory', 'Pitching Substitution', 'Offensive Substitution', 'Defensive Sub', 'Defensive Switch', 'Runner Placed On Base']
38
38
  // These are the events to keep, in addition to the last event of each at-bat, if we're skipping pitches
39
39
  const ACTION_TYPES = ['Wild Pitch', 'Passed Ball', 'Stolen Base', 'Caught Stealing', 'Pickoff', 'Error', 'Out', 'Balk', 'Defensive Indiff', 'Other Advance']
40
- const EVENT_START_PADDING = 0
40
+ const EVENT_START_PADDING = 8
41
41
  const PITCH_END_PADDING = 7
42
- const ACTION_END_PADDING = 10
42
+ const ACTION_END_PADDING = 18
43
43
  const MINIMUM_BREAK_DURATION = 5
44
44
 
45
45
  const LI_TABLE = {
@@ -1607,9 +1607,12 @@ class sessionClass {
1607
1607
  if ( response && this.isValidJson(response) ) {
1608
1608
  this.debuglog('getStreamURL response : ' + response)
1609
1609
  let obj = JSON.parse(response)
1610
- if ( obj.errors && (obj.errors[0] == 'blackout') ) {
1611
- this.log('blackout error')
1612
- this.markBlackoutError(mediaId)
1610
+ if ( obj.errors ) {
1611
+ this.log('getStreamURL error: ' + obj.errors[0])
1612
+ if ( obj.errors[0] == 'blackout' ) {
1613
+ this.markBlackoutError(mediaId)
1614
+ }
1615
+ return false
1613
1616
  } else {
1614
1617
  let streamURL = obj.stream.complete
1615
1618
  this.debuglog('getStreamURL : ' + streamURL)