Skip to content

Update Stream string representation and refactor to_url + JSON data #4521

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
May 13, 2022

Conversation

bastimeyer
Copy link
Member

Closes #4518

Not a perfect solution, but this should improve the Stream string representations a bit, as it now always includes the class name and shortname.

This PR also fixes a couple of bugs:

  1. One of the bugs was related to the JSON data of DASHStreams, which could raise errors if the URL was missing.
  2. Another bug was empty passthrough URLs not being handled correctly and it would start the player with an empty input argument.
  3. There were also some more bugs related to missing HTTP session headers and query params in the JSON data and URL return values. This is now resolved and tested appropriately.

The first commit was needed in order to clean up some of the to_url logic in HTTPStream, HLSStream and DASHStream.

- Move stream.http.valid_args to HTTPSession.valid_request_args
- Add HTTPSession.prepare_new_request
- Update HTTPStream
  - Use newly added HTTPSession methods
- Fix HLSStream
  - Prepare master URL appropriately
- Fix DASHStream
  - Return correct JSON data, depending whether manifest URL exists
  - Filter custom args in DASHStream.parse_manifest
- Use HTTPSession.prepare_new_request in plugins.twitch.UsherService
- Rewrite Stream JSON tests and move test module
- Change format of Stream string representations and error messages
  of `to_url` and `to_manifest_url`
- Don't override `__repr__` in `Stream` subclasses
- Raise TypeError if url or manifest URL is None
- Fix CLI
  - Abort passthrough if stream can't be translated to URL
  - Remove unneeded streamlink_cli.utils.stream module
- Rewrite stream URL tests
- Move FilmOnHLS stream URL tests to plugin test module (and rewrite)
@bastimeyer bastimeyer force-pushed the stream/string-representation branch from 9791623 to 51bd393 Compare May 10, 2022 07:15
@back-to back-to merged commit ecb21f9 into streamlink:master May 13, 2022
@bastimeyer bastimeyer deleted the stream/string-representation branch May 13, 2022 19:09
Billy2011 added a commit to Billy2011/streamlink-27 that referenced this pull request May 14, 2022
…4521)

plugin.api.http_session: add prepare_new_request
- Move stream.http.valid_args to HTTPSession.valid_request_args
- Add HTTPSession.prepare_new_request
- Update HTTPStream
  - Use newly added HTTPSession methods
- Fix HLSStream
  - Prepare master URL appropriately
- Fix DASHStream
  - Return correct JSON data, depending whether manifest URL exists
  - Filter custom args in DASHStream.parse_manifest
- Use HTTPSession.prepare_new_request in plugins.twitch.UsherService
- Rewrite Stream JSON tests and move test module
Billy2011 added a commit to Billy2011/streamlink-27 that referenced this pull request May 14, 2022
…#4521)

- Change format of Stream string representations and error messages
  of `to_url` and `to_manifest_url`
- Don't override `__repr__` in `Stream` subclasses
- Raise TypeError if url or manifest URL is None
- Fix CLI
  - Abort passthrough if stream can't be translated to URL
  - Remove unneeded streamlink_cli.utils.stream module
- Rewrite stream URL tests
- Move FilmOnHLS stream URL tests to plugin test module (and rewrite)
Billy2011 added a commit to Billy2011/streamlink-27 that referenced this pull request May 14, 2022
…4521)

plugin.api.http_session: add prepare_new_request
- Move stream.http.valid_args to HTTPSession.valid_request_args
- Add HTTPSession.prepare_new_request
- Update HTTPStream
  - Use newly added HTTPSession methods
- Fix HLSStream
  - Prepare master URL appropriately
- Fix DASHStream
  - Return correct JSON data, depending whether manifest URL exists
  - Filter custom args in DASHStream.parse_manifest
- Use HTTPSession.prepare_new_request in plugins.twitch.UsherService
- Rewrite Stream JSON tests and move test module
Billy2011 added a commit to Billy2011/streamlink-27 that referenced this pull request May 14, 2022
…#4521)

- Change format of Stream string representations and error messages
  of `to_url` and `to_manifest_url`
- Don't override `__repr__` in `Stream` subclasses
- Raise TypeError if url or manifest URL is None
- Fix CLI
  - Abort passthrough if stream can't be translated to URL
  - Remove unneeded streamlink_cli.utils.stream module
- Rewrite stream URL tests
- Move FilmOnHLS stream URL tests to plugin test module (and rewrite)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Stream string representations should be improved
2 participants