mirror of
https://github.com/streamlink/streamlink
synced 2024-07-14 18:21:36 +02:00
Putting some organizational logic into the Plugin base class to automatically choose a 'best' quality
This commit is contained in:
parent
9b9fcb92fe
commit
28d0110d44
@ -23,6 +23,16 @@ class Plugin(object):
|
||||
self.args = args
|
||||
|
||||
def get_streams(self):
|
||||
ranking = ['iphonelow', 'iphonehigh', '240p', '360p', '480p', '720p',
|
||||
'hd', '1080p', 'live']
|
||||
streams = self._get_streams()
|
||||
for rank in reversed(ranking):
|
||||
if rank in streams:
|
||||
streams['best'] = streams[rank]
|
||||
break
|
||||
return streams
|
||||
|
||||
def _get_streams(self):
|
||||
raise NotImplementedError
|
||||
|
||||
def load_plugins(plugins):
|
||||
|
@ -69,7 +69,7 @@ class JustinTV(Plugin):
|
||||
res.append(node.data)
|
||||
return "".join(res)
|
||||
|
||||
def get_streams(self):
|
||||
def _get_streams(self):
|
||||
def clean_tag(tag):
|
||||
if tag[0] == "_":
|
||||
return tag[1:]
|
||||
|
@ -46,7 +46,7 @@ class OwnedTV(Plugin):
|
||||
if match:
|
||||
return int(match.group(1))
|
||||
|
||||
def get_streams(self):
|
||||
def _get_streams(self):
|
||||
channelid = self._get_channel_id(self.url)
|
||||
|
||||
if not channelid:
|
||||
|
@ -23,7 +23,7 @@ class UStreamTV(Plugin):
|
||||
if match:
|
||||
return int(match.group(1))
|
||||
|
||||
def get_streams(self):
|
||||
def _get_streams(self):
|
||||
def get_amf_value(data, key):
|
||||
pattern = ("{0}\W\W\W(.+?)\x00").format(key)
|
||||
match = re.search(bytes(pattern, "ascii"), data)
|
||||
|
Loading…
Reference in New Issue
Block a user