mirror of
https://github.com/ClaytonWWilson/Scraper-for-theTVDB.com.git
synced 2025-12-15 17:28:46 +00:00
Completed clearFolders()
This commit is contained in:
parent
c06567de74
commit
2fab5ae2bd
28
actions.py
28
actions.py
@ -13,20 +13,24 @@ def clearLogin():
|
||||
pass
|
||||
|
||||
def clearFolders():# TODO implement this
|
||||
if os.path.exists("banner"):
|
||||
print("cleared")
|
||||
folders = ["banner", "fanart", "poster"]
|
||||
for folder in folders:
|
||||
if os.path.exists(folder):
|
||||
imageList = os.listdir(folder)
|
||||
if len(imageList) != 0:
|
||||
for x in imageList: # TODO check if folder is empty
|
||||
print("Deleting " + x)
|
||||
delPath = os.path.join(folder + "\\" + x)
|
||||
os.remove(delPath)
|
||||
print(folder + " cleared\n")
|
||||
else:
|
||||
print("empty")
|
||||
print(folder + " is already empty")
|
||||
else:
|
||||
createFolder(folder)
|
||||
print("")
|
||||
|
||||
if os.path.exists("fanart"):
|
||||
print("cleared")
|
||||
else:
|
||||
print("empty")
|
||||
|
||||
if os.path.exists("poster"):
|
||||
print("cleared")
|
||||
else:
|
||||
print("empty")
|
||||
def createFolder(folder):
|
||||
os.makedirs(folder)
|
||||
|
||||
|
||||
def getImages(idNum, keyType, authHeaders):
|
||||
|
||||
@ -15,6 +15,7 @@ def user_choice():
|
||||
def wait():
|
||||
input("Press enter to continue.")
|
||||
|
||||
|
||||
while True:
|
||||
clear_screen()
|
||||
print("=============================\n"
|
||||
@ -35,6 +36,7 @@ while True:
|
||||
print("Search")
|
||||
break
|
||||
elif choice == "2":
|
||||
clear_screen()
|
||||
clearFolders()
|
||||
wait()
|
||||
elif choice == "3":
|
||||
|
||||
Loading…
Reference in New Issue
Block a user