I have got something that might interrests you if you have some complex schedules, or just want some easy controls of your schedules.
It's like a plugin, but it isn't !
It's a python script that runs when needed (you don't need to call it, it will start by itself - or something like that). This python script triggers events in EG according to what is stored in your Google Calendar(s). The main benefits compared to a "local scheduler" are :
- Google Calendars can be accessed in many ways. For exemple, if you have a modern smartphone, you can probably update your google Calendar from anywhere. You will get those changes in EG as soon as you have saved them in Google Calendar. Same thing for your computer at work, the one of your wife, ...
- A lot of ready to use Google Calendars already exists. You just have to pick them to get that schedule into EG. For example vacations, birthdays, ... for more complex calendars like sunrise/sunset, if you can get those data into excel, you can import them in google calendar.
If you don't want to read this long post, and just want to see ... here is the minimum you need to have it working :
1 - connect to your Google Calendar, open its settings and click the orange "xml" button which is at the bottom of the setting page. it's the private URL of your calendar. a popup should appear with something like this in it :
"http://www.google.com/calendar/feeds/ut6pmckl45mb8p4q8mf1dofriss%40group.calendar.google.com/private-3ae2397c29b9f36795be25b460e83d2c/basic" : Copy this URL to your clipboard. You can read more accurate instructions on how to get this URL by reading this : http://code.google.com/intl/fr/apis/cal ... agicCookie
2 - while you are into your Google calendar, create a test event that starts now and ends in a few hours, or less, it's up to you !
3 - get the attached gCal.xml file and load it into EG
4 - in EG, edit the "Watch gCal" python script which is in the autostart folder.
5 - goto the end of the script where you will find some eg.globals vars
6 - replace the eg.globals.gCal_privateURLs.append('blabla') with the url in your clipboard
7 - in this URL, replace the final "/basic" with "/full"
8 - if you need some proxy settings to connect to the internet, uncomment "SetUpProxy()" in "def WatchGCal():" and put your settings in "def SetUpProxy():"
9 - click OK
10 - right click "Watch gCal" and "enable Item"
11 - right click "Watch gCal" and "execute Item"
If there is an event currently running in your gCal, EG will trigger a corresponding event.
If there is no event at this time in your gCal, create one (see instruction 2 !), and EG will trigger an event in five minutes max.
More details :
The script runs at a specified interval time (default = 300s = 5 mins = eg.globals.gCal_checkEvery).
When it runs, it requests from Google the entries in your calendar that ends or start after now and before now + the interval time.
Google returns an XML feed that describes each entries that match the search query.
Those entries are saved locally if they are current (startTime<now and endTime>now) in eg.globals.gCal_currentEvents
If one entry is already in eg.globals.gCal_currentEvents, we do nothing
if one entry isn't in eg.globals.gCal_currentEvents, we add it and ask EG to trigger an event for the start of this entry
if entry is in eg.globals.gCal_currentEvents but not in the results returned by Google, we remove it and ask EG to trigger an event for the end of this entry.
For the entries that are not current (that starts after now, but before now + the interval time), we use them to compute the next check date (when we will connect again to Google).
It means that you will always get events from EG at the exact time the entries are stored in your Google calendar.
The only exception is if you modify an entry and schedule it within the current interval time.
The current entries are stored in eg.globals.gCal_currentEvents.
It's a python dictionary. The keys of this dictionary is "gCalTitle.entryTitle". If you don't know what I mean, put some events that runs now in Google, execute the python script. then create and run a new python script with this inside
- Code: Select all
So you can get an entry with
- Code: Select all
each entry in gCal_currentEvents is also a python dict. The keys are the attributes of the entry. here are a few examples :
- Code: Select all
startTime and endTime are struct_time in localTime : http://docs.python.org/library/time.html
You can get more informations on how this all works from Google :
http://code.google.com/intl/fr/apis/cal ... Parameters
http://code.google.com/intl/fr/apis/gda ... ml#Queries
http://code.google.com/intl/fr/apis/cal ... agicCookie
Of course, this python script might not fit your exact needs, but I think you have all the functions needed to get any information from Google Calendar services.
As an example, if you need to get only future events from a Google Calendar you can create a function GetGCalFutureEventsXML from GetGCalEventsByDateXML.
You will just need to modify the parameters passed to google in the query URL. If you visit this http://code.google.com/intl/fr/apis/cal ... Parameters, you will see that you just need to replace start-min and start-max with futureevents=true (and it might also be a good idea to set max-results). You will then need to parse the returned events and check if one or more events are current (because google consider that an event that start before now and ends after now is a futureevent). If it's current, then don't keep it ...
Finally, I am too impatient to share this code with you ! So, it hasn't been extensively tested. I don't really know what will happen if you loose your internet connection, or if Google returns a bad response (like service temporary unavailable). But I am sure we will be able to check this shortly !
Comments are welcome.