Skip to content

cli.main: use *_args, **_kwargs for create_http_server #3450

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 26, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
cli.main: use '127.0.0.1' for --player-http / --player-continuous-http
closes #2622

use `127.0.0.1` for local `create_http_server()`
use `0.0.0.0` for external `create_http_server()`

`--player-http` = ***127.0.0.1***
https://streamlink.github.io/cli.html#cmdoption-player-http

`--player-continuous-http` = ***127.0.0.1***
https://streamlink.github.io/cli.html#cmdoption-player-continuous-http

`--player-external-http` = ***None*** / ***0.0.0.0***
https://streamlink.github.io/cli.html#cmdoption-player-external-http

---

we use `AF_INET` which is IPv4

https://github.com/streamlink/streamlink/blob/2.0.0/src/streamlink_cli/utils/http_server.py#L24

we don't use `AF_INET6` which is IPv6, so IPv6 support is unimportant.

Ref #2622 (comment)

---

```
$ streamlink https://www.youtube.com/channel/UCSrZ3UV4jOidv8ppoVuvW9Q/live --player-http -l debug
...
[cli][info] Starting player: /usr/bin/mpv
[cli.output][debug] Opening subprocess: /usr/bin/mpv "--force-media-title=Euronews English Live" http://127.0.0.1:35085/
```

```
$ streamlink https://www.youtube.com/channel/UCSrZ3UV4jOidv8ppoVuvW9Q/live --player-continuous-http -l debug
...
[cli][info] Starting player: /usr/bin/mpv
[cli.output][debug] Opening subprocess: /usr/bin/mpv "--force-media-title=Euronews English Live" http://127.0.0.1:39099/
[cli][info] Got HTTP request from libmpv
```

```
$ streamlink https://www.youtube.com/channel/UCSrZ3UV4jOidv8ppoVuvW9Q/live --player-external-http --player-external-http-port 33333
[cli][info] Starting server, access with one of:
[cli][info]  http://127.0.0.1:33333/
[cli][info]  http://127.0.0.53:33333/
[cli][info]  http://127.0.1.1:33333/
[cli][info] Got HTTP request from Mozilla/5.0 ...
[cli][info] Opening stream: 720p (hls)
```
  • Loading branch information
back-to committed Dec 26, 2020
commit 6b3cdd9dea08125c04645e3e66ac98ae073dae02
4 changes: 2 additions & 2 deletions src/streamlink_cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def create_output(plugin):
except OSError as err:
console.exit("Failed to create pipe: {0}", err)
elif args.player_http:
http = create_http_server()
http = create_http_server("127.0.0.1")

title = create_title(plugin)

Expand Down Expand Up @@ -178,7 +178,7 @@ def output_stream_http(plugin, initial_streams, external=False, port=0):
"executable with --player.")

title = create_title(plugin)
server = create_http_server()
server = create_http_server(host="127.0.0.1")
player = output = PlayerOutput(args.player, args=args.player_args,
filename=server.url,
quiet=not args.verbose_player,
Expand Down