57 lines
1.1 KiB
Python
57 lines
1.1 KiB
Python
#!/usr/bin/python
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# ce programme interroge l agenda google et renvoie les taches du jour
|
|
# dans un fichier texte
|
|
|
|
|
|
import time
|
|
import os
|
|
|
|
|
|
############# Parametres #################################
|
|
# on utilise gcalcli qui doit etre installe
|
|
|
|
|
|
# Nom du calendrier google qui contient les actions Domoticz
|
|
domoticz_cal="Domoticz"
|
|
|
|
#options de la ligne de commande cf doc google
|
|
options="--tsv --military"
|
|
agenda_start="00:00"
|
|
agenda_end="23:59"
|
|
|
|
# fichier et chemin pour agenda
|
|
rep="/var/tmp/"
|
|
file="googlecal.txt"
|
|
|
|
|
|
#debug = 1 on affiche les chaines de caracteres recues
|
|
debug=1
|
|
|
|
|
|
|
|
# fin du parametrage #
|
|
|
|
|
|
############### fin des parametres #############################
|
|
|
|
|
|
datej=time.strftime('%Y%m%d',time.localtime())
|
|
#gcalcli --cal=Domoticz agenda '20141230T00:00' '20141230T23:59" --tsv --military
|
|
lignecde="gcalcli --cal="+domoticz_cal+" agenda "+"'"+datej+"T"+agenda_start+"' '"+datej+"T"+agenda_end+"' "+options
|
|
lignecde=lignecde+" > "+rep+file
|
|
|
|
if debug!=0:
|
|
print datej
|
|
print lignecde
|
|
|
|
os.system(lignecde)
|
|
|
|
|
|
if debug!=0:
|
|
print datej
|
|
print lignecde
|
|
os.system ('cat /var/tmp/googlecal.txt')
|
|
|