-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathDatabase.py
33 lines (25 loc) · 895 Bytes
/
Database.py
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
26
27
28
29
30
31
32
33
import os
def init(rootdir = "Database"):
root_path = rootdir
files_name = getFileName(root_path)
files_path = getFilePath(root_path, files_name)
images_path = getImagePath(files_path)
return (files_name, files_path, images_path)
def getFileName( path):
file_name = os.listdir(path)
return file_name
def getFilePath( path, file_name):
file_path = []
for file in file_name:
dir_path = os.path.join(path, file)
if os.path.isdir(dir_path):
file_path.append(dir_path)
return file_path
def getImagePath( dir_path):
images_path = []
for path in dir_path:
images = os.listdir(path)
if(len(images) >= 1):
temp = images[0]
images_path.append(os.path.join(path, images[0]))
return images_path