File size: 829 Bytes
f4d52c1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import os

driver_path = "driver"
folder_path = "Images"
driverPath = os.path.join(os.getcwd(), driver_path)
imagePath = os.path.join(os.getcwd(), folder_path)

try:
    if len(os.listdir(driverPath)) > 1:
        raise Exception("Put 1 driver only")
    elif os.listdir(driverPath)[0] != "driver.exe":
        os.rename(driverPath+"/"+"driver.exe")
except:
    pass
finally:
    executable_path = os.path.join(driverPath, 'driver.exe')


def imgList(mode=0):
    if mode==0: # Danbooru
        return [image.split(" ")[-1].split(".")[0] for image in os.listdir(imagePath) if image.split(".")[-1] in ["jpg","png","jpeg"]]
    if mode==1: # Pixiv
        return [image.split("_")[0] for image in os.listdir(imagePath) if image.split(".")[-1] in ["jpg","png","jpeg"]]
    if mode==2: # Zerochan
        return os.listdir(imagePath)