mlbserver 2025.2.25 → 2025.2.27

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/Dockerfile CHANGED
@@ -21,4 +21,4 @@ RUN npm install
21
21
  COPY . .
22
22
 
23
23
  EXPOSE 9999 10000
24
- CMD [ "node", "index.js", "--env" ]
24
+ CMD [ "node", "index.js", "--env", "--port", "9999", "--multiview_port", "10000", "--data_directory", "/mlbserver/data_directory" ]
package/README.md CHANGED
@@ -14,7 +14,7 @@ npm install -g mlbserver
14
14
 
15
15
  ### docker
16
16
  ```
17
- docker pull tonywagner/mlbserver
17
+ docker pull tonywagner/mlbserver:latest
18
18
  ```
19
19
 
20
20
 
@@ -30,54 +30,10 @@ node index.js
30
30
  ```
31
31
 
32
32
  ### docker-compose
33
- Update the environment variables below and save it as docker-compose.yml:
34
- ```
35
- services:
36
- mlbserver:
37
- image: tonywagner/mlbserver:latest
38
- container_name: mlbserver
39
- environment:
40
- - TZ=America/New York
41
- - data_directory=/mlbserver/data_directory
42
- - account_username=your.account.email@example.com
43
- - account_password=youraccountpassword
44
- #- fav_teams=AZ,BAL
45
- #- debug=false
46
- #- port=9999
47
- #- multiview_port=10000
48
- #- multiview_path=
49
- #- ffmpeg_path=
50
- #- ffmpeg_encoder=
51
- #- page_username=
52
- #- page_password=
53
- #- content_protect=
54
- #- gamechanger_delay=0
55
- #- http_root=/mlbserver
56
- ports:
57
- - 9999:9999
58
- - 10000:10000
59
- volumes:
60
- - /path/to/your/desired/local/mlbserver/persistent/data/directory:/mlbserver/data_directory
61
- ```
62
- Then launch it with ```docker-compose up --detach```
33
+ Update the required environment variables in the sample [docker-compose.yml](https://github.com/tonywagner/mlbserver/blob/master/docker-compose.yml) file, then launch it with ```docker-compose up --detach```
63
34
 
64
35
  ### docker-cli
65
- Update the environment variables in the command below and run it:
66
- ```
67
- docker run -d \
68
- --name mlbserver \
69
- --env TZ="America/New_York" \
70
- --env data_directory=/mlbserver/data_directory \
71
- --env account_username=your.account.email@example.com \
72
- --env account_password=youraccountpassword \
73
- -p 9999:9999 \
74
- -p 10000:10000 \
75
- --volume /path/to/your/desired/local/mlbserver/persistent/data/directory:/mlbserver/data_directory \
76
- tonywagner/mlbserver
77
- ```
78
- Subsequent runs can be launched with ```docker start mlbserver```
79
-
80
- Docker installs may require further configuration to get multiview streaming to work.
36
+ Update the environment variables in the sample [docker-cli](https://github.com/tonywagner/mlbserver/blob/master/docker-cli) command, then run the command. Subsequent runs can be launched with ```docker start mlbserver```
81
37
 
82
38
 
83
39
  ## Usage
@@ -93,7 +49,7 @@ Basic command line or Docker environment options:
93
49
  --logout or -l (logs out and clears session)
94
50
  --session or -s (clears session)
95
51
  --cache or -c (clears cache)
96
- --env or -e (use environment variables instead of command line arguments; necessary for Docker)
52
+ --env or -e (use environment variables instead of command line arguments; automatically applied in the Docker image)
97
53
  ```
98
54
 
99
55
  Advanced command line or Docker environment options:
@@ -102,8 +58,9 @@ Advanced command line or Docker environment options:
102
58
  --account_username (required, email address, default will use stored credentials or prompt user to enter them if not using Docker)
103
59
  --account_password (required, default will use stored credentials or prompt user to enter them if not using Docker)
