How to query the file path?

#4
by lixiqqq123 - opened

I want to know how to query the corresponding local file path based on the ID

import os
image_folder = "IMAGE_FOLDER"
for post in selected_posts:
  file_path = os.path.join(image_folder, str(post.id%1000), f"{post.id}.{post.file_ext}")

Something like this

or I suggest you to use HakuBooru directly
https://github.com/KohakuBlueleaf/HakuBooru

KBlueLeaf changed discussion status to closed

Sign up or log in to comment