From 3ca1c981d2c8d9d5fa5afe08712de4b3cf520b8c Mon Sep 17 00:00:00 2001 From: ArabCoders Date: Mon, 4 Mar 2024 16:12:51 +0300 Subject: [PATCH] Do not log the entire extract_info data while in debug mode. --- app/DownloadQueue.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/DownloadQueue.py b/app/DownloadQueue.py index e38c0cff..7701efed 100644 --- a/app/DownloadQueue.py +++ b/app/DownloadQueue.py @@ -257,7 +257,7 @@ class DownloadQueue: if self.isDownloaded(entry): raise yt_dlp.utils.ExistingVideoReached() - LOG.debug(f'entry: extract info says: {entry}') + LOG.debug(f'extract_info length: {len(entry)}') except yt_dlp.utils.ExistingVideoReached: return {'status': 'error', 'msg': 'Video has been downloaded already and recorded in archive.log file.'} except yt_dlp.utils.YoutubeDLError as exc: @@ -345,13 +345,13 @@ class DownloadQueue: break if time.time() - lastLog > 120: lastLog = time.time() - LOG.info(f'Waiting for workers to be free.') + LOG.info(f'Waiting for worker to be free.') await asyncio.sleep(1) LOG.debug(f"Has '{executor.get_available_workers()}' free workers.") while not self.queue.hasDownloads(): - LOG.info(f'Waiting for item to download.') + LOG.info('Waiting for item to download.') await self.event.wait() self.event.clear() LOG.debug(f"Cleared wait event.") @@ -359,6 +359,9 @@ class DownloadQueue: entry = self.queue.getNextDownload() await asyncio.sleep(0.2) + if entry is None: + continue + LOG.debug(f"Pushing {entry=} to executor.") if entry.started() is False and entry.is_canceled() is False: @@ -404,5 +407,7 @@ class DownloadQueue: self.done.put(value=entry) await self.notifier.completed(entry.info) + self.event.set() + def isDownloaded(self, info: dict) -> bool: return self.config.keep_archive and isDownloaded(self.config.ytdl_options.get('download_archive', None), info)