add research on multiple folder
This commit is contained in:
parent
1c46723cd3
commit
0b27b154b7
11
bot.py
11
bot.py
|
@ -30,7 +30,16 @@ mime_dict = {'.jpg': 'image/jpeg', '.jpe': 'image/jpeg', '.jpeg': 'image/jpeg',
|
|||
|
||||
def post_img_local(mastodon, text, log, config):
|
||||
img_path = get_parameter("img_path", config)
|
||||
file = random.choice(os.listdir(img_path+"/"))
|
||||
|
||||
continu = True;
|
||||
while continu:
|
||||
file = random.choice(os.listdir(img_path+"/"))
|
||||
if os.path.isdir(file):
|
||||
img_path = img_path+"/"+file
|
||||
else:
|
||||
continu = False
|
||||
|
||||
#file = random.choice(os.listdir(img_path+"/"))
|
||||
image_byte = open(img_path+"/"+file, "rb").read()
|
||||
|
||||
file, ext = os.path.splitext(file)
|
||||
|
|
Reference in New Issue