From 8123de824e68aa652e73cf145a837f5d6c16abcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Omar=20S=C3=A1nchez=20Pizarro?= Date: Thu, 4 Sep 2025 14:13:57 +0200 Subject: [PATCH] fixes y calendario de google holidays desactivado MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Omar Sánchez Pizarro --- .gitignore | 1 + app/arg_parser.py | 2 ++ app/google_calendar.py | 11 ++++++----- app/timenet_manager.py | 5 +++-- requirements.txt | 2 +- 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index e645d49..bf9a65d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ config.json googleoauth.json app/__pycache__ +venv diff --git a/app/arg_parser.py b/app/arg_parser.py index 4b6857d..268fc59 100644 --- a/app/arg_parser.py +++ b/app/arg_parser.py @@ -18,6 +18,8 @@ class ArgParser: optionalArgs.add_argument('-h', '--help', action="help", help="Esta ayuda") optionalArgs.add_argument('-d', '--debug', action='store_true') + optionalArgs.add_argument('-f', '--force', action='store_true') + optionalArgs.add_argument('-c', '--config', help="Rúta al archivo de configuración") optionalArgs.add_argument('-u', '--user', help="Usuario") optionalArgs.add_argument('-glo', '--geoLongitude', help="GEO Longitud", type=float) diff --git a/app/google_calendar.py b/app/google_calendar.py index cd69a59..99f3093 100644 --- a/app/google_calendar.py +++ b/app/google_calendar.py @@ -95,12 +95,13 @@ class GoogleCalendar: if event['organizer']['displayName'] == 'autoficher': return 'Forzado desde autoficher - ' + event.get("summary", "Sin Título") - if 'description' in event and ("Cataluña" in event['description'] or 'Día festivo' in event[ - 'description'] or 'Celebración\n' in event['description']) and not 'Cambio de horario' in event[ - 'summary']: - return event['summary'] + #Desactivado por que no funcionaba muy bien ese calendario... se han puesto en el calendario autoficher los dias festivos correctos + #if 'description' in event and ("Cataluña" in event['description'] or 'Día festivo' in event[ + # 'description'] or 'Celebración\n' in event['description']) and not 'Cambio de horario' in event[ + # 'summary']: + # return event['summary'] except HttpError as error: print(f'An error occurred: {error}') return 'Error de llama a Google Calendar' - return False \ No newline at end of file + return False diff --git a/app/timenet_manager.py b/app/timenet_manager.py index c49b983..27a55f3 100644 --- a/app/timenet_manager.py +++ b/app/timenet_manager.py @@ -75,8 +75,9 @@ class timenetManager: calendar = google_calendar.GoogleCalendar() calendar = calendar.getEvent() - if calendar: + if calendar and not args.force: self.addMessage("🟥🕐 Comprobación de calendario: " + calendar) + self.sendReport() return typ = 0 @@ -129,7 +130,7 @@ class timenetManager: try: rj = json.loads(response.text) except: - self.addMessage("La respuesta al hacer check no es correcta... algo ha pasado :/") + self.addMessage("La respuesta al hacer check no es correcta... algo ha pasado :/ - %s" % (response.text)) self.sendReport() exit(20) diff --git a/requirements.txt b/requirements.txt index 1039ffd..87aa9c0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,4 +3,4 @@ pytz google-api-python-client google-auth-httplib2 google-auth-oauthlib -dateutil \ No newline at end of file +