Fixing imports. Adding requirements.txt

This commit is contained in:
ClaytonWWilson 2018-07-17 08:40:42 -04:00
parent 954c90b63c
commit 80a863c8f9
5 changed files with 28 additions and 8 deletions

View File

@ -187,6 +187,25 @@ def download(imageType, parsed_respObj):
quit() quit()
return saveNameList return saveNameList
def installReqs():
if is_pip_installed == True:
# open Requirements.txt
# subprocess.call(["pip", "install", module], stdout=subprocess.DEVNULL,
# stdin =subprocess.DEVNULL,
# stderr=subprocess.DEVNULL)
else:
print("You need to install pip.")
def is_pip_installed():
try:
subprocess.call(["pip", "--version"], stdout=subprocess.DEVNULL,
stdin =subprocess.DEVNULL,
stderr=subprocess.DEVNULL)
except FileNotFoundError:
return False
else:
return True
# The following code is from Red-DiscordBot # The following code is from Red-DiscordBot
# https://github.com/Cog-Creators/Red-DiscordBot # https://github.com/Cog-Creators/Red-DiscordBot
def is_git_installed(): def is_git_installed():

View File

@ -1,4 +1,5 @@
import json import json
import requests import requests
import datetime import datetime

View File

@ -4,15 +4,13 @@ from login import login
from actions import wait from actions import wait
from actions import clear_screen from actions import clear_screen
from actions import clearFolders from actions import clearFolders
from actions import installReqs
from actions import refreshToken from actions import refreshToken
from actions import update from actions import update
from search import search from search import search
# TODO fix naming convention for all variables and functions # TODO fix naming convention for all variables and functions
def user_choice():
return input("> ").lower().strip()
while True: while True:
clear_screen() clear_screen()
print("=============================\n" print("=============================\n"
@ -22,12 +20,11 @@ while True:
print("1. Search theTVDB.com") print("1. Search theTVDB.com")
print("2. Clear download folders") print("2. Clear download folders")
print("3. Login/Change login") print("3. Login/Change login")
# print("4. Refresh API Token")
print("4. Install Requirements") print("4. Install Requirements")
print("5. Check for updates\n") print("5. Check for updates\n")
print("0. Exit\n") print("0. Exit\n")
choice = user_choice() choice = input("> ").lower().strip()
if choice == "1": if choice == "1":
search() search()
@ -36,12 +33,12 @@ while True:
clear_screen() clear_screen()
clearFolders() clearFolders()
wait() wait()
elif choice == "3": # TODO if already logged in, ask 'are you sure?' elif choice == "3": # TODO add a printout that tells the user who is currently logged in
clear_screen() clear_screen()
login() login()
wait() wait()
elif choice == "4": elif choice == "4":
print("install requirements not implemented yet") installReqs()
wait() wait()
elif choice == "5": elif choice == "5":
update() update()

3
requirements.txt Normal file
View File

@ -0,0 +1,3 @@
python-dateutil==2.6.1
requests==2.18.4
urllib3==1.22

View File

@ -2,9 +2,9 @@ import os.path
import json import json
import datetime import datetime
import dateutil
import requests import requests
import urllib.parse import urllib.parse
import dateutil
from actions import clearFolders from actions import clearFolders
from actions import clear_screen from actions import clear_screen