mlbserver 2022.5.27 → 2022.5.30

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 2022.05.27
3
+ Current version 2022.05.30
4
4
 
5
5
  Credit to https://github.com/tonycpsu/streamglob and https://github.com/mafintosh/hls-decryptor
6
6
 
package/index.js CHANGED
@@ -42,6 +42,8 @@ const VALID_SCAN_MODES = [ 'off', 'on' ]
42
42
 
43
43
  const SAMPLE_STREAM_URL = 'https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8'
44
44
 
45
+ const SECONDS_PER_SEGMENT = 5
46
+
45
47
  // Basic command line arguments, if specified:
46
48
  // --port or -p (primary port to run on; defaults to 9999 if not specified)
47
49
  // --debug or -d (false if not specified)
@@ -188,8 +190,8 @@ app.get('/stream.m3u8', async function(req, res) {
188
190
  options.skip = req.query.skip || VALID_SKIP[0]
189
191
  options.pad = req.query.pad || VALID_PAD[0]
190
192
  if ( options.pad != VALID_PAD[0] ) {
191
- // if pad is selected, pick a random number of times to repeat the last segment
192
- options.pad = Math.floor(Math.random() * 1440) + 720
193
+ // if pad is selected, pick a random number of times to repeat the last segment (between 1-3 hours)
194
+ options.pad = Math.floor(Math.random() * (7200 / SECONDS_PER_SEGMENT)) + (3600 / SECONDS_PER_SEGMENT)
193
195
  }
194
196
 
195
197
  if ( req.query.src ) {
@@ -668,7 +670,7 @@ app.get('/playlist', async function(req, res) {
668
670
  if ( body_array[last_segment_index] == '#EXT-X-ENDLIST' ) {
669
671
  session.debuglog('padding archive stream with extra segments')
670
672
  last_segment_index--
671
- while ( !body_array[last_segment_index].startsWith('#EXTINF:5') ) {
673
+ while ( !body_array[last_segment_index].startsWith('#EXTINF:' + SECONDS_PER_SEGMENT) ) {
672
674
  last_segment_index--
673
675
  }
674
676
  last_segment_inf = body_array[last_segment_index]
@@ -1429,7 +1431,7 @@ app.get('/', async function(req, res) {
1429
1431
 
1430
1432
  body += '<p>All: <a href="/channels.m3u?mediaType=' + mediaType + '&resolution=' + resolution + content_protect_b + '">channels.m3u</a> and <a href="/guide.xml?mediaType=' + mediaType + content_protect_b + '">guide.xml</a></p>' + "\n"
1431
1433
 
1432
- body += '<p><span class="tooltip">By team<span class="tooltiptext">Including a team will include that team\'s broadcasts, not their opponent\'s broadcasts or national TV broadcasts.</span></span>: <a href="/channels.m3u?mediaType=' + mediaType + '&resolution=' + resolution + '&includeTeams=ari' + content_protect_b + '">channels.m3u</a> and <a href="/guide.xml?mediaType=' + mediaType + '&includeTeams=ari' + content_protect_b + '">guide.xml</a></p>' + "\n"
1434
+ body += '<p><span class="tooltip">By team<span class="tooltiptext">Including a team will include that team\'s broadcasts, not their opponent\'s broadcasts or national TV broadcasts.</span></span>: <a href="/channels.m3u?mediaType=' + mediaType + '&resolution=' + resolution + '&includeTeams=ari,atl' + content_protect_b + '">channels.m3u</a> and <a href="/guide.xml?mediaType=' + mediaType + '&includeTeams=ari,atl' + content_protect_b + '">guide.xml</a></p>' + "\n"
1433
1435
 
1434
1436
  body += '<p><span class="tooltip">Exclude a team + national<span class="tooltiptext">This is useful for excluding games you may be blacked out from. Excluding a team will exclude every game involving that team. National refers to <a href="https://www.mlb.com/live-stream-games/national-blackout">USA national TV broadcasts</a>.</span></span>: <a href="/channels.m3u?mediaType=' + mediaType + '&resolution=' + resolution + '&excludeTeams=ari,national' + content_protect_b + '">channels.m3u</a> and <a href="/guide.xml?mediaType=' + mediaType + '&excludeTeams=ari,national' + content_protect_b + '">guide.xml</a></p>' + "\n"
1435
1437
 
@@ -1969,8 +1971,8 @@ function start_multiview_stream(streams, sync, dvr, faster, reencode, audio_url,
1969
1971
  }
1970
1972
  }
1971
1973
 
1972
- // Default to keep only 12 most recent segments on disk (1 minute of 5 second segments), unless dvr is specified
1973
- var hls_list_size = 12
1974
+ // Default to keep only 1 minute of segments on disk, unless dvr is specified
1975
+ var hls_list_size = 60 / SECONDS_PER_SEGMENT
1974
1976
  var delete_segments = 'delete_segments+'
1975
1977
  if ( dvr ) {
1976
1978
  hls_list_size = 0
@@ -2013,7 +2015,7 @@ function start_multiview_stream(streams, sync, dvr, faster, reencode, audio_url,
2013
2015
  ffmpeg_command.addOutputOption('-sn')
2014
2016
  .addOutputOption('-t', '6:00:00')
2015
2017
  .addOutputOption('-f', 'hls')
2016
- .addOutputOption('-hls_time', '5')
2018
+ .addOutputOption('-hls_time', SECONDS_PER_SEGMENT)
2017
2019
  .addOutputOption('-hls_list_size', hls_list_size)
2018
2020
  .addOutputOption('-hls_allow_cache', '0')
2019
2021
  .addOutputOption('-hls_flags', delete_segments + 'independent_segments+discont_start+program_date_time')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mlbserver",
3
- "version": "2022.05.27",
3
+ "version": "2022.05.30",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",
package/session.js CHANGED
@@ -533,7 +533,7 @@ class sessionClass {
533
533
  if ( playlistURL ) {
534
534
  return playlistURL
535
535
  } else {
536
- session.log('Failed to find audio playlist URL from ' + url)
536
+ this.log('Failed to find audio playlist URL from ' + url)
537
537
  return ''
538
538
  }
539
539
  }