2018-03-13 00:33:39 +01:00
|
|
|
from svtplay_dl.utils.http import HTTP
|
2015-08-30 00:06:20 +02:00
|
|
|
|
2018-01-30 20:11:37 +01:00
|
|
|
|
2019-08-25 00:33:51 +02:00
|
|
|
class VideoRetriever:
|
2020-06-25 20:55:48 +02:00
|
|
|
def __init__(self, config, url, bitrate, output, **kwargs):
|
2018-05-08 22:46:11 +02:00
|
|
|
self.config = config
|
2014-04-21 16:50:24 +02:00
|
|
|
self.url = url
|
2020-06-25 20:55:48 +02:00
|
|
|
self.bitrate = int(bitrate) if bitrate else 0
|
2014-05-01 17:13:46 +02:00
|
|
|
self.kwargs = kwargs
|
2018-05-08 22:46:11 +02:00
|
|
|
self.http = HTTP(config)
|
2016-03-22 22:28:41 +01:00
|
|
|
self.finished = False
|
2016-03-26 21:38:31 +01:00
|
|
|
self.audio = kwargs.pop("audio", None)
|
2016-09-26 00:42:42 +02:00
|
|
|
self.files = kwargs.pop("files", None)
|
2018-01-04 00:45:52 +01:00
|
|
|
self.keycookie = kwargs.pop("keycookie", None)
|
2018-02-12 00:08:09 +01:00
|
|
|
self.authorization = kwargs.pop("authorization", None)
|
2020-06-25 20:55:48 +02:00
|
|
|
self.output = output
|
2018-05-13 13:06:45 +02:00
|
|
|
self.segments = kwargs.pop("segments", None)
|
2018-05-13 01:45:23 +02:00
|
|
|
self.output_extention = None
|
2020-06-25 20:55:48 +02:00
|
|
|
channels = kwargs.pop("channels", None)
|
|
|
|
codec = kwargs.pop("codec", "h264")
|
2021-04-18 14:06:25 +02:00
|
|
|
self.resolution = kwargs.pop("resolution", "")
|
2021-05-16 02:22:37 +02:00
|
|
|
self.language = kwargs.pop("language", "")
|
|
|
|
self.audio_role = kwargs.pop("role", "main")
|
2021-02-28 22:05:15 +01:00
|
|
|
self.format = f"{codec}-{channels}" if channels else codec
|
2014-05-01 17:13:46 +02:00
|
|
|
|
2016-01-03 02:43:16 +01:00
|
|
|
def __repr__(self):
|
2022-06-03 05:59:52 +02:00
|
|
|
return f"<Video(fetcher={self.__class__.__name__}, bitrate={self.bitrate} format={self.format}, language={self.language}, audio_role={self.audio_role}, resolution={self.resolution}>"
|
2016-01-03 02:43:16 +01:00
|
|
|
|
2018-05-25 22:47:26 +02:00
|
|
|
@property
|
2014-05-01 17:13:46 +02:00
|
|
|
def name(self):
|
2014-07-24 20:19:22 +02:00
|
|
|
pass
|