aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorAlex Shnitman <alexta69@gmail.com>2021-11-13 20:07:14 +0200
committerAlex Shnitman <alexta69@gmail.com>2021-11-13 20:07:14 +0200
commit6b4819924b5ab6832c2fa7f4739843d4a25bb81f (patch)
treeeef7a93f41440f2fca20110ebc21804e0b0c5704 /app
parentrolled back recent upgrades (diff)
downloadmetube-6b4819924b5ab6832c2fa7f4739843d4a25bb81f.tar.gz
metube-6b4819924b5ab6832c2fa7f4739843d4a25bb81f.tar.bz2
metube-6b4819924b5ab6832c2fa7f4739843d4a25bb81f.zip
fix breakage after upgrade
Diffstat (limited to 'app')
-rw-r--r--app/ytdl.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/app/ytdl.py b/app/ytdl.py
index f9084e3..a14855d 100644
--- a/app/ytdl.py
+++ b/app/ytdl.py
@@ -97,7 +97,7 @@ class Download:
self.notifier = notifier
self.info.status = 'preparing'
await self.notifier.updated(self.info)
- asyncio.ensure_future(self.update_status())
+ asyncio.create_task(self.update_status())
return await self.loop.run_in_executor(None, self.proc.join)
def cancel(self):
@@ -141,8 +141,13 @@ class DownloadQueue:
self.notifier = notifier
self.queue = OrderedDict()
self.done = OrderedDict()
- self.event = asyncio.Event()
- asyncio.ensure_future(self.__download())
+ self.initialized = False
+
+ def __initialize(self):
+ if not self.initialized:
+ self.initialized = True
+ self.event = asyncio.Event()
+ asyncio.create_task(self.__download())
def __extract_info(self, url):
return yt_dlp.YoutubeDL(params={
@@ -177,6 +182,7 @@ class DownloadQueue:
async def add(self, url, quality, format, already=None):
log.info(f'adding {url}')
+ self.__initialize()
already = set() if already is None else already
if url in already:
log.info('recursion detected, skipping')
bgstack15