mlbserver 2024.3.26 → 2024.3.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 +1 -1
- package/index.js +7 -7
- package/package.json +1 -1
- package/session.js +11 -10
package/README.md
CHANGED
package/index.js
CHANGED
|
@@ -47,7 +47,7 @@ const SAMPLE_STREAM_URL = 'https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8'
|
|
|
47
47
|
const SECONDS_PER_SEGMENT = 5
|
|
48
48
|
|
|
49
49
|
// for favorites: text, then background, based on https://teamcolors.jim-nielsen.com/
|
|
50
|
-
const TEAM_COLORS = {'
|
|
50
|
+
const TEAM_COLORS = { 'ATL': ['13274F', 'CE1141'], 'AZ': ['E3D4AD', 'A71930'], 'BAL': ['000000', 'DF4601'], 'BOS': ['0D2B56', 'BD3039'], 'CHC': ['CC3433', '0E3386'], 'CWS': ['000000', 'C4CED4'], 'CIN': ['FFFFFF', 'C6011F'], 'CLE': ['002B5C', 'E31937'], 'COL': ['C4CED4', '333366'], 'DET': ['0C2C56', 'FFFFFF'], 'HOU': ['002D62', 'EB6E1F'], 'KC': ['C09A5B', '004687'], 'LAA': ['FFFFFF', 'BA0021'], 'LAD': ['FFFFFF', '005A9C'], 'MIA': ['0077C8', 'FF6600'], 'MIL': ['0A2351', 'B6922E'], 'MIN': ['D31145', '002B5C'], 'NYM': ['002D72', 'FF5910'], 'NYY': ['FFFFFF', '003087'], 'OAK': ['003831', 'EFB21E'], 'PHI': ['284898', 'E81828'], 'PIT': ['000000', 'FDB827'], 'STL': ['FEDB00', 'C41E3A'], 'SD': ['FEC325', '7F411C'], 'SF': ['000000', 'FD5A1E'], 'SEA': ['C4CED4', '005C5C'], 'TB': ['092C5C', '8FBCE6'], 'TEX': ['003278', 'C0111F'], 'TOR': ['FFFFFF', '134A8E'], 'WSH': ['AB0003', '11225B'] }
|
|
51
51
|
|
|
52
52
|
// Gamechanger resolutions
|
|
53
53
|
const GAMECHANGER_RESOLUTIONS = {
|
|
@@ -2112,7 +2112,7 @@ app.get('/', async function(req, res) {
|
|
|
2112
2112
|
|
|
2113
2113
|
body += '<p><span class="tooltip">All<span class="tooltiptext">Will include all live MLB broadcasts. If favorite team(s) have been provided, it will also include affiliate games for those organizations. If a zip code has been provided, channels/games subject to blackout will be omitted by default. See below for an additional option to override that.</span></span>: <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"
|
|
2114
2114
|
|
|
2115
|
-
let include_teams = '
|
|
2115
|
+
let include_teams = 'atl,national'
|
|
2116
2116
|
if ( session.credentials.fav_teams.length > 0 ) {
|
|
2117
2117
|
include_teams = session.credentials.fav_teams.toString()
|
|
2118
2118
|
}
|
|
@@ -2120,7 +2120,7 @@ app.get('/', async function(req, res) {
|
|
|
2120
2120
|
|
|
2121
2121
|
body += '<p><span class="tooltip">Include blackouts<span class="tooltiptext">An optional parameter added to the URL will include channels/games subject to blackout (although you may not be able to play those games).</span></span>: <a href="/channels.m3u?mediaType=' + mediaType + '&resolution=' + resolution + '&includeTeams=' + include_teams + '&includeBlackouts=true' + content_protect_b + '">channels.m3u</a> and <a href="/guide.xml?mediaType=' + mediaType + '&includeTeams=' + include_teams + '&includeBlackouts=true' + content_protect_b + '">guide.xml</a></p>' + "\n"
|
|
2122
2122
|
|
|
2123
|
-
let exclude_teams = '
|
|
2123
|
+
let exclude_teams = 'atl,national'
|
|
2124
2124
|
if ( session.credentials.blackout_teams.length > 0 ) {
|
|
2125
2125
|
exclude_teams = session.credentials.blackout_teams.toString()
|
|
2126
2126
|
exclude_teams += ',national'
|
|
@@ -2143,9 +2143,9 @@ app.get('/', async function(req, res) {
|
|
|
2143
2143
|
body += '<p><span class="tooltip">Free games only<span class="tooltiptext">Only includes games marked as free. Blackouts still apply. If a zip code has been provided, channels/games subject to blackout will be omitted by default.</span></span>: <a href="/channels.m3u?mediaType=' + mediaType + '&resolution=' + resolution + '&includeTeams=free' + content_protect_b + '">channels.m3u</a> and <a href="/guide.xml?mediaType=' + mediaType + '&includeTeams=free' + content_protect_b + '">guide.xml</a></p>' + "\n"
|
|
2144
2144
|
}
|
|
2145
2145
|
|
|
2146
|
-
body += '<p><span class="tooltip">Include affiliates by org<span class="tooltiptext">Including an organization (by MLB team abbreviation, in a comma-separated list if more than 1) will include all of its affiliate broadcasts, or if that affiliate is not broadcasting the game, it will include the opponent\'s broadcast if available. If this option is not specified, but favorite team(s) have been provided, affiliate games for those organizations will be included anyway.</span></span>: <a href="/channels.m3u?mediaType=' + mediaType + '&resolution=' + resolution + '&includeOrgs=
|
|
2146
|
+
body += '<p><span class="tooltip">Include affiliates by org<span class="tooltiptext">Including an organization (by MLB team abbreviation, in a comma-separated list if more than 1) will include all of its affiliate broadcasts, or if that affiliate is not broadcasting the game, it will include the opponent\'s broadcast if available. If this option is not specified, but favorite team(s) have been provided, affiliate games for those organizations will be included anyway.</span></span>: <a href="/channels.m3u?mediaType=' + mediaType + '&resolution=' + resolution + '&includeOrgs=atl,az' + content_protect_b + '">channels.m3u</a> and <a href="/guide.xml?mediaType=' + mediaType + '&includeOrgs=atl,az' + content_protect_b + '">guide.xml</a></p>' + "\n"
|
|
2147
2147
|
|
|
2148
|
-
body += '<p><span class="tooltip">Include by level<span class="tooltiptext">Including a level (AAA, AA, A
|
|
2148
|
+
body += '<p><span class="tooltip">Include by level<span class="tooltiptext">Including a level (AAA, AA, A+ encoded as A%2B, or A, in a comma-separated list if more than 1) will include all of its broadcasts, and exclude all other levels.</span></span>: <a href="/channels.m3u?mediaType=' + mediaType + '&resolution=' + resolution + '&includeLevels=a%2B,aaa' + content_protect_b + '">channels.m3u</a> and <a href="/guide.xml?mediaType=' + mediaType + '&includeLevels=a%2B,aaa' + content_protect_b + '">guide.xml</a></p>' + "\n"
|
|
2149
2149
|
|
|
2150
2150
|
body += '</td></tr></table><br/>' + "\n"
|
|
2151
2151
|
|
|
@@ -2154,7 +2154,7 @@ app.get('/', async function(req, res) {
|
|
|
2154
2154
|
body += '<p>' + "\n"
|
|
2155
2155
|
let example_types = [ ['embed.html', 'Embed'], ['stream.m3u8', 'Stream'], ['chromecast.html', 'Chromecast'], ['kodi.strm', 'Kodi'] ]
|
|
2156
2156
|
|
|
2157
|
-
let example_team = '
|
|
2157
|
+
let example_team = 'atl'
|
|
2158
2158
|
if ( session.credentials.fav_teams.length > 0 ) {
|
|
2159
2159
|
example_team = session.credentials.fav_teams[0]
|
|
2160
2160
|
}
|
|
@@ -2199,7 +2199,7 @@ app.get('/', async function(req, res) {
|
|
|
2199
2199
|
let gamechanger_streamURL = server + '/gamechanger.m3u8?resolution=best' + content_protect_b
|
|
2200
2200
|
let gamechanger_types = ['in', 'ex']
|
|
2201
2201
|
for (var i=0; i<gamechanger_types.length; i++) {
|
|
2202
|
-
let example_streamURL = gamechanger_streamURL + '&' + gamechanger_types[i] + 'cludeTeams=
|
|
2202
|
+
let example_streamURL = gamechanger_streamURL + '&' + gamechanger_types[i] + 'cludeTeams=ATL,AZ'
|
|
2203
2203
|
body += '• ' + gamechanger_types[i] + 'clude: <a href="/embed.html?src=' + encodeURIComponent(example_streamURL) + '&startFrom=' + VALID_START_FROM[1] + content_protect_b + '">Embed</a> | <a href="' + example_streamURL + '">Stream</a> | <a href="/chromecast.html?src=' + encodeURIComponent(example_streamURL) + content_protect_b + '">Chromecast</a> | <a href="/advanced.html?src=' + encodeURIComponent(example_streamURL) + content_protect_b + '">Advanced</a> | <a href="/kodi.strm?src=' + encodeURIComponent(example_streamURL) + content_protect_b + '">Kodi</a><br/>' + "\n"
|
|
2204
2204
|
}
|
|
2205
2205
|
|
package/package.json
CHANGED
package/session.js
CHANGED
|
@@ -23,9 +23,9 @@ const API_KEY = 'bWxidHYmYW5kcm9pZCYxLjAuMA.6LZMbH2r--rbXcgEabaDdIslpo4RyZrlVfWZ
|
|
|
23
23
|
// Default date handling
|
|
24
24
|
const TODAY_UTC_HOURS = 8 // UTC hours (EST + 4) into tomorrow to still use today's date
|
|
25
25
|
|
|
26
|
-
const TEAM_IDS = {'
|
|
26
|
+
const TEAM_IDS = { 'ATL': '144', 'AZ': '109', 'BAL': '110', 'BOS': '111', 'CHC': '112', 'CWS': '145', 'CIN': '113', 'CLE': '114', 'COL': '115', 'DET': '116', 'HOU': '117', 'KC': '118', 'LAA': '108', 'LAD': '119', 'MIA': '146', 'MIL': '158', 'MIN': '142', 'NYM': '121', 'NYY': '147', 'OAK': '133', 'PHI': '143', 'PIT': '134', 'STL': '138', 'SD': '135', 'SF': '137', 'SEA': '136', 'TB': '139', 'TEX': '140', 'TOR': '141', 'WSH': '120' }
|
|
27
27
|
|
|
28
|
-
const AFFILIATE_TEAM_IDS = { '
|
|
28
|
+
const AFFILIATE_TEAM_IDS = { 'ATL': '430,431,432,478', 'AZ': '419,516,2310,5368', 'BAL': '418,488,548,568', 'BOS': '414,428,533,546', 'CHC': '451,521,550,553', 'CIN': '416,450,459,498', 'CLE': '402,437,445,481', 'COL': '259,342,486,538', 'CWS': '247,487,494,580', 'DET': '106,512,570,582', 'HOU': '482,573,3712,5434', 'KC': '541,565,1350,3705', 'LAA': '401,460,559,561', 'LAD': '238,260,456,526', 'MIA': '479,554,564,4124', 'MIL': '249,556,572,5015', 'MIN': '492,509,1960,3898', 'NYM': '453,505,507,552', 'NYY': '531,537,587,1956', 'OAK': '237,400,499,524', 'PHI': '427,522,566,1410', 'PIT': '452,477,484,3390', 'SD': '103,510,584,4904', 'SEA': '403,515,529,574', 'SF': '105,461,476,3410', 'STL': '235,279,440,443', 'TB': '233,234,421,2498', 'TEX': '102,448,485,540', 'TOR': '422,424,435,463', 'WSH': '426,436,534,547' }
|
|
29
29
|
|
|
30
30
|
// Other country options would be USA, Canada, or other
|
|
31
31
|
const ESPN_SUNDAY_NIGHT_BLACKOUT_COUNTRIES = ["Angola", "Anguilla", "Antigua and Barbuda", "Argentina", "Aruba", "Australia", "Bahamas", "Barbados", "Belize", "Belize", "Benin", "Bermuda", "Bolivia", "Bonaire", "Botswana", "Brazil", "British Virgin Islands", "Burkina Faso", "Burundi", "Cameroon", "Cape Verde", "Cayman Islands", "Central African Republic", "Chad", "Chile", "Colombia", "Comoros", "Cook Islands", "Costa Rica", "Cote d'Ivoire", "Curacao", "Democratic Republic of the Congo", "Djibouti", "Dominica", "Dominican Republic", "Ecuador", "El Salvador", "England", "Equatorial Guinea", "Eritrea", "Eswatini", "Ethiopia", "Falkland Islands", "Falkland Islands", "Fiji", "French Guiana", "French Guiana", "French Polynesia", "Gabon", "Ghana", "Grenada", "Guadeloupe", "Guatemala", "Guinea", "Guinea Bissau", "Guyana", "Guyana", "Haiti", "Honduras", "Ireland", "Jamaica", "Kenya", "Kiribati", "Lesotho", "Liberia", "Madagascar", "Malawi", "Mali", "Marshall Islands", "Martinique", "Mayotte", "Mexico", "Micronesia", "Montserrat", "Mozambique", "Namibia", "Netherlands", "New Zealand", "Nicaragua", "Niger", "Nigeria", "Niue", "Northern Ireland", "Palau Islands", "Panama", "Paraguay", "Peru", "Republic of Ireland", "Reunion", "Rwanda", "Saba", "Saint Maarten", "Samoa", "Sao Tome & Principe", "Scotland", "Senegal", "Seychelles", "Sierra Leone", "Solomon Islands", "Somalia", "South Africa", "St. Barthelemy", "St. Eustatius", "St. Kitts and Nevis", "St. Lucia", "St. Martin", "St. Vincent and the Grenadines", "Sudan", "Surinam", "Suriname", "Tahiti", "Tanzania & Zanzibar", "The Gambia", "The Republic of Congo", "Togo", "Tokelau", "Tonga", "Trinidad and Tobago", "Turks and Caicos Islands", "Tuvalu", "Uganda", "Uruguay", "Venezuela", "Wales", "Zambia", "Zimbabwe"]
|
|
@@ -2285,7 +2285,7 @@ class sessionClass {
|
|
|
2285
2285
|
if ( (includeLevels.length > 1) || !includeLevels.includes('ALL') ) {
|
|
2286
2286
|
let level_list = []
|
|
2287
2287
|
for (let i = 0; i < includeLevels.length; i++) {
|
|
2288
|
-
level_list.
|
|
2288
|
+
level_list.push(LEVELS[includeLevels[i]])
|
|
2289
2289
|
}
|
|
2290
2290
|
level_ids = level_list.toString()
|
|
2291
2291
|
}
|
|
@@ -2356,10 +2356,11 @@ class sessionClass {
|
|
|
2356
2356
|
}
|
|
2357
2357
|
let channelid = mediaType + '.' + team
|
|
2358
2358
|
let logo = server + '/image.svg?teamId=' + team_id
|
|
2359
|
+
if ( this.protection.content_protect ) logo += '&content_protect=' + this.protection.content_protect
|
|
2359
2360
|
let streamMediaType = 'Video'
|
|
2360
2361
|
let stream = server + '/stream.m3u8?team=' + encodeURIComponent(team) + '&mediaType=' + streamMediaType
|
|
2361
2362
|
let sportId = cache_data.dates[i].games[j].teams['home'].team.sport.id
|
|
2362
|
-
stream += '&level=' + this.getLevelNameFromSportId(sportId)
|
|
2363
|
+
stream += '&level=' + encodeURIComponent(this.getLevelNameFromSportId(sportId))
|
|
2363
2364
|
stream += '&resolution=' + resolution
|
|
2364
2365
|
if ( this.protection.content_protect ) stream += '&content_protect=' + this.protection.content_protect
|
|
2365
2366
|
if ( pipe == 'true' ) stream = await this.convert_stream_to_pipe(stream, channelid)
|
|
@@ -2491,7 +2492,7 @@ class sessionClass {
|
|
|
2491
2492
|
let icon
|
|
2492
2493
|
if ( cache_data.dates[i].games[j].seriesDescription == 'All-Star Game' ) {
|
|
2493
2494
|
icon = server + '/image.svg?teamId=' + cache_data.dates[i].games[j].content.media.epg[k].items[x].mediaFeedSubType
|
|
2494
|
-
if ( this.protection.content_protect ) icon += '&content_protect=' + this.protection.content_protect
|
|
2495
|
+
if ( this.protection.content_protect ) icon += '&content_protect=' + this.protection.content_protect
|
|
2495
2496
|
} else {
|
|
2496
2497
|
icon = 'https://img.mlbstatic.com/mlb-photos/image/upload/ar_167:215,c_crop/fl_relative,l_team:' + cache_data.dates[i].games[j].teams['home'].team.id + ':fill:spot.png,w_1.0,h_1,x_0.5,y_0,fl_no_overflow,e_distort:100p:0:200p:0:200p:100p:0:100p/fl_relative,l_team:' + cache_data.dates[i].games[j].teams['away'].team.id + ':logo:spot:current,w_0.38,x_-0.25,y_-0.16/fl_relative,l_team:' + cache_data.dates[i].games[j].teams['home'].team.id + ':logo:spot:current,w_0.38,x_0.25,y_0.16/w_750/team/' + cache_data.dates[i].games[j].teams['away'].team.id + '/fill/spot.png'
|
|
2497
2498
|
}
|
|
@@ -2520,11 +2521,11 @@ class sessionClass {
|
|
|
2520
2521
|
let logo = server
|
|
2521
2522
|
if ( (teamType == 'NATIONAL') && ((includeTeams.length == 0) || ((includeTeams.length > 0) && includeTeams.includes(teamType))) ) {
|
|
2522
2523
|
logo += '/image.svg?teamId=MLB'
|
|
2523
|
-
if ( this.protection.content_protect ) logo += '&content_protect=' + this.protection.content_protect
|
|
2524
|
+
if ( this.protection.content_protect ) logo += '&content_protect=' + this.protection.content_protect
|
|
2524
2525
|
nationalChannels[channelid] = await this.create_channel_object(channelid, logo, stream, channelMediaType)
|
|
2525
2526
|
} else {
|
|
2526
2527
|
logo += '/image.svg?teamId=' + cache_data.dates[i].games[j].content.media.epg[k].items[x].mediaFeedSubType
|
|
2527
|
-
if ( this.protection.content_protect ) logo += '&content_protect=' + this.protection.content_protect
|
|
2528
|
+
if ( this.protection.content_protect ) logo += '&content_protect=' + this.protection.content_protect
|
|
2528
2529
|
channels[channelid] = await this.create_channel_object(channelid, logo, stream, channelMediaType)
|
|
2529
2530
|
}
|
|
2530
2531
|
|
|
@@ -2605,7 +2606,7 @@ class sessionClass {
|
|
|
2605
2606
|
this.debuglog('getTVData processing Big Inning')
|
|
2606
2607
|
let logo = 'https://img.mlbstatic.com/mlb-images/image/private/ar_16:9,g_auto,q_auto:good,w_372,c_fill,f_jpg/mlb/uwr8vepua4t1fe8uwyki'
|
|
2607
2608
|
let channelid = mediaType + '.BIGINNING'
|
|
2608
|
-
if ( this.protection.content_protect ) logo += '&content_protect=' + this.protection.content_protect
|
|
2609
|
+
if ( this.protection.content_protect ) logo += '&content_protect=' + this.protection.content_protect
|
|
2609
2610
|
let stream = server + '/stream.m3u8?event=biginning&mediaType=Video&resolution=' + resolution
|
|
2610
2611
|
if ( this.protection.content_protect ) stream += '&content_protect=' + this.protection.content_protect
|
|
2611
2612
|
if ( pipe == 'true' ) stream = await this.convert_stream_to_pipe(stream, channelid)
|
|
@@ -2651,7 +2652,7 @@ class sessionClass {
|
|
|
2651
2652
|
this.debuglog('getTVData processing Game Changer')
|
|
2652
2653
|
let channelid = mediaType + '.GAMECHANGER'
|
|
2653
2654
|
let logo = server + '/image.svg?teamId=MLB'
|
|
2654
|
-
if ( this.protection.content_protect ) logo += '&content_protect=' + this.protection.content_protect
|
|
2655
|
+
if ( this.protection.content_protect ) logo += '&content_protect=' + this.protection.content_protect
|
|
2655
2656
|
let stream = server + '/gamechanger.m3u8?resolution=' + resolution
|
|
2656
2657
|
if ( pipe == 'true' ) stream = await this.convert_stream_to_pipe(stream, channelid)
|
|
2657
2658
|
channels[channelid] = await this.create_channel_object(channelid, logo, stream, mediaType)
|
|
@@ -2688,7 +2689,7 @@ class sessionClass {
|
|
|
2688
2689
|
this.debuglog('getTVData processing Multiview')
|
|
2689
2690
|
let channelid = mediaType + '.MULTIVIEW'
|
|
2690
2691
|
let logo = server + '/image.svg?teamId=MLB'
|
|
2691
|
-
if ( this.protection.content_protect ) logo += '&content_protect=' + this.protection.content_protect
|
|
2692
|
+
if ( this.protection.content_protect ) logo += '&content_protect=' + this.protection.content_protect
|
|
2692
2693
|
let stream = server.replace(':' + this.data.port, ':' + this.data.multiviewPort) + this.data.multiviewStreamURLPath
|
|
2693
2694
|
if ( pipe == 'true' ) stream = await this.convert_stream_to_pipe(stream, channelid)
|
|
2694
2695
|
channels[channelid] = await this.create_channel_object(channelid, logo, stream, mediaType)
|