1 |
dirtyepic 11/02/21 11:11:46 |
2 |
|
3 |
Added: |
4 |
libopensync-plugin-google-calendar-0.22-recurrent.patch |
5 |
Log: |
6 |
Fix dependencies (including bug #247268), add patch for recurrent calendar |
7 |
entries (bug #185475). Port to EAPI 3 and various QA fixes. |
8 |
|
9 |
(Portage version: 2.2.0_alpha24/cvs/Linux x86_64) |
10 |
|
11 |
Revision Changes Path |
12 |
1.1 app-pda/libopensync-plugin-google-calendar/files/libopensync-plugin-google-calendar-0.22-recurrent.patch |
13 |
|
14 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-pda/libopensync-plugin-google-calendar/files/libopensync-plugin-google-calendar-0.22-recurrent.patch?rev=1.1&view=markup |
15 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-pda/libopensync-plugin-google-calendar/files/libopensync-plugin-google-calendar-0.22-recurrent.patch?rev=1.1&content-type=text/plain |
16 |
|
17 |
Index: libopensync-plugin-google-calendar-0.22-recurrent.patch |
18 |
=================================================================== |
19 |
http://bugs.gentoo.org/185475 |
20 |
http://www.opensync.org/changeset/1898 |
21 |
|
22 |
--- a/src/google-cal-helper.py |
23 |
+++ b/src/google-cal-helper.py |
24 |
@@ -138,6 +138,41 @@ def xsdateToOsync(s): |
25 |
sys.stderr.write("xs to osync: %s => %s\n" % (s, r)) |
26 |
return r |
27 |
|
28 |
+GDEND_RE = re.compile("DTEND;[^:]*:(\S+)") |
29 |
+def gdRecurToEnd(recur): |
30 |
+ m = GDEND_RE.search(recur) |
31 |
+ if m is None: |
32 |
+ raise DateConversionError("failed to find end in \"%s\"" % recur) |
33 |
+ start = m.group(1) |
34 |
+ year = start[0:4] |
35 |
+ month = start[4:6] |
36 |
+ day = start[6:8] |
37 |
+ hour = start[9:11] |
38 |
+ min = start[11:13] |
39 |
+ sec = start[13:15] |
40 |
+ return "%s-%2s-%2sT%2s:%2s:%2s" % (year, month, day, hour, min, sec) |
41 |
+ |
42 |
+GDSTART_RE = re.compile("DTSTART;[^:]*:(\S+)") |
43 |
+def gdRecurToStart(recur): |
44 |
+ m = GDSTART_RE.search(recur) |
45 |
+ if m is None: |
46 |
+ raise DateConversionError("failed to find start in \"%s\"" % recur) |
47 |
+ start = m.group(1) |
48 |
+ year = start[0:4] |
49 |
+ month = start[4:6] |
50 |
+ day = start[6:8] |
51 |
+ hour = start[9:11] |
52 |
+ min = start[11:13] |
53 |
+ sec = start[13:15] |
54 |
+ return "%s-%2s-%2sT%2s:%2s:%2s" % (year, month, day, hour, min, sec) |
55 |
+ |
56 |
+GDRECUR_RE = re.compile("RRULE:(\S+)") |
57 |
+def gdRecurToORecur(recur): |
58 |
+ m = GDRECUR_RE.search(recur) |
59 |
+ if m is None: |
60 |
+ raise DateConversionError("failed to find rule in \"%s\"" % recur) |
61 |
+ return m.group(1) |
62 |
+ |
63 |
class GCalRequestError(Exception): |
64 |
def __init__(self, response): |
65 |
self.response = response |
66 |
@@ -159,13 +194,19 @@ class GCalEntry: |
67 |
self.id = self.elementValue('atom:id/text()') |
68 |
self.editUri = self.elementValue('atom:link[@rel="edit"]/@href') |
69 |
self.content = self.elementValue('atom:content[@type="text"]/text()') |
70 |
- self.dtstart = self.elementValue('gd:when/@startTime') |
71 |
- self.dtend = self.elementValue('gd:when/@endTime') |
72 |
+ self.dtrecur = self.elementValue('gd:recurrence/text()') |
73 |
+ if self.dtrecur: |
74 |
+ pass |
75 |
+ self.dtstart = gdRecurToStart(self.dtrecur) |
76 |
+ self.dtend = gdRecurToEnd(self.dtrecur) |
77 |
+ self.dtrecur = gdRecurToORecur(self.dtrecur) |
78 |
+ else: |
79 |
+ self.dtstart = self.elementValue('gd:when/@startTime') |
80 |
+ self.dtend = self.elementValue('gd:when/@endTime') |
81 |
|
82 |
self.eventStatus = self.elementValue('gd:eventStatus/@value') |
83 |
self.whereString = self.elementValue('gd:where/@valueString') |
84 |
|
85 |
- #FIXME: Handle recurrency |
86 |
#FIXME: Handle gd:eventStatus |
87 |
|
88 |
|
89 |
@@ -199,9 +240,13 @@ class GCalEntry: |
90 |
|
91 |
self.addElementContent(doc, event, 'DateStarted', xsdateToOsync(self.dtstart)) |
92 |
self.addElementContent(doc, event, 'DateEnd', xsdateToOsync(self.dtend)) |
93 |
+ if self.dtrecur: |
94 |
+ self.addElementContent(doc, event, 'RecurrenceRule', |
95 |
+ self.dtrecur) |
96 |
+ |
97 |
self.addElementContent(doc, event, 'Location', self.whereString) |
98 |
|
99 |
- #TODO: UID, editUri, dtstart, dtend, recurrency, eventStatus |
100 |
+ #TODO: UID, editUri, dtstart, dtend, eventStatus |
101 |
return doc.toxml(encoding='utf-8') |
102 |
|
103 |
def dumpGdata(self): |