Skip to content

Commit

Permalink
Merge pull request #59 from GabrielSirtoriCorrea/AtualizandoDiretorios
Browse files Browse the repository at this point in the history
AtualizandoDiretorios
  • Loading branch information
GabrielSirtoriCorrea authored Aug 4, 2020
2 parents f718448 + ffac8b1 commit 76ce69b
Show file tree
Hide file tree
Showing 18 changed files with 42 additions and 30 deletions.
4 changes: 2 additions & 2 deletions Configurations.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"FridayConfigs": {
"ID": "Sexta-Feira",
"ServerHost": "192.168.0.5",
"ServerHost": "localhost",
"Port": 5000
},
"ServerConfigs": {
"ID": "Server",
"Host": "192.168.0.5",
"Host": "localhost",
"Port": 5000
}
}
4 changes: 1 addition & 3 deletions Server/DevicesStatus.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
{
"Friday": {
"action": 0,
"content": {},
"action": 1,
"url": ".com"
},
"Interface": {
"action": 2,
"content": {},
"url": ".com"
}
}
21 changes: 10 additions & 11 deletions Server/Server.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ def convertHeader(header):
return dictionary

def getDevicesStatus():
file = open('E:/Sexta-Feira-Mark_6/Server/DevicesStatus.json', 'r')
file = open('./Server/DevicesStatus.json', 'r')
return json.load(file)

def setDevicesStatus(receiverID, action, url):
readFile = open('E:/Sexta-Feira-Mark_6/Server/DevicesStatus.json', 'r')
readFile = open('./Server/DevicesStatus.json', 'r')

newJson = json.load(readFile)

Expand All @@ -45,7 +45,7 @@ def setDevicesStatus(receiverID, action, url):
newJson[receiverID]['action'] = action
newJson[receiverID]['url'] = url

writeFile = open('E:/Sexta-Feira-Mark_6/Server/DevicesStatus.json', 'w')
writeFile = open('./Server/DevicesStatus.json', 'w')
json.dump(newJson, writeFile, indent=4)

class ClientManage(socketserver.BaseRequestHandler):
Expand All @@ -66,7 +66,7 @@ def handle(self):
if clientRequest['header'] == 'gazeboindustries09082004':

if clientRequest['request'] == 'startFriday':
os.startfile('E:\\Sexta-Feira-Mark_6\\Sexta-FeiraInterface\\dist\\Sexta-FeiraInterface.jar')
setDevicesStatus('Friday', 1, '.com')
self.request.send(json.dumps({'requestStatus': True}).encode())

elif clientRequest['request'] == 'getDevices':
Expand Down Expand Up @@ -124,15 +124,14 @@ def handle(self):
clientRequest['description'],
clientRequest['actions'])

readFile = open('E:/Sexta-Feira-Mark_6/Server/DevicesStatus.json', 'r')
readFile = open('./Server/DevicesStatus.json', 'r')

newJson = json.load(readFile)

print(newJson)

newJson[clientRequest['device']] = {'action': 0, 'url': '.com'}

writeFile = open('E:/Sexta-Feira-Mark_6/Server/DevicesStatus.json', 'w')
writeFile = open('./Server/DevicesStatus.json', 'w')
json.dump(newJson, writeFile, indent=4)

self.request.send(json.dumps({'requestStatus': True}).encode())
Expand Down Expand Up @@ -161,15 +160,15 @@ def handle(self):
elif clientRequest['request'] == 'deleteDevice':
dataBaseConnection.deleteDevice(clientRequest['deleteId'])

readFile = open('E:/Sexta-Feira-Mark_6/Server/DevicesStatus.json', 'r')
readFile = open('./Server/DevicesStatus.json', 'r')

newJson = json.load(readFile)

print(newJson)

del newJson[clientRequest['deleteName']]

writeFile = open('E:/Sexta-Feira-Mark_6/Server/DevicesStatus.json', 'w')
writeFile = open('./Server/DevicesStatus.json', 'w')
json.dump(newJson, writeFile, indent=4)

self.request.send(json.dumps({'requestStatus': True}).encode())
Expand Down Expand Up @@ -197,7 +196,7 @@ def handle(self):
clientRequest['description'],
clientRequest['actions'])

readFile = open('E:/Sexta-Feira-Mark_6/Server/DevicesStatus.json', 'r')
readFile = open('./Server/DevicesStatus.json', 'r')

newJson = json.load(readFile)

Expand All @@ -207,7 +206,7 @@ def handle(self):

newJson[clientRequest['device']] = {'action': 0, 'url': '.com'}

writeFile = open('E:/Sexta-Feira-Mark_6/Server/DevicesStatus.json', 'w')
writeFile = open('./Server/DevicesStatus.json', 'w')
json.dump(newJson, writeFile, indent=4)

self.request.send(json.dumps({'requestStatus': True}).encode())
Expand Down
12 changes: 12 additions & 0 deletions Sexta-Feira(A.I.)/BackgroundListening.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from Functions import ServerConnection, setRequestJson
import os