104
60
  --fav_teams (optional, comma-separated list of favorite team abbreviations from https://github.com/tonywagner/mlbserver/blob/master/session.js#L23 -- will prompt if not set or stored and not using Docker)
61
+ --http_root (specify the alternative http webroot or initial path prefix, default is none)
105
62
  --free (optional, highlights free games)
106
- --multiview_port (port for multiview streaming; defaults to 1 more than primary port, or 10000)
63
+ --multiview_port (local port for multiview streaming; defaults to 1 more than primary port, or 10000; does not need to be mapped or used externally)
107
64
  --multiview_path (where to create the folder for multiview encoded files; defaults to app directory)
108
65
  --ffmpeg_path (path to ffmpeg binary to use for multiview encoding; default downloads a binary using ffmpeg-static)
109
66
  --ffmpeg_encoder (ffmpeg video encoder to use for multiview; default is the software encoder libx264)
@@ -112,9 +69,11 @@ Advanced command line or Docker environment options:
112
69
  --page_password (password to protect pages; default is no protection)
113
70
  --content_protect (specify the content protection key to include as a URL parameter, if page protection is enabled)
114
71
  --gamechanger_delay (specify extra delay for the gamechanger switches in 10 second increments, default is 0)
115
- --http_root (specify the alternative http webroot or initial path prefix, default is none)
72
+ --data_directory (defaults to installed application directory; in the Docker image, this defaults to /mlbserver/data_directory for mapping persistent storage)
116
73
  ```
117
74
 
75
+ Supports [SWAG](https://docs.linuxserver.io/general/swag/#preset-proxy-confs) using the custom [mlbserver.subfolder.conf](https://github.com/tonywagner/mlbserver/blob/master/mlbserver.subfolder.conf) file.
76
+
118
77
  For multiview, the default software encoder is limited by your CPU. You may want to experiment with different ffmpeg hardware encoders. "h264_videotoolbox" is confirmed to work on supported Macs, and "h264_v4l2m2m" is confirmed to work on a Raspberry Pi 4 (and likely other Linux systems) when ffmpeg is compiled with this patch: https://www.raspberrypi.org/forums/viewtopic.php?p=1780625#p1780625
119
78
 
120
79
  More potential hardware encoders are described at https://stackoverflow.com/a/50703794
package/docker-cli ADDED
@@ -0,0 +1,8 @@
1
+ docker run -d \
2
+ --name mlbserver \
3
+ --env TZ="America/New_York" \
4
+ --env account_username=your.account.email@example.com \
5
+ --env account_password=youraccountpassword \
6
+ -p 9999:9999 \
7
+ --volume /path/to/your/desired/local/mlbserver/persistent/data/directory:/mlbserver/data_directory \
8
+ tonywagner/mlbserver
@@ -4,13 +4,11 @@ services:
4
4
  container_name: mlbserver
5
5
  environment:
6
6
  - TZ=America/New York
7
- - data_directory=/mlbserver/data_directory
8
7
  - account_username=your.account.email@example.com
9
8
  - account_password=youraccountpassword
10
9
  #- fav_teams=AZ,BAL
10
+ #- http_root=/mlbserver
11
11
  #- debug=false
12
- #- port=9999
13
- #- multiview_port=10000
14
12
  #- multiview_path=
15
13
  #- ffmpeg_path=
16
14
  #- ffmpeg_encoder=
@@ -18,8 +16,9 @@ services:
18
16
  #- page_password=
19
17
  #- content_protect=
20
18
  #- gamechanger_delay=0
19
+ #- PUID=1000
20
+ #- PGID=1000
21
21
  ports:
22
22
  - 9999:9999
23
- - 10000:10000
24
23
  volumes:
25
24
  - /path/to/your/desired/local/mlbserver/persistent/data/directory:/mlbserver/data_directory
package/index.js CHANGED
@@ -106,7 +106,12 @@ var argv = minimist(process.argv, {
106
106
  string: ['account_username', 'account_password', 'fav_teams', 'multiview_path', 'ffmpeg_path', 'ffmpeg_encoder', 'page_username', 'page_password', 'content_protect', 'data_directory', 'http_root']
107
107
  })
108
108
 
109
- if (argv.env) argv = process.env
109
+ if (argv.env) {
110
+ process.env.port = argv.port
111
+ process.env.multiview_port = argv.multiview_port
112
+ process.env.data_directory = argv.data_directory
113
+ argv = process.env
114
+ }
110
115
 
111
116
  // Version
112
117
  var version = require('./package').version
@@ -2994,7 +2999,7 @@ app.get('/download.html', async function(req, res) {
2994
2999
  session.debuglog('force alternate audio', req)
2995
3000
  }
2996
3001
 
2997
- let server = (req.headers['x-forwarded-proto'] ? req.headers['x-forwarded-proto'] : 'http') + '://' + req.headers.host + http_root
3002
+ let server = 'http://127.0.0.1:' + session.data.port + http_root
2998
3003
 
2999
3004
  let video_url = '/stream.m3u8'
3000
3005
  if ( req.query.src ) {
@@ -3022,7 +3027,7 @@ app.get('/download.html', async function(req, res) {
3022
3027
  // Set input stream and minimize ffmpeg startup latency
3023
3028
  ffmpeg_command.input(video_url)
3024
3029
  .addInputOption('-fflags', 'nobuffer')
3025
- .addInputOption('-probesize', '32')
3030
+ .addInputOption('-probesize', '1000000')
3026
3031
  .addInputOption('-analyzeduration', '0')
3027
3032
 
3028
3033
  // video
@@ -0,0 +1,20 @@
1
+ ## Version 2025/02/27
2
+ # make sure that your mlbserver container is named mlbserver
3
+ # make sure that mlbserver is set to work with the base url /mlbserver/
4
+ #
5
+ # For the subfolder to work you need to edit your mlbserver docker compose / cli config
6
+ # and set the http_root environment variable to /mlbserver, e.g. in docker compose:
7
+ # - http_root=/mlbserver
8
+
9
+ location /mlbserver {
10
+ return 301 $scheme://$host/mlbserver/;
11
+ }
12
+
13
+ location /mlbserver/ {
14
+ include /config/nginx/proxy.conf;
15
+ include /config/nginx/resolver.conf;
16
+ set $upstream_app mlbserver;
17
+ set $upstream_port 9999;
18
+ set $upstream_proto http;
19
+ proxy_pass $upstream_proto://$upstream_app:$upstream_port;
20
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mlbserver",
3
- "version": "2025.02.25",
3
+ "version": "2025.02.27",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",