mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-15 13:43:04 +00:00
Compare commits
No commits in common. "69b59b4b4b52e496df980d8d21ad5ff670089c0b" and "96b49af01c63dbdf88c2711bb2fb6e83d7345b02" have entirely different histories.
69b59b4b4b
...
96b49af01c
@ -18,9 +18,6 @@ class FC2LiveFD(FileDownloader):
|
|||||||
heartbeat_state = [None, 1]
|
heartbeat_state = [None, 1]
|
||||||
|
|
||||||
def heartbeat():
|
def heartbeat():
|
||||||
if heartbeat_state[1] < 0:
|
|
||||||
return
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
heartbeat_state[1] += 1
|
heartbeat_state[1] += 1
|
||||||
ws.send('{"name":"heartbeat","arguments":{},"id":%d}' % heartbeat_state[1])
|
ws.send('{"name":"heartbeat","arguments":{},"id":%d}' % heartbeat_state[1])
|
||||||
@ -39,8 +36,4 @@ class FC2LiveFD(FileDownloader):
|
|||||||
'ws': None,
|
'ws': None,
|
||||||
'protocol': 'live_ffmpeg',
|
'protocol': 'live_ffmpeg',
|
||||||
})
|
})
|
||||||
try:
|
|
||||||
return FFmpegFD(self.ydl, self.params or {}).download(filename, new_info_dict)
|
return FFmpegFD(self.ydl, self.params or {}).download(filename, new_info_dict)
|
||||||
finally:
|
|
||||||
# stop heartbeating
|
|
||||||
heartbeat_state[1] = -1
|
|
||||||
|
@ -36,7 +36,6 @@ import tempfile
|
|||||||
import time
|
import time
|
||||||
import traceback
|
import traceback
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
import warnings
|
|
||||||
import xml.etree.ElementTree
|
import xml.etree.ElementTree
|
||||||
import zlib
|
import zlib
|
||||||
|
|
||||||
@ -5222,11 +5221,7 @@ class WebSocketsWrapper():
|
|||||||
pool = None
|
pool = None
|
||||||
|
|
||||||
def __init__(self, url, headers=None, connect=True):
|
def __init__(self, url, headers=None, connect=True):
|
||||||
self.loop = asyncio.new_event_loop()
|
self.loop = asyncio.events.new_event_loop()
|
||||||
with warnings.catch_warnings():
|
|
||||||
warnings.simplefilter("ignore")
|
|
||||||
# https://github.com/aaugustin/websockets/blob/9c87d43f1d7bbf6847350087aae74fd35f73a642/src/websockets/legacy/client.py#L480
|
|
||||||
# the reason to keep giving `loop` parameter: we aren't in async function
|
|
||||||
self.conn = websockets.connect(
|
self.conn = websockets.connect(
|
||||||
url, extra_headers=headers, ping_interval=None,
|
url, extra_headers=headers, ping_interval=None,
|
||||||
close_timeout=float('inf'), loop=self.loop, ping_timeout=float('inf'))
|
close_timeout=float('inf'), loop=self.loop, ping_timeout=float('inf'))
|
||||||
@ -5236,8 +5231,6 @@ class WebSocketsWrapper():
|
|||||||
|
|
||||||
def __enter__(self):
|
def __enter__(self):
|
||||||
if not self.pool:
|
if not self.pool:
|
||||||
with warnings.catch_warnings():
|
|
||||||
warnings.simplefilter("ignore")
|
|
||||||
self.pool = self.run_with_loop(self.conn.__aenter__(), self.loop)
|
self.pool = self.run_with_loop(self.conn.__aenter__(), self.loop)
|
||||||
return self
|
return self
|
||||||
|
|
||||||
@ -5258,7 +5251,7 @@ class WebSocketsWrapper():
|
|||||||
# for contributors: If there's any new library using asyncio needs to be run in non-async, move these function out of this class
|
# for contributors: If there's any new library using asyncio needs to be run in non-async, move these function out of this class
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def run_with_loop(main, loop):
|
def run_with_loop(main, loop):
|
||||||
if not asyncio.iscoroutine(main):
|
if not asyncio.coroutines.iscoroutine(main):
|
||||||
raise ValueError(f'a coroutine was expected, got {main!r}')
|
raise ValueError(f'a coroutine was expected, got {main!r}')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user