From 3d5b96c794067aec8a2d92c6827824ffaa038064 Mon Sep 17 00:00:00 2001 From: bakatrouble Date: Sun, 25 Feb 2024 11:51:19 +0300 Subject: [PATCH] change log counts --- main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index 8daeade..7481abb 100644 --- a/main.py +++ b/main.py @@ -116,7 +116,7 @@ async def send_post(post: E621Post, tag_list: Iterable[Iterable[str]]): ratio = 2000 / larger_dimension dl_im = dl_im.resize((int(size[0] * ratio), int(size[1] * ratio)), Image.LANCZOS) - print(f'Resizing from {size[0]}x{size[1]} to {dl_im.size[0]}x{dl_im.size[1]}') + logging.warning(f'Resizing from {size[0]}x{size[1]} to {dl_im.size[0]}x{dl_im.size[1]}') im = Image.new('RGBA', dl_im.size, (255, 255, 255)) composite = Image.alpha_composite(im, dl_im).convert('RGB') file = BytesIO() @@ -157,14 +157,14 @@ async def check_updates(): break matched_posts.sort() if matched_posts: - logging.warning(f'Found {len(matched_posts)} posts') already_sent: List = await redis.smismember('e621:sent', matched_posts) posts_to_send = [post_id for post_id, sent in zip(matched_posts, already_sent) if not sent] + logging.warning(f'Found {len(posts_to_send)} posts') for post_chunk_idx in range(0, len(posts_to_send), PAGE_SIZE): chunk = posts_to_send[post_chunk_idx: post_chunk_idx + PAGE_SIZE] posts = await e621.get_posts('order:id id:' + ','.join(f'{post_id}' for post_id in chunk)) for i, post in enumerate(posts): - logging.warning(f'Sending post {post_chunk_idx + i + 1}/{len(matched_posts)}') + logging.warning(f'Sending post {post_chunk_idx + i + 1}/{len(posts_to_send)}') await send_post(post, tag_list) await redis.sadd('e621:sent', post.id) await sleep(1)