Skip to content

plugins.twitch: implement disable-ads parameter #2372

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 3 commits into from
Mar 29, 2019
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
Prev Previous commit
Next Next commit
stream.hls: refactor HLSStream{,Worker}
- Enable setting custom arguments when reloading the playlist.
- Instantiate own class in HLSStream.parse_variant_playlist.
  • Loading branch information
bastimeyer committed Mar 23, 2019
commit 8f93831b77da08bb6b5d5ef8b23a91346c937e06
13 changes: 10 additions & 3 deletions src/streamlink/stream/hls.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,9 @@ def __init__(self, *args, **kwargs):
self.duration_offset_start, self.duration_limit,
self.playlist_sequence, self.playlist_end)

def _reload_playlist(self, text, url):
return hls_playlist.load(text, url)

def reload_playlist(self):
if self.closed:
return
Expand All @@ -192,7 +195,7 @@ def reload_playlist(self):
retries=self.playlist_reload_retries,
**self.reader.request_params)
try:
playlist = hls_playlist.load(res.text, res.url)
playlist = self._reload_playlist(res.text, res.url)
except ValueError as err:
raise StreamError(err)

Expand Down Expand Up @@ -472,8 +475,12 @@ def parse_variant_playlist(cls, session_, url, name_key="name",
duration=duration,
**request_params)
else:
stream = HLSStream(session_, playlist.uri, force_restart=force_restart,
start_offset=start_offset, duration=duration, **request_params)
stream = cls(session_,
playlist.uri,
force_restart=force_restart,
start_offset=start_offset,
duration=duration,
**request_params)
streams[name_prefix + stream_name] = stream

return streams