1
0
mirror of https://github.com/spaam/svtplay-dl.git synced 2024-11-24 04:05:39 +01:00

fetcher: support for formats

This commit is contained in:
Johan Andersson 2020-06-25 20:55:48 +02:00
parent 916e19996c
commit 566738b8f1

View File

@ -7,10 +7,10 @@ from svtplay_dl.utils.output import progressbar
class VideoRetriever: class VideoRetriever:
def __init__(self, config, url, bitrate=0, **kwargs): def __init__(self, config, url, bitrate, output, **kwargs):
self.config = config self.config = config
self.url = url self.url = url
self.bitrate = int(bitrate) self.bitrate = int(bitrate) if bitrate else 0
self.kwargs = kwargs self.kwargs = kwargs
self.http = HTTP(config) self.http = HTTP(config)
self.finished = False self.finished = False
@ -18,12 +18,15 @@ class VideoRetriever:
self.files = kwargs.pop("files", None) self.files = kwargs.pop("files", None)
self.keycookie = kwargs.pop("keycookie", None) self.keycookie = kwargs.pop("keycookie", None)
self.authorization = kwargs.pop("authorization", None) self.authorization = kwargs.pop("authorization", None)
self.output = kwargs.pop("output", None) self.output = output
self.segments = kwargs.pop("segments", None) self.segments = kwargs.pop("segments", None)
self.output_extention = None self.output_extention = None
channels = kwargs.pop("channels", None)
codec = kwargs.pop("codec", "h264")
self.format = "{}-{}".format(codec, channels) if channels else codec
def __repr__(self): def __repr__(self):
return "<Video(fetcher={}, bitrate={}>".format(self.__class__.__name__, self.bitrate) return "<Video(fetcher={}, bitrate={} format={}>".format(self.__class__.__name__, self.bitrate, self.format)
@property @property
def name(self): def name(self):