From 85943861ea66ee5eaf40aa2c405892636b59ce71 Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Thu, 22 Aug 2024 20:21:27 +0200 Subject: fix(update): Propagate the logging options to the `update_raw.py` script --- python_update/raw_update.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'python_update') diff --git a/python_update/raw_update.py b/python_update/raw_update.py index 6f5b78d..c443960 100755 --- a/python_update/raw_update.py +++ b/python_update/raw_update.py @@ -50,7 +50,7 @@ class Video: logger = logging.getLogger("yt") -logging.basicConfig(encoding="utf-8", level=logging.DEBUG) +logging.basicConfig(encoding="utf-8", level=int(sys.argv[3])) _ytdl_logger = logging.getLogger("yt_dlp") _ytdl_logger.propagate = False @@ -107,6 +107,7 @@ class Fetcher: else: entries = info.get("entries", []) for entry in take(self.max_items, entries): + logger.debug(json.dumps(entry)) id = str.encode(yt_dlp.utils.unsmuggle_url(entry["id"])[0]) ehash = blake3(id).hexdigest() if ehash not in hashes: @@ -144,7 +145,7 @@ class Updater: self.hashes = None async def update_url(self, url: str): - print(f"Updating {url}...", file=sys.stderr) + logger.info(f"Updating {url}...") new_entries = await self.fetcher.get_unprocessed_entries(url, self.hashes) await asyncio.gather( @@ -163,8 +164,10 @@ def update(): max_backlog = int(sys.argv[1]) subscriptions_number = int(sys.argv[2]) u = Updater(max_backlog=max_backlog) - u.update(sys.argv[3:(3 + subscriptions_number)], sys.argv[(3 + subscriptions_number):]) + u.update( + sys.argv[4 : (4 + subscriptions_number)], sys.argv[(4 + subscriptions_number) :] + ) -print(sys.argv, file=sys.stderr) +logger.debug(sys.argv) update() -- cgit 1.4.1