diff options
author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-08-22 20:21:27 +0200 |
---|---|---|
committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-08-22 20:21:27 +0200 |
commit | 85943861ea66ee5eaf40aa2c405892636b59ce71 (patch) | |
tree | 765b376c7de957f1be59a1f07bdba2e62e3e54be /python_update | |
parent | fix(package): Actually provide the blake3 library to the python interpreter (diff) | |
download | yt-85943861ea66ee5eaf40aa2c405892636b59ce71.tar.gz yt-85943861ea66ee5eaf40aa2c405892636b59ce71.zip |
fix(update): Propagate the logging options to the `update_raw.py` script
Diffstat (limited to 'python_update')
-rwxr-xr-x | python_update/raw_update.py | 11 |
1 files changed, 7 insertions, 4 deletions
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() |