Adding TODOs and tweaking a few lines

This commit is contained in:
ClaytonWWilson 2018-07-12 09:04:41 -04:00
parent e714ce4e3b
commit 841d567c78
3 changed files with 14 additions and 10 deletions

View File

@ -87,12 +87,12 @@ def clearFolders(): # TODO implement this
createFolder(folder)
print("")
def createFolder(folder):
def createFolder(folder): # TODO remove this
os.makedirs(folder)
def searchImages(idNum, keyType, authHeaders): # This is getting a list of file info for images in json format
queryUrl = "https://api.thetvdb.com/series/" + str(idNum) + "/images/query" + keyType
queryUrl = "https://api.thetvdb.com/series/" + str(idNum) + "/images/query" + keyType # TODO change this to string formatting
response = requests.get(queryUrl, headers=authHeaders)
if (checkStatus(response, True)):
return response
@ -128,7 +128,7 @@ def searchRemainder(imageType, saveNameList, idNum):#Finds any images missing fr
tryMissing(missingList, minNum, maxNum, idNum, imageType)
def findMissing(numbers): # TODO test this
def findMissing(numbers):
start, end = numbers[0], numbers[-1]
return sorted(set(range(start, end + 1)).difference(numbers))
@ -148,7 +148,7 @@ def tryMissing(missingNums, minNum, maxNum, idNum, imageType):
response = requests.get(dlUrl)
# print(response.status_code)
if (checkStatus(response, True) == True): # TODO there is an error occurring here when checking fanart
path = os.path.join(imageType + "\\" + str(idNum) + "-" + str(num) + ".jpg")
path = os.path.join(imageType + "\\" + str(idNum) + "-" + str(num) + ".jpg") # TODO string formatting
obj = open(path, "wb")
obj.write(response.content)
obj.close()

View File

@ -9,6 +9,8 @@ from actions import refreshToken
from actions import update
from search import search
# TODO fix naming convention for all variables and functions
def user_choice():
return input("> ").lower().strip()
@ -36,17 +38,17 @@ while True:
clearFolders()
wait()
elif choice == "3": # TODO if already logged in, ask 'are you sure?'
clear_screen()
clear_screen() # TODO wait to clear login and add a ctrl+c option to cancel
clearLogin()
login()
wait()
elif choice == "4":
elif choice == "4": # TODO need to perform this option automatically
clear_screen()
refreshToken()
wait()
elif choice == "5":
print("install requirements")
break
print("install requirements not implemented yet")
wait()
elif choice == "6":
update()
wait()

View File

@ -9,6 +9,7 @@ import dateutil
from actions import clearFolders
from actions import clear_screen
from actions import downloadImages
from actions import refreshToken
from actions import searchImages
from checks import checkTimestamp
from checks import checkStatus
@ -26,8 +27,9 @@ def search():
saveTime = dateutil.parser.parse(login["TIMESTAMP"])
curTime = datetime.datetime.now().replace(tzinfo=None) # TODO use UTC time?
if checkTimestamp(saveTime, curTime) == False:
print("Your token has expired. Get a new one by choosing Refresh Token.")
return None
# print("Your token has expired. Get a new one by choosing Refresh Token.")
# return None
refreshToken()
except Exception as ex:
print(ex)
print("There was an error checking your login. Try logging in again with 'Login/Change login'.")