from storage import sql_base
from storage.sql_base import SQL
import os as os
#from chatterbot import ChatBot
dir_path = os.path.dirname(os.path.realpath(__file__))
dir_path = dir_path.replace("setup", "")
import platform
import bot_response as br
#Install required modules using pip
import pip
import subprocess
def install(package):
	#os.system("pip install -r "+str(package))
	if(float(pip.__version__) >= 10):
		subprocess.check_call(["python", "-m", "pip", "install", package])
	else:
		pip.main(['install', package])
if(platform.system() == "Windows"):
	file = open(dir_path+"/TO_INSTALL_WINDOWS.txt", "r")
	for line in file.readlines():
		install(line)
else:
	file = open(dir_path+"/TO_INSTALL_LINUX.txt", "r")
	for line in file.readlines():
		install(line)
movie_lines = dir_path+"/corpus/movie_lines.txt"
movie_convos = dir_path+"/corpus/movie_conversations.txt"
import sys
from tempfile import mkstemp
from shutil import move
from os import fdopen, remove
from rif import writer as w
import requests as r
import urllib.request, urllib.error, urllib.parse
import json
from urllib.request import urlopen
import shutil
import requests
url = 'http://softy.000webhostapp.com/login/login_empty.php'
def clr():
    os.system('cls' if os.name=='nt' else 'clear')
def download(url, title, path):
	print("Downloading: "+title)
	response = urllib.request.urlopen(url)
	data = response.read()
	text = data
	f = open(path, "wb")
	f.write(text)
	f.flush()
	f.close()
def getStatus(url):
	with open(url, "r") as f:
		j = json.load(f)
	text = ""
	for line in range(len(j)):
		if(j[line]["status"] == "OKAY"):
			w.setClarissaSettingWithPath(dir_path+"/user.rif", "user", "user", j[line]["username"])
			w.setClarissaSettingWithPath(dir_path+"/user.rif", "pass","pass", j[line]["password"])
		else: