check that monitored tags are in added tags
This commit is contained in:
parent
501c9ca1ab
commit
49faf9f746
3
main.py
3
main.py
@ -140,6 +140,7 @@ async def check_updates():
|
||||
logging.warning('Lock acquired...')
|
||||
matched_posts = []
|
||||
tag_list = set(tuple(t.decode().split()) for t in await redis.smembers('e621:subs'))
|
||||
tag_list_flat = set(sum(tag_list, ()))
|
||||
last_post_version = int((await redis.get('e621:last_version') or b'0').decode())
|
||||
post_versions: List[E621PostVersion] = []
|
||||
logging.warning(f'Getting post versions from id {last_post_version}')
|
||||
@ -152,6 +153,8 @@ async def check_updates():
|
||||
for post_version in post_versions[::-1]:
|
||||
if post_version.id > last_post_version:
|
||||
last_post_version = post_version.id
|
||||
if not bool(tag_list_flat & set(post_version.added_tags)):
|
||||
continue
|
||||
post_tags = set(post_version.tags.split())
|
||||
for tag_group in tag_list:
|
||||
if set(tag_group) <= post_tags:
|
||||
|
Loading…
Reference in New Issue
Block a user