connection = ServerConnection()

while True:
response = connection.send(setRequestJson('getDevicesStatus', 'Server', 0, '.com'))

if response['Friday']['action'] == 1:
os.startfile(os.getcwd().replace('Sexta-Feira(A.I.)', '') + 'Sexta-FeiraInterface/dist/Sexta-FeiraInterface.jar')
print('Started')
break
13 changes: 8 additions & 5 deletions Sexta-Feira(A.I.)/Commands.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import Functions, os
from datetime import datetime

def getDirectory(path):
return os.getcwd().replace('Sexta-FeiraInterface', '') + path

def callCommand(command, speech, connection):
commands = globals()

Expand Down Expand Up @@ -38,17 +41,17 @@ def sendDevicesToInterface(speech, connection):
Functions.setFridayComunication(4, response, ".com")

def sendPeriodicTableToInterface(speech, connection):
Functions.setFridayComunication(5, None, 'E:/Sexta-Feira-Mark_6/Images/TabelaPeriodica.jpg')
Functions.setFridayComunication(5, None, getDirectory('Images\TabelaPeriodica.jpg'))

def sendPoliticalBrazilToInterface(speech, connection):
Functions.setFridayComunication(5, None, 'E:/Sexta-Feira-Mark_6/Images/Brasil Político.jpg')
Functions.setFridayComunication(5, None, getDirectory('Images\Brasil Político.jpg'))

def sendEletronicDestToInterface(speech, connection):
Functions.setFridayComunication(5, None, 'E:/Sexta-Feira-Mark_6/Images/diagrama-de-pauling.jpg')
Functions.setFridayComunication(5, None, getDirectory('Images\diagrama-de-pauling.jpg'))

def sendAnglesTableToInterface(speech, connection):
Functions.setFridayComunication(5, None, 'E:/Sexta-Feira-Mark_6/Images/TabelaSenoCossenoTangente.png')
Functions.setFridayComunication(5, None, getDirectory('Images\TabelaSenoCossenoTangente.png'))

def sendFisicEquationsToInterface(speech, connection):
Functions.setFridayComunication(5, None, 'E:/Sexta-Feira-Mark_6/Images/Equações Dinamica.png')
Functions.setFridayComunication(5, None, getDirectory('Images\Equações Dinamica.png'))

2 changes: 1 addition & 1 deletion Sexta-Feira(A.I.)/Functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def setup():
class ServerConnection:
def __init__(self):
try:
file = open('E:/Sexta-Feira-Mark_6/Configurations.json', 'r')
file = open('/Sexta-Feira-Mark_6/Configurations.json', 'r')
configs = json.load(file)['FridayConfigs']

self.connection = socket(AF_INET, SOCK_STREAM, 0)
Expand Down
Binary file modified Sexta-Feira(A.I.)/__pycache__/Commands.cpython-36.pyc
Binary file not shown.
Binary file modified Sexta-Feira(A.I.)/__pycache__/Functions.cpython-36.pyc
Binary file not shown.
2 changes: 1 addition & 1 deletion Sexta-FeiraInterface/build/built-jar.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Wed, 29 Jul 2020 19:55:41 -0300
#Mon, 03 Aug 2020 21:17:22 -0300


