From 606f5152152b08038d7a82855001cb4740a6457e Mon Sep 17 00:00:00 2001 From: AlonsoDiCandia Date: Wed, 20 Mar 2024 15:25:13 -0300 Subject: [PATCH] Updating ejecucion_script --- GenPoster/getData.py | 20 +++++++++++++------- ejecucion_script.sh | 12 ++++++++++-- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/GenPoster/getData.py b/GenPoster/getData.py index 4dd6e43..036c606 100644 --- a/GenPoster/getData.py +++ b/GenPoster/getData.py @@ -12,7 +12,7 @@ class Paradero: # Autentificación data self.url_auth = 'https://transporte.hz.kursor.cl/api/auth/' - self.username = "usuario1" + self.rut = "11111111-1" self.password = "usuario1" # Token obtenido luego del 'login' @@ -27,7 +27,7 @@ class Paradero: def __get_token(self): auth = '''{ - "username": "usuario1", + "rut": "11111111-1", "password": "usuario1" }''' @@ -59,6 +59,7 @@ class Paradero: response = requests.post(self.url_getinfodevice, json=data_getinfodevice, headers=headers_getinfodevice) self.data = self.__serialize_data(response) + print(self.data) return self.data def __generate_bus_list(self, info): @@ -79,25 +80,30 @@ class Paradero: bus_info["letter_background_color"] = data["colorTexto"] bus_info["patente"] = data["Llegadas"][0]["patente"] bus_hour = datetime.strptime(bus_info["timeLabel"], "%H:%M:%S").time().hour if datetime.strptime(bus_info["timeLabel"], "%H:%M:%S").time().hour != 0 else 24 - print(bus_hour, hora_actual_santiago.hour) + # print(bus_hour, hora_actual_santiago.hour) diff = timedelta( hours = bus_hour - hora_actual_santiago.hour, minutes = datetime.strptime(bus_info["timeLabel"], "%H:%M:%S").time().minute - hora_actual_santiago.minute, seconds=datetime.strptime(bus_info["timeLabel"], "%H:%M:%S").time().second - hora_actual_santiago.second ) - print(diff.total_seconds()) + # print(diff.total_seconds()) bus_info["timeRemaining"] = int(abs(diff.total_seconds() // 60)) data_main.append(bus_info) data_main = sorted(data_main, key=lambda x: x['timeRemaining']) self.bus_list = data_main - for d in data_main: - print(d['timeRemaining'], d['timeLabel']) + # for d in data_main: + # print(d['timeRemaining'], d['timeLabel']) def __serialize_data(self, response): data = response.json() self.__generate_bus_list(data) data = self.bus_list[:2] - return data \ No newline at end of file + return data + + +bus_stop = Paradero() + +data = bus_stop.get_data() \ No newline at end of file diff --git a/ejecucion_script.sh b/ejecucion_script.sh index f467ae1..1c5871e 100644 --- a/ejecucion_script.sh +++ b/ejecucion_script.sh @@ -19,7 +19,10 @@ sudo apt-get install python3-dev python3-pillow -y > /dev/null 2>&1 verificar_codigo_retorno $? echo -n "Entrando al repositorio " -cd $HOME/rpi-rgb-led-matrix/bindings/python +# Pedir al usuario que ingrese un valor +echo "Usuario:" +read valor +cd /home/$valor/rpi-rgb-led-matrix/bindings/python # Verificar el código de retorno llamando a la función verificar_codigo_retorno $? @@ -32,12 +35,17 @@ sudo make install-python PYTHON=$(command -v python3) > /dev/null 2>&1 verificar_codigo_retorno $? echo -n "Clonando repositorio FIC " -cd $HOME +cd /home/$valor/ git clone https://github.com/diegoalrv/pantallas-led > /dev/null 2>&1 cd pantallas-led # Verificar el código de retorno llamando a la función verificar_codigo_retorno $? +echo -n "Instalando docker" +curl -fsSL https://get.docker.com -o get-docker.sh +sh ./get-docker.sh > /dev/null 2>&1 + +verificar_codigo_retorno $?