Log gelbooru urls.
This commit is contained in:
parent
96bb45f11b
commit
2eadecdaac
|
@ -39,7 +39,9 @@ class BotInstance:
|
|||
# Gelbooru tags to exclude
|
||||
gelbooru_tags_exclude = ""
|
||||
|
||||
def __init__(self, cfg_name, config):
|
||||
def __init__(self, cfg_name, config, log_file):
|
||||
self.log_file = log_file
|
||||
|
||||
self.cfg_name = cfg_name
|
||||
self.gelbooru_tags = config["gelbooru_tags"]
|
||||
self.gelbooru_tags_exclude = config["gelbooru_tags_exclude"]
|
||||
|
@ -61,6 +63,7 @@ class BotInstance:
|
|||
else:
|
||||
gelbooru_tags_exclude = ""
|
||||
gelbooru_json = requests.get(self.gelbooru_url + urllib.parse.quote_plus(self.gelbooru_tags + gelbooru_tags_exclude) + "&pid=" + str(page_number)).json()
|
||||
print ("Gelbooru Url: %s" % (self.gelbooru_url + urllib.parse.quote_plus(self.gelbooru_tags + gelbooru_tags_exclude) + "&pid=" + str(page_number)), file=self.log_file)
|
||||
max_pages = gelbooru_json['@attributes']['count'] // 100 + (1 if gelbooru_json['@attributes']['count'] % 100 != 0 else 0)
|
||||
if max_pages > 200:
|
||||
max_pages = 200
|
||||
|
@ -314,7 +317,7 @@ def main():
|
|||
continue
|
||||
|
||||
try:
|
||||
bot_instance = BotInstance(cfg_name, cfg_tmp)
|
||||
bot_instance = BotInstance(cfg_name, cfg_tmp, log_file)
|
||||
bot_instance.bot_process(log_file)
|
||||
# Save the saved image list to config.json
|
||||
config[cfg_name]["max_page_number"] = bot_instance.max_page_number
|
||||
|
|
Loading…
Reference in New Issue