E\:\\Sexta-Feira-Mark_6\\Sexta-FeiraInterface=
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"action": 5,
"content": null,
"url": "E:/Sexta-Feira-Mark_6/Images/Brasil Pol\u00edtico.jpg"
"url": "E:\\Sexta-Feira-Mark_6\\/Images/TabelaPeriodica.jpg"
}
Binary file not shown.
4 changes: 2 additions & 2 deletions Sexta-FeiraInterface/dist/Sexta-FeiraInterface.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
function launchApplication(jnlpfile) {
dtjava.launch( {
url : 'Sexta-FeiraInterface.jnlp',
jnlp_content : 'PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjxqbmxwIHNwZWM9IjEuMCIgeG1sbnM6amZ4PSJodHRwOi8vamF2YWZ4LmNvbSIgaHJlZj0iU2V4dGEtRmVpcmFJbnRlcmZhY2Uuam5scCI+DQogIDxpbmZvcm1hdGlvbj4NCiAgICA8dGl0bGU+U2V4dGEtRmVpcmFJbnRlcmZhY2U8L3RpdGxlPg0KICAgIDx2ZW5kb3I+R2F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},
{
javafx : '8.0+'
Expand All @@ -24,7 +24,7 @@
placeholder : 'javafx-app-placeholder',
width : '800',
height : '600',
jnlp_content : 'PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjxqbmxwIHNwZWM9IjEuMCIgeG1sbnM6amZ4PSJodHRwOi8vamF2YWZ4LmNvbSIgaHJlZj0iU2V4dGEtRmVpcmFJbnRlcmZhY2Uuam5scCI+DQogIDxpbmZvcm1hdGlvbj4NCiAgICA8dGl0bGU+U2V4dGEtRmVpcmFJbnRlcmZhY2U8L3RpdGxlPg0KICAgIDx2ZW5kb3I+R2F6ZWJvPC92ZW5kb3I+DQogICAgPGRlc2NyaXB0aW9uPm51bGw8L2Rlc2NyaXB0aW9uPg0KICAgIDxvZmZsaW5lLWFsbG93ZWQvPg0KICA8L2luZm9ybWF0aW9uPg0KICA8cmVzb3VyY2VzPg0KICAgIDxqMnNlIHZlcnNpb249IjEuNisiIGhyZWY9Imh0dHA6Ly9qYXZhLnN1bi5jb20vcHJvZHVjdHMvYXV0b2RsL2oyc2UiLz4NCiAgICA8amFyIGhyZWY9IlNleHRhLUZlaXJhSW50ZXJmYWNlLmphciIgc2l6ZT0iMTA3MTQ1IiBkb3dubG9hZD0iZWFnZXIiIC8+DQogICAgPGphciBocmVmPSJsaWJcanNvbi1zaW1wbGUtMS4xLmphciIgc2l6ZT0iMTYwNDYiIGRvd25sb2FkPSJlYWdlciIgLz4NCiAgPC9yZXNvdXJjZXM+DQogIDxhcHBsZXQtZGVzYyAgd2lkdGg9IjgwMCIgaGVpZ2h0PSI2MDAiIG1haW4tY2xhc3M9ImNvbS5qYXZhZngubWFpbi5Ob0phdmFGWEZhbGxiYWNrIiAgbmFtZT0iU2V4dGEtRmVpcmFJbnRlcmZhY2UiID4NCiAgICA8cGFyYW0gbmFtZT0icmVxdWlyZWRGWFZlcnNpb24iIHZhbHVlPSI4LjArIi8+DQogIDwvYXBwbGV0LWRlc2M+DQogIDxqZng6am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iU2V4dGEtRmVpcmFJbnRlcmZhY2UiID4NCiAgICA8cGFyYW0gbmFtZT0icmVxdWlyZWRGWFZlcnNpb24iIHZhbHVlPSI4LjArIi8+DQogIDwvYXBwbGV0LWRlc2M+DQogIDxqZng6amF2YWZ4LWRlc2MgIHdpZHRoPSI4MDAiIGhlaWdodD0iNjAwIiBtYWluLWNsYXNzPSJjb20uZnJpZGF5LlNleHRhRmVpcmFJbnRlcmZhY2UiICBuYW1lPSJTZXh0YS1GZWlyYUludGVyZmFjZSIgLz4NCiAgPHVwZGF0ZSBjaGVjaz0iYWx3YXlzIi8+DQo8L2pubHA+DQo='
},
{
javafx : '8.0+'
Expand Down
Binary file modified Sexta-FeiraInterface/dist/Sexta-FeiraInterface.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion Sexta-FeiraInterface/dist/Sexta-FeiraInterface.jnlp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</information>
<resources>
<j2se version="1.6+" href="http://java.sun.com/products/autodl/j2se"/>
<jar href="Sexta-FeiraInterface.jar" size="107145" download="eager" />
<jar href="Sexta-FeiraInterface.jar" size="107113" download="eager" />
<jar href="lib\json-simple-1.1.jar" size="16046" download="eager" />
</resources>
<applet-desc width="800" height="600" main-class="com.javafx.main.NoJavaFXFallback" name="Sexta-FeiraInterface" >
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public static JSONObject readJsonFile() {
parser = new JSONParser();

try {
jsonObject = (JSONObject) parser.parse(new FileReader("E:\\Sexta-Feira-Mark_6\\Sexta-FeiraInterface\\src\\com\\friday\\FridayComunication.json"));
jsonObject = (JSONObject) parser.parse(new FileReader(".\\src\\com\\friday\\FridayComunication.json"));
} catch (ParseException | IOException e) {
e.printStackTrace();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"action": 5,
"content": null,
"url": "E:/Sexta-Feira-Mark_6/Images/Brasil Pol\u00edtico.jpg"
"url": "E:\\Sexta-Feira-Mark_6\\Images\\TabelaPeriodica.jpg"
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class SextaFeiraInterface extends Application {

@Override
public void start(Stage stage) throws Exception {
Runtime.getRuntime().exec("cmd.exe /c start E:\\Sexta-Feira-Mark_6\\Sexta-Feira(A.I.)\\Sexta-Feira(A.I.).py");
Runtime.getRuntime().exec("cmd.exe /c start \\Sexta-Feira-Mark_6\\Sexta-Feira(A.I.)\\Sexta-Feira(A.I.).py");

Parent root = FXMLLoader.load(getClass().getResource("Scene.fxml"));

Expand Down

0 comments on commit 76ce69b

Please sign in to comment.