change log counts
This commit is contained in:
parent
2d1fb6f9b0
commit
3d5b96c794
6
main.py
6
main.py
@ -116,7 +116,7 @@ async def send_post(post: E621Post, tag_list: Iterable[Iterable[str]]):
|
|||||||
ratio = 2000 / larger_dimension
|
ratio = 2000 / larger_dimension
|
||||||
dl_im = dl_im.resize((int(size[0] * ratio), int(size[1] * ratio)),
|
dl_im = dl_im.resize((int(size[0] * ratio), int(size[1] * ratio)),
|
||||||
Image.LANCZOS)
|
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))
|
im = Image.new('RGBA', dl_im.size, (255, 255, 255))
|
||||||
composite = Image.alpha_composite(im, dl_im).convert('RGB')
|
composite = Image.alpha_composite(im, dl_im).convert('RGB')
|
||||||
file = BytesIO()
|
file = BytesIO()
|
||||||
@ -157,14 +157,14 @@ async def check_updates():
|
|||||||
break
|
break
|
||||||
matched_posts.sort()
|
matched_posts.sort()
|
||||||
if matched_posts:
|
if matched_posts:
|
||||||
logging.warning(f'Found {len(matched_posts)} posts')
|
|
||||||
already_sent: List = await redis.smismember('e621:sent', matched_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]
|
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):
|
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]
|
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))
|
posts = await e621.get_posts('order:id id:' + ','.join(f'{post_id}' for post_id in chunk))
|
||||||
for i, post in enumerate(posts):
|
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 send_post(post, tag_list)
|
||||||
await redis.sadd('e621:sent', post.id)
|
await redis.sadd('e621:sent', post.id)
|
||||||
await sleep(1)
|
await sleep(1)
|
||||||
|
Loading…
Reference in New Issue
Block a user