mirror of
https://github.com/streamlink/streamlink
synced 2024-08-19 12:15:04 +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
|
self.args = args
|
||||||
|
|
||||||
def get_streams(self):
|
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
|
raise NotImplementedError
|
||||||
|
|
||||||
def load_plugins(plugins):
|
def load_plugins(plugins):
|
||||||
|
@ -69,7 +69,7 @@ class JustinTV(Plugin):
|
|||||||
res.append(node.data)
|
res.append(node.data)
|
||||||
return "".join(res)
|
return "".join(res)
|
||||||
|
|
||||||
def get_streams(self):
|
def _get_streams(self):
|
||||||
def clean_tag(tag):
|
def clean_tag(tag):
|
||||||
if tag[0] == "_":
|
if tag[0] == "_":
|
||||||
return tag[1:]
|
return tag[1:]
|
||||||
|
@ -46,7 +46,7 @@ class OwnedTV(Plugin):
|
|||||||
if match:
|
if match:
|
||||||
return int(match.group(1))
|
return int(match.group(1))
|
||||||
|
|
||||||
def get_streams(self):
|
def _get_streams(self):
|
||||||
channelid = self._get_channel_id(self.url)
|
channelid = self._get_channel_id(self.url)
|
||||||
|
|
||||||
if not channelid:
|
if not channelid:
|
||||||
|
@ -23,7 +23,7 @@ class UStreamTV(Plugin):
|
|||||||
if match:
|
if match:
|
||||||
return int(match.group(1))
|
return int(match.group(1))
|
||||||
|
|
||||||
def get_streams(self):
|
def _get_streams(self):
|
||||||
def get_amf_value(data, key):
|
def get_amf_value(data, key):
|
||||||
pattern = ("{0}\W\W\W(.+?)\x00").format(key)
|
pattern = ("{0}\W\W\W(.+?)\x00").format(key)
|
||||||
match = re.search(bytes(pattern, "ascii"), data)
|
match = re.search(bytes(pattern, "ascii"), data)
|
||||||
|
Loading…
Reference in New Issue
Block a user