Skip to content
Browse files

Merge branch 'fix_all_day_events' of https://github.com/ndbroadbent/G…

…CalCron2 into ndbroadbent-fix_all_day_events

Conflicts:
	gcalcron2.py
  • Loading branch information...
2 parents c365b9b + 7231acb commit 9b3f2585b283f3dd15f98441aeada972c064e9ed @fabriceb fabriceb committed
Showing with 5 additions and 12 deletions.
  1. +3 −3 README.md
  2. +2 −9 gcalcron2.py
View
6 README.md
@@ -34,10 +34,10 @@ See http://www.pfspear.net/projects/gcalcron for his first version.
## Install ##
-GcalCron2 requires the `python-gdata` package:
+GcalCron2 depends on a few python libraries:
-* Install on Ubuntu, Debian, etc. : `sudo apt-get install python-gdata`
-* Install on Fedora, CentOS, etc. : `sudo yum install python-gdata`
+* Install on Ubuntu, Debian, etc. : `sudo apt-get install python-gdata python-dateutil`
+* Install on Fedora, CentOS, etc. : `sudo yum install python-gdata python-dateutil`
Clone the GcalCron2 repository:
View
11 gcalcron2.py
@@ -13,6 +13,7 @@
import stat
import json
import datetime
+import dateutil.parser
import time
import subprocess
import re
@@ -128,7 +129,7 @@ def get_events(self, last_sync = None, num_days = datetime.timedelta(days=7)):
events = []
for i, event in zip(xrange(len(entries)), entries):
- event_time = utc_to_local(iso_to_datetime(event.when[0].start_time))
+ event_time = utc_to_local(dateutil.parser.parse(event.when[0].start_time)).replace (tzinfo = None)
event_id = event.id.text
if DEBUG: print event_id, '-', event.event_status.value, '-', event.updated.text, ': ', event.title.text, event_time, ' (', event.when[0].start_time, ') ', '=>', event.content.text
if event.event_status.value == 'CANCELED':
@@ -313,14 +314,6 @@ def utc_to_local(dt):
return dt - datetime.timedelta(seconds=time.altzone)
-def iso_to_datetime(iso):
- """
- >>> iso_to_datetime('2011-06-18T12:00:00')
- datetime.datetime(2011, 6, 18, 12, 0)
- """
- return datetime.datetime.strptime(iso[:16], '%Y-%m-%dT%H:%M')
-
-
def datetime_to_at(dt):
"""
>>> datetime_to_at(datetime.datetime(2011, 6, 18, 12, 0))

0 comments on commit 9b3f258

Please sign in to comment.
Something went wrong with that request. Please try again.