about summary refs log tree commit diff stats
path: root/python_update
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xpython_update/raw_update.py11
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()