Initial commit
BIN
__pycache__/config.cpython-310.pyc
Normal file
BIN
__pycache__/libx.cpython-310.pyc
Normal file
42
backup_db.py
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
from libx import *
|
||||||
|
|
||||||
|
def backup_full_db(ip1,porta1,user1,senha1,db1,ip2,porta2,user2,senha2,db2):
|
||||||
|
|
||||||
|
if ip1 =="localhost":
|
||||||
|
link1 = f"mongodb://{ip1}:{str(porta1)}/?readPreference=primary"
|
||||||
|
else:
|
||||||
|
link1 = f"mongodb://{user1}:{senha1}@{ip1}:{porta1}/?authSource=admin&readPreference=primary&ssl=false"
|
||||||
|
|
||||||
|
if ip2 =="localhost":
|
||||||
|
link2 = f"mongodb://{ip2}:{str(porta2)}/?readPreference=primary"
|
||||||
|
else:
|
||||||
|
link2 = f"mongodb://{user2}:{senha2}@{ip2}:{porta2}/?authSource=admin&readPreference=primary&ssl=false"
|
||||||
|
|
||||||
|
db_origem = MongoClient(link1).get_database(db1)
|
||||||
|
db_destino = MongoClient(link2).get_database(db2)
|
||||||
|
|
||||||
|
lista_colecoes = db_origem.list_collection_names()
|
||||||
|
for c in lista_colecoes:
|
||||||
|
print("_"*80)
|
||||||
|
print(c,type(c))
|
||||||
|
print("_"*80)
|
||||||
|
col = db_destino[c]
|
||||||
|
col_origem = db_origem.get_collection(c)
|
||||||
|
col_destino = db_destino.get_collection(c)
|
||||||
|
t = col_origem.count_documents({})
|
||||||
|
n = 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for doc in col_origem.find():
|
||||||
|
|
||||||
|
if c in ["comentarios","marcas","matriculas"]:
|
||||||
|
doc["ano_sem"] = "2021-1"
|
||||||
|
|
||||||
|
n+=1
|
||||||
|
col_destino.update_one({"_id":doc["_id"]},{"$set":doc},upsert=True)
|
||||||
|
print(c,n," / ",t)
|
||||||
|
|
||||||
|
# backup_full_db("0.0.0.0",2323,"USERNAME","PASSWORD","connect","localhost",27017,"","","NOME_DO_BACKUP")
|
||||||
|
# backup_full_db("34.71.239.163",2323,"HsbCUfRc4r30d0lBNQ3lZIsVPBPfSrOwltz8JFP00imR38MZvM","oGLOx7sbBuuMywyryj97kFblWOgYNjLMRBiYH4RTVvYqqnX0J6","connect","paas1.pp.ifms.edu.br",27017,"serti","TYS5DNpGPmBkFaVK","ifmsconselho")
|
||||||
|
|
384
carregar_bancos.py
Normal file
|
@ -0,0 +1,384 @@
|
||||||
|
# coding: utf8
|
||||||
|
|
||||||
|
from libx import *
|
||||||
|
|
||||||
|
import win32clipboard
|
||||||
|
import pyautogui
|
||||||
|
import time
|
||||||
|
|
||||||
|
import os.path
|
||||||
|
|
||||||
|
|
||||||
|
SEMESTRE_ATUAL = "2022-1"
|
||||||
|
|
||||||
|
MONGO_ADDRESS = "localhost"
|
||||||
|
MONGO_PORT = 27017
|
||||||
|
MONGO_LINK = f"mongodb://{MONGO_ADDRESS}:{str(MONGO_PORT)}/?readPreference=primary"
|
||||||
|
|
||||||
|
|
||||||
|
CONNECT_DB = MongoClient(MONGO_LINK).get_database('connect')
|
||||||
|
|
||||||
|
PROFESSORES = CONNECT_DB.get_collection('professores')
|
||||||
|
MATRICULAS = CONNECT_DB.get_collection('matriculas')
|
||||||
|
DISCIPLINAS = CONNECT_DB.get_collection('disciplinas')
|
||||||
|
FOTOS = CONNECT_DB.get_collection('fotos')
|
||||||
|
CONTATOS = CONNECT_DB.get_collection('contatos')
|
||||||
|
|
||||||
|
MARCAS = CONNECT_DB.get_collection('marcas')
|
||||||
|
COMENTARIOS = CONNECT_DB.get_collection('comentarios')
|
||||||
|
|
||||||
|
def baixar_dados_dos_esutantes_do_academico(anos,destino):
|
||||||
|
#win32clipboard.OpenClipboard()
|
||||||
|
#notas = win32clipboard.GetClipboardData().split("\n")
|
||||||
|
#win32clipboard.CloseClipboard()
|
||||||
|
input("Pressione uma tecla para recomeçar....")
|
||||||
|
|
||||||
|
print("Posicione na caixa de busca:")
|
||||||
|
time.sleep(5)
|
||||||
|
caixa_busca = pyautogui.position()
|
||||||
|
print(caixa_busca)
|
||||||
|
|
||||||
|
print("Posicione no link para abrir o aluno")
|
||||||
|
time.sleep(5)
|
||||||
|
link_aluno = pyautogui.position()
|
||||||
|
print(link_aluno)
|
||||||
|
|
||||||
|
print("Posicione na foto do aluno")
|
||||||
|
time.sleep(5)
|
||||||
|
foto_aluno = pyautogui.position()
|
||||||
|
print(foto_aluno)
|
||||||
|
|
||||||
|
print("Posicione no botao fechar da aba aberta")
|
||||||
|
time.sleep(5)
|
||||||
|
fechar_aba = pyautogui.position()
|
||||||
|
|
||||||
|
print("Posicione sobre o bloco de notas")
|
||||||
|
time.sleep(5)
|
||||||
|
bloco_notas = pyautogui.position()
|
||||||
|
|
||||||
|
print("*"*1000)
|
||||||
|
time.sleep(2)
|
||||||
|
|
||||||
|
pyautogui.moveTo(fechar_aba)
|
||||||
|
pyautogui.click()
|
||||||
|
time.sleep(2)
|
||||||
|
|
||||||
|
#win32clipboard.OpenClipboard()
|
||||||
|
t = MATRICULAS.count()
|
||||||
|
n = 1
|
||||||
|
for aluno in MATRICULAS.find().sort("nome",1):
|
||||||
|
|
||||||
|
matricula = aluno["matricula"]
|
||||||
|
ano = matricula[0:4]
|
||||||
|
nome = aluno["nome"]
|
||||||
|
print(n,"/",t,nome,matricula,ano)
|
||||||
|
n+=1
|
||||||
|
|
||||||
|
if ano in anos:
|
||||||
|
if not (os.path.isfile(destino+matricula+".jpg") and os.path.isfile(destino+matricula+".txt")):
|
||||||
|
|
||||||
|
#
|
||||||
|
# busca estudante
|
||||||
|
#
|
||||||
|
pyautogui.moveTo(caixa_busca)
|
||||||
|
time.sleep(0.1)
|
||||||
|
pyautogui.click()
|
||||||
|
time.sleep(0.1)
|
||||||
|
pyautogui.hotkey('ctrl', 'a')
|
||||||
|
time.sleep(0.1)
|
||||||
|
pyautogui.hotkey('del')
|
||||||
|
time.sleep(0.1)
|
||||||
|
pyautogui.write(matricula,0.01)
|
||||||
|
time.sleep(0.1)
|
||||||
|
pyautogui.hotkey('enter')
|
||||||
|
time.sleep(3)
|
||||||
|
pyautogui.moveTo(link_aluno)
|
||||||
|
time.sleep(0.1)
|
||||||
|
pyautogui.click()
|
||||||
|
time.sleep(2)
|
||||||
|
|
||||||
|
if not os.path.isfile(destino+matricula+'.jpg'):
|
||||||
|
pyautogui.moveTo(foto_aluno)
|
||||||
|
time.sleep(0.1)
|
||||||
|
pyautogui.click(button='right')
|
||||||
|
time.sleep(0.5)
|
||||||
|
pyautogui.hotkey('down')
|
||||||
|
time.sleep(0.1)
|
||||||
|
pyautogui.hotkey('down')
|
||||||
|
time.sleep(0.1)
|
||||||
|
pyautogui.hotkey('enter')
|
||||||
|
time.sleep(4)
|
||||||
|
pyautogui.write(destino+matricula+'.jpg',0.01)
|
||||||
|
pyautogui.hotkey('enter')
|
||||||
|
time.sleep(2)
|
||||||
|
|
||||||
|
if not os.path.isfile(destino+matricula+'.txt'):
|
||||||
|
|
||||||
|
pyautogui.moveTo(foto_aluno)
|
||||||
|
time.sleep(0.1)
|
||||||
|
pyautogui.click()
|
||||||
|
time.sleep(0.1)
|
||||||
|
pyautogui.hotkey('ctrl', 'a')
|
||||||
|
time.sleep(0.1)
|
||||||
|
pyautogui.click(button='right')
|
||||||
|
time.sleep(0.1)
|
||||||
|
pyautogui.hotkey('down')
|
||||||
|
time.sleep(0.1)
|
||||||
|
pyautogui.hotkey('down')
|
||||||
|
time.sleep(0.1)
|
||||||
|
pyautogui.hotkey('down')
|
||||||
|
time.sleep(0.1)
|
||||||
|
pyautogui.hotkey('down')
|
||||||
|
time.sleep(0.1)
|
||||||
|
pyautogui.hotkey('down')
|
||||||
|
time.sleep(0.1)
|
||||||
|
pyautogui.hotkey('down')
|
||||||
|
time.sleep(0.1)
|
||||||
|
pyautogui.hotkey('down')
|
||||||
|
time.sleep(0.1)
|
||||||
|
pyautogui.hotkey('enter')
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
pyautogui.moveTo(bloco_notas)
|
||||||
|
time.sleep(0.1)
|
||||||
|
pyautogui.click()
|
||||||
|
time.sleep(0.1)
|
||||||
|
pyautogui.hotkey('ctrl', 'a')
|
||||||
|
time.sleep(0.1)
|
||||||
|
pyautogui.hotkey('del')
|
||||||
|
time.sleep(0.1)
|
||||||
|
pyautogui.hotkey('ctrl', 'v')
|
||||||
|
time.sleep(0.1)
|
||||||
|
pyautogui.hotkey('ctrl','shift', 's')
|
||||||
|
time.sleep(2)
|
||||||
|
pyautogui.write(destino+matricula+".txt",0.01)
|
||||||
|
pyautogui.hotkey('enter')
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
pyautogui.moveTo(fechar_aba)
|
||||||
|
pyautogui.click()
|
||||||
|
time.sleep(1)
|
||||||
|
else:
|
||||||
|
print("pulando..."+matricula)
|
||||||
|
|
||||||
|
#win32clipboard.CloseClipboard()
|
||||||
|
def gerar_banco_professores(arquivo):
|
||||||
|
linhas = open (arquivo,"r").read().split("\n")
|
||||||
|
i = 0
|
||||||
|
for linha in linhas:
|
||||||
|
if "Visualizar" in linha:
|
||||||
|
nome = linhas[i+1].split("(")[0].strip()
|
||||||
|
email = linhas[i+2]
|
||||||
|
token = RANDON_CODES()[0]
|
||||||
|
PROFESSORES.update_one({"email":email},{"$set":{"nome":nome,"email":email,"token":token}},upsert = True)
|
||||||
|
|
||||||
|
i += 1
|
||||||
|
def gerar_banco_esudantes(arquivo,cursos,status):
|
||||||
|
linhas = open (arquivo,"r").read().split("\n")
|
||||||
|
lista_cursos = []
|
||||||
|
# 0 1 2 3 4 5 6 7 8 9 10 11 12
|
||||||
|
#Ingresso Curso Campus Polo Tipo Oferta Turno Matrícula RA Estudante CPF Data de Nascimento Idade Telefone Situação no curso Ações
|
||||||
|
for linha in linhas:
|
||||||
|
coluna = linha.split("\t")
|
||||||
|
if len(coluna)>5:
|
||||||
|
curso = coluna[1].split(" ")[-1]
|
||||||
|
turno = coluna[5]
|
||||||
|
matricula = coluna[6]
|
||||||
|
nome = coluna[8]
|
||||||
|
ALUNOS.update_one({"matricula":matricula},{"$set":{"nome":nome,"curso":curso,"turno":turno,"matricula":matricula}},upsert = True)
|
||||||
|
#for curso in lista_cursos:
|
||||||
|
# CURSOS.update_one({"nome":curso},{"$set":{"nome":curso}},upsert = True)
|
||||||
|
def completar_banco_esudantes(arquivo,cursos,status,destino,pasta_avatares):
|
||||||
|
linhas = open (arquivo,"r").read().split("\n")
|
||||||
|
lista_cursos = []
|
||||||
|
for linha in linhas:
|
||||||
|
coluna = linha.split("\t")
|
||||||
|
if len(coluna)>5:
|
||||||
|
|
||||||
|
matricula = coluna[6]
|
||||||
|
nome = coluna[8]
|
||||||
|
foto = ""
|
||||||
|
arquivo_jpg = destino+matricula+".jpg"
|
||||||
|
arquivo_txt = destino+matricula+".txt"
|
||||||
|
|
||||||
|
|
||||||
|
semestre = ""
|
||||||
|
genero = ""
|
||||||
|
if os.path.isfile(arquivo_txt):
|
||||||
|
ls = open(arquivo_txt,"r",encoding='UTF8').read().split("\n")
|
||||||
|
for l in ls:
|
||||||
|
c = l.split("\t")
|
||||||
|
if len(c)>1:
|
||||||
|
if c[0]=="Sexo:":
|
||||||
|
genero = c[1]
|
||||||
|
if genero == "Não declarado":
|
||||||
|
genero = ""
|
||||||
|
if c[0]=="Período Atual:":semestre = c[1]
|
||||||
|
|
||||||
|
if os.path.isfile(arquivo_jpg):
|
||||||
|
foto = "data:image/jpeg;base64," + base64.b64encode(open(arquivo_jpg, "rb").read()).decode('utf-8')
|
||||||
|
else:
|
||||||
|
if genero == "":
|
||||||
|
foto = "data:image/jpeg;base64," + base64.b64encode(open(pasta_avatares+"neutro.jpg", "rb").read()).decode('utf-8')
|
||||||
|
else:
|
||||||
|
foto = "data:image/png;base64," +base64.b64encode(open(pasta_avatares+genero+"_"+str(randint(1,7))+".png", "rb").read()).decode('utf-8')
|
||||||
|
print(matricula,nome,genero,semestre)
|
||||||
|
ALUNOS.update_one({"matricula":matricula},{"$set":{"genero":genero,"semestre":semestre,"foto":foto}},upsert = True)
|
||||||
|
def carregar_relatorio_de_matriculas_exportado(arquivo,destino,pasta_avatares):
|
||||||
|
|
||||||
|
FILTRO_CURSOS = {"035":"Agricultura","036":"Informática","299":"Agricultura","298":"Informática"}
|
||||||
|
FILTRO_TURNO = {"1":"Matutino","2":"Vespertino","3":"Noturno","4":"Integral"}
|
||||||
|
FILTRO_ANO = SEMESTRE_ATUAL.split("-")[0]
|
||||||
|
FITLRO_SEMESTRE = "1"
|
||||||
|
FILTRO_STATUS = ["Em curso"]
|
||||||
|
|
||||||
|
linhas = open (arquivo,"r",encoding='UTF8').read().split("\n")
|
||||||
|
lista_cursos = []
|
||||||
|
last_name = ""
|
||||||
|
|
||||||
|
filtro_turma_ab = []
|
||||||
|
|
||||||
|
for linha in linhas:
|
||||||
|
coluna = linha.split("\t")
|
||||||
|
if len(coluna) > 5:
|
||||||
|
|
||||||
|
#0 1 2 3 4 5 6 7 8 9 10 11 12 13
|
||||||
|
#ra estudante email cpf matricula status_aluno_curso status_aluno_classe curso classe unidade_curricular_id unidade_curricular codigo_unidade_curricular carga_horaria_unidade_curricular turma semestre periodo_letivo faltas presencas media data_fechamento
|
||||||
|
ra = coluna[0]
|
||||||
|
nome = coluna[1]
|
||||||
|
curso = coluna[7].split(" ")[-1]
|
||||||
|
matricula = coluna[4]
|
||||||
|
|
||||||
|
if curso in FILTRO_CURSOS.values():
|
||||||
|
classe = coluna[8].split("PP")[0]
|
||||||
|
# 1
|
||||||
|
#01234567890123
|
||||||
|
#20211036105APP - INF - EF15GEducação Física 5A
|
||||||
|
|
||||||
|
ano = classe[0:4]
|
||||||
|
ano_semestre= classe[4:5]
|
||||||
|
curso_cod = classe[5:8]
|
||||||
|
turno = FILTRO_TURNO[classe[8:9]]
|
||||||
|
semestre = str(int(classe[9:11]))
|
||||||
|
status = coluna[5]
|
||||||
|
disciplina = coluna[10]
|
||||||
|
|
||||||
|
turma = classe[-1]
|
||||||
|
|
||||||
|
telefone_residencial = ""
|
||||||
|
telefone_celular = ""
|
||||||
|
email_pessoal = ""
|
||||||
|
email_institucional = ""
|
||||||
|
|
||||||
|
if (curso_cod in FILTRO_CURSOS) and (status in FILTRO_STATUS):
|
||||||
|
curso = FILTRO_CURSOS[curso_cod]
|
||||||
|
|
||||||
|
if last_name != nome:
|
||||||
|
arquivo_txt = destino+matricula+".txt"
|
||||||
|
genero = ""
|
||||||
|
if os.path.isfile(arquivo_txt):
|
||||||
|
ls = open(arquivo_txt,"r",encoding='UTF8').readlines()
|
||||||
|
for l in ls:
|
||||||
|
c = l.replace("\t"," ").split(" ")
|
||||||
|
if len(c)>1:
|
||||||
|
if c[0]=="Sexo:":
|
||||||
|
genero = c[1]
|
||||||
|
if genero == "Não declarado":
|
||||||
|
genero = ""
|
||||||
|
if "Telefone residencial:" in l:
|
||||||
|
telefone_residencial = c[-1]
|
||||||
|
|
||||||
|
if "Telefone celular:" in l:
|
||||||
|
telefone_celular = l.replace("Telefone celular:","").replace(" ","")
|
||||||
|
|
||||||
|
if "Email institucional" in l:
|
||||||
|
email_institucional = l.replace("Email institucional: ","").replace(" ","")
|
||||||
|
|
||||||
|
if "Email pessoal:"in l:
|
||||||
|
email_pessoal = l.replace("Email pessoal:","").replace(" ","")
|
||||||
|
|
||||||
|
foto = ""
|
||||||
|
arquivo_jpg = destino+"\\"+matricula+".jpg"
|
||||||
|
#arquivo_jpg = destino+matricula+".jpg"
|
||||||
|
if os.path.isfile(arquivo_jpg):
|
||||||
|
foto = "data:image/jpeg;base64," + base64.b64encode(open(arquivo_jpg, "rb").read()).decode('utf-8')
|
||||||
|
else:
|
||||||
|
if genero == "":
|
||||||
|
foto = "data:image/jpeg;base64," + base64.b64encode(open(pasta_avatares+"neutro.jpg", "rb").read()).decode('utf-8')
|
||||||
|
else:
|
||||||
|
foto = "data:image/png;base64," +base64.b64encode(open(pasta_avatares+genero+"_"+str(randint(1,7))+".png", "rb").read()).decode('utf-8')
|
||||||
|
|
||||||
|
FOTOS.update_one({"matricula":matricula},{"$set":{"matricula":matricula,"foto":foto}},upsert = True)
|
||||||
|
CONTATOS.update_one({"matricula":matricula},{"$set":{
|
||||||
|
"telefones":telefone_residencial + ";"+telefone_celular,
|
||||||
|
"emails":email_institucional+ ";"+email_pessoal
|
||||||
|
}},upsert = True)
|
||||||
|
print(SEMESTRE_ATUAL,curso, semestre,turno, turma, nome,disciplina)
|
||||||
|
#print(telefone_residencial,ano,telefone_celular, email_institucional, email_pessoal)
|
||||||
|
|
||||||
|
last_name = nome
|
||||||
|
|
||||||
|
#if False:
|
||||||
|
DISCIPLINAS.update_one({"curso":curso,"semestre":semestre,"disciplina":disciplina},{"$set":{"curso":curso,"semestre":semestre,"disciplina":disciplina,"turma":turma}},upsert = True)
|
||||||
|
MATRICULAS.update_one({"matricula":matricula,"curso":curso,"semestre":semestre,"turno":turno,"disciplina":disciplina,"ano_sem":SEMESTRE_ATUAL},{"$set":{"matricula":matricula,"nome":nome,"disciplina":disciplina,"curso":curso,"semestre":semestre,"turno":turno,"turma":turma,"ano_sem":SEMESTRE_ATUAL}},upsert = True)
|
||||||
|
|
||||||
|
#MATRICULAS.update_one({"matricula":matricula,"curso":curso,"semestre":semestre,"turno":turno,"disciplina":disciplina},{"$set":{"turma":turma}})
|
||||||
|
|
||||||
|
for c in COMENTARIOS.find({"matricula":matricula,"curso":curso,"semestre":semestre,"turno":turno,"disciplina":disciplina,"ano_sem":SEMESTRE_ATUAL}):
|
||||||
|
COMENTARIOS.update_one(c,{"$set":{"turma":turma,"ano_sem":SEMESTRE_ATUAL}})
|
||||||
|
|
||||||
|
for c in MARCAS.find({"matricula":matricula,"curso":curso,"semestre":semestre,"turno":turno,"disciplina":disciplina,"ano_sem":SEMESTRE_ATUAL}):
|
||||||
|
MARCAS.update_one(c,{"$set":{"turma":turma,"ano_sem":SEMESTRE_ATUAL}})
|
||||||
|
|
||||||
|
def contar_genero(arquivo,cursos,status,destino,pasta_avatares):
|
||||||
|
linhas = open (arquivo,"r").read().split("\n")
|
||||||
|
lista_cursos = []
|
||||||
|
for linha in linhas:
|
||||||
|
coluna = linha.split("\t")
|
||||||
|
if len(coluna)>5:
|
||||||
|
|
||||||
|
matricula = coluna[6]
|
||||||
|
nome = coluna[8]
|
||||||
|
foto = ""
|
||||||
|
arquivo_jpg = destino+matricula+".jpg"
|
||||||
|
arquivo_txt = destino+matricula+".txt"
|
||||||
|
|
||||||
|
|
||||||
|
semestre = ""
|
||||||
|
genero = ""
|
||||||
|
if os.path.isfile(arquivo_txt):
|
||||||
|
ls = open(arquivo_txt,"r",encoding='UTF8').read().split("\n")
|
||||||
|
for l in ls:
|
||||||
|
c = l.split("\t")
|
||||||
|
if len(c)>1:
|
||||||
|
if c[0]=="Sexo:":
|
||||||
|
genero = c[1]
|
||||||
|
if genero == "Não declarado":
|
||||||
|
genero = ""
|
||||||
|
if c[0]=="Período Atual:":semestre = c[1]
|
||||||
|
|
||||||
|
if os.path.isfile(arquivo_jpg):
|
||||||
|
foto = "data:image/jpeg;base64," + base64.b64encode(open(arquivo_jpg, "rb").read()).decode('utf-8')
|
||||||
|
else:
|
||||||
|
if genero == "":
|
||||||
|
foto = "data:image/jpeg;base64," + base64.b64encode(open(pasta_avatares+"neutro.jpg", "rb").read()).decode('utf-8')
|
||||||
|
else:
|
||||||
|
foto = "data:image/png;base64," +base64.b64encode(open(pasta_avatares+genero+"_"+str(randint(1,7))+".png", "rb").read()).decode('utf-8')
|
||||||
|
print(matricula,nome,genero,semestre)
|
||||||
|
#ALUNOS.update_one({"matricula":matricula},{"$set":{"genero":genero,"semestre":semestre,"foto":foto}},upsert = True)
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#gerar_banco_esudantes("dados/lista_em_curso_2021.txt" ,["Técnico em Agricultura","Técnico em Informática"],["Em curso"])
|
||||||
|
#completar_banco_esudantes("dados/lista_em_curso_2021.txt" ,["Técnico em Agricultura","Técnico em Informática"],["Em curso"],"C:\\Users\\robson\\Desktop\\connect\\dados\\estudantes\\","C:\\Users\\robson\\Desktop\\connect\\dados\\avatares\\")
|
||||||
|
#baixar_dados_dos_esutantes_do_academico(["2018","2019","2020","2021","2022"],"C:\\Users\\USUARIO\\Desktop\\connect_2022_1\\dados\\estudantes\\")
|
||||||
|
|
||||||
|
#gerar_banco_professores("dados/lista_professores.txt" )
|
||||||
|
|
||||||
|
arquivo_exportado = "dados/relatorio_exportado_2022_1_cerel.txt"
|
||||||
|
pasta_estudantes = "C:\\Users\\USUARIO\\Desktop\\connect_2022_1\\dados\\estudantes\\"
|
||||||
|
pasta_avatares = "C:\\Users\\USUARIO\\Desktop\\connect_2022_1\\dados\\avatares\\"
|
||||||
|
|
||||||
|
#carregar_relatorio_de_matriculas_exportado(arquivo_exportado,pasta_estudantes,pasta_avatares)
|
||||||
|
|
||||||
|
|
72
config.py
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
IS_RUNNING_IN_SERVER = False
|
||||||
|
IS_LOCAL_HOST = True
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
APP_SECRET_KEY = "SdZ4Hw8YQtLVrFp9yagsWe726KE3fqPB"
|
||||||
|
APP_SESSION_DAYS = 1
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
GMAIL_SERVER = "smtp.gmail.com"
|
||||||
|
GMAIL_PORT = "587"
|
||||||
|
GMAIL_USER = "EMAIL DO SISTEMA"
|
||||||
|
GMAIL_PASSWORD = "SENHA DO SISTEMA"
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
UPDATE_CSS_AND_JS = True
|
||||||
|
NUM_MAX_ALERTA = 3
|
||||||
|
|
||||||
|
if(IS_RUNNING_IN_SERVER):
|
||||||
|
|
||||||
|
UPDATE_CSS_AND_JS = False
|
||||||
|
APP_RUN_DEBUG_MODE = False
|
||||||
|
SERVER_THREADS = 300
|
||||||
|
MAXIMUM_QUEUE_SIZE = 1000
|
||||||
|
SERVER_TIMEOUT = 30
|
||||||
|
|
||||||
|
else:
|
||||||
|
|
||||||
|
UPDATE_CSS_AND_JS = True
|
||||||
|
APP_RUN_DEBUG_MODE = True
|
||||||
|
SERVER_THREADS = 4
|
||||||
|
MAXIMUM_QUEUE_SIZE = 10
|
||||||
|
SERVER_TIMEOUT = 3
|
||||||
|
|
||||||
|
|
||||||
|
if IS_LOCAL_HOST:
|
||||||
|
|
||||||
|
EXTERN_ADDRESS = "10.7.1.1"
|
||||||
|
HOST_ADDRESS = "10.7.1.1"
|
||||||
|
APP_PORT = 8080
|
||||||
|
|
||||||
|
MONGO_ADDRESS = "paas1.pp.ifms.edu.br"
|
||||||
|
MONGO_PORT = 27017
|
||||||
|
# MONGO_LINK = f"mongodb://{MONGO_ADDRESS}:{str(MONGO_PORT)}/?readPreference=primary"
|
||||||
|
|
||||||
|
MONGO_USERNAME = "serti"
|
||||||
|
MONGO_PASSWORD = "TYS5DNpGPmBkFaVK"
|
||||||
|
MONGO_LINK = f"mongodb://{MONGO_USERNAME}:{MONGO_PASSWORD}@{MONGO_ADDRESS}:{MONGO_PORT}/?authSource=admin&readPreference=primary&ssl=false"
|
||||||
|
|
||||||
|
|
||||||
|
HIDE_APP_INTERFACE = False
|
||||||
|
# HIDE_IDERU_IO = False
|
||||||
|
|
||||||
|
else:
|
||||||
|
|
||||||
|
EXTERN_ADDRESS = "0.0.0.0"
|
||||||
|
HOST_ADDRESS = "10.128.0.3"
|
||||||
|
APP_PORT = 80
|
||||||
|
|
||||||
|
MONGO_ADDRESS = "paas1.pp.ifms.edu.br"
|
||||||
|
MONGO_PORT = 27017
|
||||||
|
MONGO_USERNAME = "serti"
|
||||||
|
MONGO_PASSWORD = "TYS5DNpGPmBkFaVK"
|
||||||
|
MONGO_LINK = f"mongodb://{MONGO_USERNAME}:{MONGO_PASSWORD}@{MONGO_ADDRESS}:{MONGO_PORT}/?authSource=admin&readPreference=primary&ssl=false"
|
||||||
|
|
||||||
|
HIDE_APP_INTERFACE = True
|
||||||
|
# HIDE_IDERU_IO = True
|
439
connect.py
Normal file
BIN
conta_professores.py
Normal file
BIN
dados/avatares/Feminino_1.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
BIN
dados/avatares/Feminino_2.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
dados/avatares/Feminino_3.png
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
dados/avatares/Feminino_4.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
dados/avatares/Feminino_5.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
dados/avatares/Feminino_6.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
dados/avatares/Feminino_7.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
dados/avatares/Masculino_1.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
dados/avatares/Masculino_2.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
dados/avatares/Masculino_3.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
dados/avatares/Masculino_4.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
dados/avatares/Masculino_5.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
dados/avatares/Masculino_6.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
dados/avatares/Masculino_7.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
dados/avatares/neutro.jpg
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
dados/avatares/unnamed.gif
Normal file
After Width: | Height: | Size: 54 KiB |
BIN
enviar_emails.py
Normal file
119
libx.py
Normal file
|
@ -0,0 +1,119 @@
|
||||||
|
# coding: utf8
|
||||||
|
#------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
from config import *
|
||||||
|
#------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
# Flask / Server
|
||||||
|
#------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
from waitress import serve
|
||||||
|
from flask import Flask, redirect, url_for, render_template, request, session,jsonify,send_file
|
||||||
|
#------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
# MongoDB
|
||||||
|
#------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
import pymongo
|
||||||
|
from pymongo import MongoClient
|
||||||
|
from bson.objectid import ObjectId
|
||||||
|
import json
|
||||||
|
import simplejson
|
||||||
|
import urllib
|
||||||
|
#------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
# email
|
||||||
|
#------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
from email.mime.multipart import MIMEMultipart
|
||||||
|
from email.mime.text import MIMEText
|
||||||
|
import smtplib
|
||||||
|
#------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
# API
|
||||||
|
#------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
from datetime import datetime, timedelta
|
||||||
|
from random import randint
|
||||||
|
import pyqrcodeng
|
||||||
|
#------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
# genérico
|
||||||
|
#------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
from math import radians, cos, sin, asin, sqrt, acos,ceil,floor
|
||||||
|
#------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
import os
|
||||||
|
import glob
|
||||||
|
#------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
# API
|
||||||
|
#------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
import re
|
||||||
|
import base64
|
||||||
|
#------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
# Ranking
|
||||||
|
#------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
import threading
|
||||||
|
import time
|
||||||
|
#------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
# IA
|
||||||
|
#------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
import matplotlib
|
||||||
|
matplotlib.use('Agg')
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
import numpy as np
|
||||||
|
from random import random
|
||||||
|
# from sklearn.metrics import accuracy_score
|
||||||
|
from scipy.io.wavfile import write
|
||||||
|
import _pickle as pkl
|
||||||
|
|
||||||
|
def stringToBase64(s):
|
||||||
|
return base64.b64encode(s.encode('utf-8'))
|
||||||
|
def base64ToString(b):
|
||||||
|
try:
|
||||||
|
return base64.b64decode(b).decode('utf-8')
|
||||||
|
except ValueError:
|
||||||
|
return base64.b64decode(b).decode('ISO-8859-1').encode('utf8').decode('utf8')
|
||||||
|
|
||||||
|
def RANDON_CODES(number_of_codes=1,not_can_do=[],digits=50):
|
||||||
|
m = "0123456789qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM"
|
||||||
|
codigos_gedados = []
|
||||||
|
while len(codigos_gedados)<number_of_codes:
|
||||||
|
nao_encontrado = True
|
||||||
|
codigo = ""
|
||||||
|
while nao_encontrado:
|
||||||
|
for i in range(0,digits):
|
||||||
|
codigo+= m[randint(0,len(m)-1)]
|
||||||
|
if codigo in not_can_do:
|
||||||
|
codigo = ""
|
||||||
|
else:
|
||||||
|
codigos_gedados.append(codigo)
|
||||||
|
not_can_do.append(codigo)
|
||||||
|
nao_encontrado = False
|
||||||
|
return codigos_gedados
|
||||||
|
def EMAIL(to,subject,body):
|
||||||
|
try:
|
||||||
|
me = GMAIL_USER
|
||||||
|
you = to
|
||||||
|
# Create message container - the correct MIME type is multipart/alternative.
|
||||||
|
msg = MIMEMultipart('alternative')
|
||||||
|
msg['Subject'] =subject
|
||||||
|
msg['From'] = me
|
||||||
|
msg['To'] = you
|
||||||
|
# Create the body of the message (a plain-text and an HTML version).
|
||||||
|
text = ""
|
||||||
|
html = body
|
||||||
|
# Record the MIME types of both parts - text/plain and text/html.
|
||||||
|
#part1 = MIMEText(text, 'plain')
|
||||||
|
part2 = MIMEText(html, 'html')
|
||||||
|
# Attach parts into message container.
|
||||||
|
# According to RFC 2046, the last part of a multipart message, in this case
|
||||||
|
# the HTML message, is best and preferred.
|
||||||
|
#msg.attach(part1)
|
||||||
|
msg.attach(part2)
|
||||||
|
# Send the message via local SMTP server.
|
||||||
|
mail = smtplib.SMTP(GMAIL_SERVER, GMAIL_PORT)
|
||||||
|
mail.ehlo()
|
||||||
|
mail.starttls()
|
||||||
|
mail.login(GMAIL_USER, GMAIL_PASSWORD)
|
||||||
|
try:
|
||||||
|
mail.sendmail(me, you, msg.as_string())
|
||||||
|
mail.quit()
|
||||||
|
return True
|
||||||
|
except Exception as e:
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
return True
|
||||||
|
except Exception as e:
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
return True
|
118
requirements.txt
Normal file
|
@ -0,0 +1,118 @@
|
||||||
|
attrs==21.2.0
|
||||||
|
bcc==0.18.0
|
||||||
|
bcrypt==3.2.0
|
||||||
|
beautifulsoup4==4.10.0
|
||||||
|
blinker==1.4
|
||||||
|
Brlapi==0.8.3
|
||||||
|
certifi==2020.6.20
|
||||||
|
chardet==4.0.0
|
||||||
|
chrome-gnome-shell==0.0.0
|
||||||
|
click==8.1.3
|
||||||
|
colorama==0.4.6
|
||||||
|
command-not-found==0.3
|
||||||
|
contourpy==1.0.7
|
||||||
|
cryptography==3.4.8
|
||||||
|
cupshelpers==1.0
|
||||||
|
cycler==0.11.0
|
||||||
|
dbus-python==1.2.18
|
||||||
|
defer==1.0.6
|
||||||
|
distro==1.7.0
|
||||||
|
dnspython==2.3.0
|
||||||
|
docker==5.0.3
|
||||||
|
docker-compose==1.29.2
|
||||||
|
dockerpty==0.4.1
|
||||||
|
docopt==0.6.2
|
||||||
|
evdev==1.4.0
|
||||||
|
Flask==2.2.2
|
||||||
|
fonttools==4.39.0
|
||||||
|
future==0.18.2
|
||||||
|
gevent==21.8.0
|
||||||
|
greenlet==1.1.2
|
||||||
|
hidpidaemon==18.4.6
|
||||||
|
html5lib==1.1
|
||||||
|
httplib2==0.20.2
|
||||||
|
idna==3.3
|
||||||
|
importlib-metadata==6.0.0
|
||||||
|
importlib-resources==5.12.0
|
||||||
|
itsdangerous==2.1.2
|
||||||
|
jeepney==0.7.1
|
||||||
|
Jinja2==3.1.2
|
||||||
|
jsonschema==3.2.0
|
||||||
|
kazam==1.4.5
|
||||||
|
kernelstub==3.1.4
|
||||||
|
keyring==23.5.0
|
||||||
|
kiwisolver==1.4.4
|
||||||
|
language-selector==0.1
|
||||||
|
launchpadlib==1.10.16
|
||||||
|
lazr.restfulclient==0.14.4
|
||||||
|
lazr.uri==1.0.6
|
||||||
|
libvirt-python==8.0.0
|
||||||
|
louis==3.20.0
|
||||||
|
lxml==4.8.0
|
||||||
|
macaroonbakery==1.3.1
|
||||||
|
MarkupSafe==2.1.2
|
||||||
|
matplotlib==3.7.1
|
||||||
|
more-itertools==8.10.0
|
||||||
|
netaddr==0.8.0
|
||||||
|
netifaces==0.11.0
|
||||||
|
numpy==1.24.2
|
||||||
|
oauthlib==3.2.0
|
||||||
|
packaging==23.0
|
||||||
|
paramiko==2.9.3
|
||||||
|
Pillow==9.4.0
|
||||||
|
pop-transition==1.1.2
|
||||||
|
protobuf==3.12.4
|
||||||
|
psutil==5.9.0
|
||||||
|
pycairo==1.20.1
|
||||||
|
pycups==2.0.1
|
||||||
|
pydbus==0.6.0
|
||||||
|
PyGObject==3.42.1
|
||||||
|
PyHoca-CLI==0.6.1.2
|
||||||
|
PyJWT==2.3.0
|
||||||
|
pymacaroons==0.13.0
|
||||||
|
pymongo==4.3.3
|
||||||
|
PyNaCl==1.5.0
|
||||||
|
pyparsing==3.0.9
|
||||||
|
PyQRCodeNG==1.3.6
|
||||||
|
pyRFC3339==1.1
|
||||||
|
pyrsistent==0.18.1
|
||||||
|
python-apt==2.4.0+ubuntu1
|
||||||
|
python-dateutil==2.8.2
|
||||||
|
python-debian===0.1.43ubuntu1
|
||||||
|
python-dotenv==0.19.2
|
||||||
|
python-gnupg==0.4.8
|
||||||
|
python-xlib==0.29
|
||||||
|
pytz==2022.1
|
||||||
|
pyxdg==0.27
|
||||||
|
PyYAML==5.4.1
|
||||||
|
repolib==2.2.0
|
||||||
|
repoman==1.4.0
|
||||||
|
reportlab==3.6.12
|
||||||
|
requests==2.25.1
|
||||||
|
scipy==1.10.1
|
||||||
|
SecretStorage==3.3.1
|
||||||
|
sessioninstaller==0.0.0
|
||||||
|
setproctitle==1.2.2
|
||||||
|
simplejson==3.18.3
|
||||||
|
six==1.16.0
|
||||||
|
sklearn==0.0.post1
|
||||||
|
soupsieve==2.3.1
|
||||||
|
ssh-import-id==5.11
|
||||||
|
systemd-python==234
|
||||||
|
texttable==1.6.4
|
||||||
|
ubuntu-advantage-tools==8001
|
||||||
|
ubuntu-drivers-common==0.0.0
|
||||||
|
ufw==0.36.1
|
||||||
|
urllib3==1.26.5
|
||||||
|
urwid==2.1.2
|
||||||
|
wadllib==1.3.6
|
||||||
|
waitress==2.1.2
|
||||||
|
webencodings==0.5.1
|
||||||
|
websocket-client==1.2.3
|
||||||
|
Werkzeug==2.2.2
|
||||||
|
x2go==0.6.1.3
|
||||||
|
xdg==5
|
||||||
|
xkit==0.0.0
|
||||||
|
zipp==3.12.1
|
||||||
|
zope.event==4.4
|
||||||
|
zope.interface==5.4.0
|
9
start_conect.bat
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
cd "C:\Users\USUARIO\Desktop\connect_2022_1"
|
||||||
|
start chrome "192.168.100.10"
|
||||||
|
start cmd "C:\Users\USUARIO\Desktop\connect_2022_1"
|
||||||
|
:retorno
|
||||||
|
python connect.py
|
||||||
|
timeout /t 5 /nobreak
|
||||||
|
cls
|
||||||
|
goto retorno
|
||||||
|
|
BIN
static/alerta.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
625
static/arquivo.html
Normal file
BIN
static/back.png
Normal file
BIN
static/button_delete_blue.png
Normal file
After Width: | Height: | Size: 5.1 KiB |
BIN
static/class.png
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
static/comentario.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
131
static/css.css
Normal file
BIN
static/delete1.png
Normal file
After Width: | Height: | Size: 741 B |
BIN
static/email_blue.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
static/group (1).png
Normal file
After Width: | Height: | Size: 4.4 KiB |
BIN
static/group.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
static/icone.ico
Normal file
After Width: | Height: | Size: 66 KiB |
BIN
static/icone1.ico
Normal file
After Width: | Height: | Size: 9.4 KiB |
8
static/js_after.js
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
async function close_msg_box_ok() {
|
||||||
|
document.getElementById("msg_box_windows").style.display = "none";
|
||||||
|
document.getElementById("msg_box_windows_back").style.display = "none";
|
||||||
|
}
|
||||||
|
async function show_msg_box_ok() {
|
||||||
|
document.getElementById("msg_box_windows").style.display = "block";
|
||||||
|
document.getElementById("msg_box_windows_back").style.display = "block";
|
||||||
|
}
|
BIN
static/lesson.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
static/ok.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
static/participa.png
Normal file
After Width: | Height: | Size: 3.4 KiB |
BIN
static/participa1.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
static/people (1).png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
static/people.png
Normal file
After Width: | Height: | Size: 3.4 KiB |
45
static/relatorio.html
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
|
||||||
|
var ano_agora = new Date().getFullYear();
|
||||||
|
var mes_agora = new Date().getMonth();
|
||||||
|
var ano_semestre = ""
|
||||||
|
|
||||||
|
if(mes_agora<7){
|
||||||
|
select_ano_sem = ano_agora.toString() + "-1";
|
||||||
|
}else{
|
||||||
|
select_ano_sem = ano_agora.toString() + "-2";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
google.charts.load('current', {'packages':['bar']});
|
||||||
|
google.charts.setOnLoadCallback(drawChart);
|
||||||
|
|
||||||
|
function drawChart() {
|
||||||
|
var data = google.visualization.arrayToDataTable([
|
||||||
|
['Year', 'OK', 'ALERTA', 'PARTICIPA'],
|
||||||
|
[select_ano_sem, [OK], [ALERTA], [PARTICIPA]]
|
||||||
|
]);
|
||||||
|
|
||||||
|
var options = {
|
||||||
|
chart: {
|
||||||
|
title: '[TITULO]',
|
||||||
|
subtitle: '[CONTAGENS]',
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var chart = new google.charts.Bar(document.getElementById('columnchart_material'));
|
||||||
|
|
||||||
|
chart.draw(data, google.charts.Bar.convertOptions(options));
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="columnchart_material" style="width: 70%; height: 70%;"></div>
|
||||||
|
</body>
|
||||||
|
</html>
|
BIN
static/stats.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
static/teacher.png
Normal file
After Width: | Height: | Size: 3.5 KiB |
BIN
static/team (1).png
Normal file
After Width: | Height: | Size: 4.2 KiB |
BIN
static/team (2).png
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
static/team.png
Normal file
After Width: | Height: | Size: 4.4 KiB |