fixes y calendario de google holidays desactivado

Signed-off-by: Omar Sánchez Pizarro <admin@pribyte.cloud>
This commit is contained in:
2025-09-04 14:13:57 +02:00
parent e9ec438183
commit 8123de824e
5 changed files with 13 additions and 8 deletions

1
.gitignore vendored
View File

@@ -1,3 +1,4 @@
config.json config.json
googleoauth.json googleoauth.json
app/__pycache__ app/__pycache__
venv

View File

@@ -18,6 +18,8 @@ class ArgParser:
optionalArgs.add_argument('-h', '--help', action="help", help="Esta ayuda") optionalArgs.add_argument('-h', '--help', action="help", help="Esta ayuda")
optionalArgs.add_argument('-d', '--debug', action='store_true') 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('-c', '--config', help="Rúta al archivo de configuración")
optionalArgs.add_argument('-u', '--user', help="Usuario") optionalArgs.add_argument('-u', '--user', help="Usuario")
optionalArgs.add_argument('-glo', '--geoLongitude', help="GEO Longitud", type=float) optionalArgs.add_argument('-glo', '--geoLongitude', help="GEO Longitud", type=float)

View File

@@ -95,12 +95,13 @@ class GoogleCalendar:
if event['organizer']['displayName'] == 'autoficher': if event['organizer']['displayName'] == 'autoficher':
return 'Forzado desde autoficher - ' + event.get("summary", "Sin Título") 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[ #Desactivado por que no funcionaba muy bien ese calendario... se han puesto en el calendario autoficher los dias festivos correctos
'description'] or 'Celebración\n' in event['description']) and not 'Cambio de horario' in event[ #if 'description' in event and ("Cataluña" in event['description'] or 'Día festivo' in event[
'summary']: # 'description'] or 'Celebración\n' in event['description']) and not 'Cambio de horario' in event[
return event['summary'] # 'summary']:
# return event['summary']
except HttpError as error: except HttpError as error:
print(f'An error occurred: {error}') print(f'An error occurred: {error}')
return 'Error de llama a Google Calendar' return 'Error de llama a Google Calendar'
return False return False

View File

@@ -75,8 +75,9 @@ class timenetManager:
calendar = google_calendar.GoogleCalendar() calendar = google_calendar.GoogleCalendar()
calendar = calendar.getEvent() calendar = calendar.getEvent()
if calendar: if calendar and not args.force:
self.addMessage("🟥🕐 Comprobación de calendario: " + calendar) self.addMessage("🟥🕐 Comprobación de calendario: " + calendar)
self.sendReport()
return return
typ = 0 typ = 0
@@ -129,7 +130,7 @@ class timenetManager:
try: try:
rj = json.loads(response.text) rj = json.loads(response.text)
except: 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() self.sendReport()
exit(20) exit(20)

View File

@@ -3,4 +3,4 @@ pytz
google-api-python-client google-api-python-client
google-auth-httplib2 google-auth-httplib2
google-auth-oauthlib google-auth-oauthlib
dateutil