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
30
actions.py
30
actions.py
@ -13,20 +13,24 @@ def clearLogin():
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def clearFolders():# TODO implement this
|
def clearFolders():# TODO implement this
|
||||||
if os.path.exists("banner"):
|
folders = ["banner", "fanart", "poster"]
|
||||||
print("cleared")
|
for folder in folders:
|
||||||
else:
|
if os.path.exists(folder):
|
||||||
print("empty")
|
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(folder + " is already empty")
|
||||||
|
else:
|
||||||
|
createFolder(folder)
|
||||||
|
print("")
|
||||||
|
|
||||||
if os.path.exists("fanart"):
|
def createFolder(folder):
|
||||||
print("cleared")
|
os.makedirs(folder)
|
||||||
else:
|
|
||||||
print("empty")
|
|
||||||
|
|
||||||
if os.path.exists("poster"):
|
|
||||||
print("cleared")
|
|
||||||
else:
|
|
||||||
print("empty")
|
|
||||||
|
|
||||||
|
|
||||||
def getImages(idNum, keyType, authHeaders):
|
def getImages(idNum, keyType, authHeaders):
|
||||||
|
|||||||
@ -15,6 +15,7 @@ def user_choice():
|
|||||||
def wait():
|
def wait():
|
||||||
input("Press enter to continue.")
|
input("Press enter to continue.")
|
||||||
|
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
clear_screen()
|
clear_screen()
|
||||||
print("=============================\n"
|
print("=============================\n"
|
||||||
@ -35,6 +36,7 @@ while True:
|
|||||||
print("Search")
|
print("Search")
|
||||||
break
|
break
|
||||||
elif choice == "2":
|
elif choice == "2":
|
||||||
|
clear_screen()
|
||||||
clearFolders()
|
clearFolders()
|
||||||
wait()
|
wait()
|
||||||
elif choice == "3":
|
elif choice == "3":
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user