ncal2gcal 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +3 -1
- data/bin/ncal2gcal +4 -2
- data/lib/ncal2gcal/google_calendar.rb +10 -3
- data/lib/ncal2gcal/lotus_notes_calendar.rb +41 -1
- data/lib/ncal2gcal/sync.rb +4 -0
- data/ncal2gcal.gemspec +2 -1
- metadata +3 -3
data/README.rdoc
CHANGED
@@ -20,7 +20,9 @@ Specific options:
|
|
20
20
|
-P, --gmail-password PASSWORD Google user password
|
21
21
|
-C, --gmail-calendar CALENDAR Google calendar (default: 'LotusNotes')
|
22
22
|
-D, --days DAYS Do not sync events older then DAYS days
|
23
|
-
--sync-desc
|
23
|
+
--sync-desc Sync event description (default: no)
|
24
|
+
--sync-alarm Sync event alarm notification (default: no)
|
25
|
+
|
24
26
|
|
25
27
|
Example:
|
26
28
|
ncal2gcal sync -u user123 -p secret123 -d mail123.nsf -U username@gmail.com -P 123secret -C LotusNotes -D 14
|
data/bin/ncal2gcal
CHANGED
@@ -20,7 +20,9 @@ opts = OptionParser.new do |opts|
|
|
20
20
|
opts.on("-P", "--gmail-password PASSWORD", "Google mail password") { |conf[:gmail_password]| }
|
21
21
|
opts.on("-C", "--gmail-calendar CALENDAR", "Google calendar (default: 'LotusNotes')") { |conf[:gmail_calendar]| }
|
22
22
|
opts.on("-D", "--days DAYS", "Do not sync events older then DAYS days (default: no limit)") { |days| conf[:days]=days.to_i }
|
23
|
-
opts.on("--sync-desc", "
|
23
|
+
opts.on("--sync-desc", "Sync event description (default: no)") { |conf[:sync_desc]| }
|
24
|
+
opts.on("--sync-alarm", "Sync alarm notification (default: no)") { |conf[:sync_alarm]| }
|
25
|
+
|
24
26
|
opts.separator ""
|
25
27
|
opts.separator "Example:"
|
26
28
|
opts.separator " ncal2gcal sync -u user123 -p secret123 -d mail123.nsf -U username@gmail.com -P top123secret -C LotusNotes -D 14"
|
@@ -34,7 +36,7 @@ opts = OptionParser.new do |opts|
|
|
34
36
|
end
|
35
37
|
|
36
38
|
opts.on_tail("-v", "--version", "Show version") do
|
37
|
-
puts "ncal2gcal 0.1.
|
39
|
+
puts "ncal2gcal 0.1.5"
|
38
40
|
exit
|
39
41
|
end
|
40
42
|
|
@@ -23,9 +23,16 @@ module NCal2GCal
|
|
23
23
|
return GCal4Ruby::Event.new(@cal)
|
24
24
|
end
|
25
25
|
def del_event(id)
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
begin
|
27
|
+
event = find_event(id)
|
28
|
+
if event
|
29
|
+
return event.delete unless event == []
|
30
|
+
end
|
31
|
+
rescue StandardError => e
|
32
|
+
print 'X'
|
33
|
+
$logger.error DateTime.now.to_s
|
34
|
+
$logger.error id
|
35
|
+
$logger.error e
|
29
36
|
end
|
30
37
|
return false
|
31
38
|
end
|
@@ -59,6 +59,9 @@ module NCal2GCal
|
|
59
59
|
end
|
60
60
|
end
|
61
61
|
class LotusNotesEvent
|
62
|
+
# Note: The value of the minutes can be any arbitrary number of minutes between 5 minutes to 4 weeks.
|
63
|
+
GCAL_MAX_REMINDER = 40320 # 4 Weeks in minutes
|
64
|
+
GCAL_MIN_REMINDER = 5
|
62
65
|
APPOINTMENTTYPE = {'0' =>:appointment,
|
63
66
|
'1' => :anniversary,
|
64
67
|
'2' => :all_day_event,
|
@@ -71,16 +74,24 @@ module NCal2GCal
|
|
71
74
|
:last_modified, #
|
72
75
|
:appointmenttype,
|
73
76
|
:content,
|
74
|
-
:repeats
|
77
|
+
:repeats,
|
78
|
+
:alarm, :alarm_offset
|
75
79
|
|
76
80
|
def initialize(notes_event)
|
81
|
+
fill_alarm(notes_event)
|
82
|
+
|
83
|
+
# Notes Id
|
77
84
|
@uid = notes_event.UniversalID
|
85
|
+
|
86
|
+
# Subject
|
78
87
|
if notes_event.GetFirstItem("Subject")
|
79
88
|
@subject = notes_event.GetFirstItem("Subject").Values[0]
|
80
89
|
else
|
81
90
|
@subject = ''
|
82
91
|
$logger.warn 'no subject. uid: '+@uid
|
83
92
|
end
|
93
|
+
|
94
|
+
#
|
84
95
|
if notes_event.GetFirstItem("ROOM")
|
85
96
|
@where = notes_event.GetFirstItem("ROOM").Values[0]
|
86
97
|
elsif notes_event.GetFirstItem("Location")
|
@@ -88,8 +99,14 @@ module NCal2GCal
|
|
88
99
|
else
|
89
100
|
@where = ''
|
90
101
|
end
|
102
|
+
|
103
|
+
# start date + time
|
91
104
|
@start_time = notes_event.GetFirstItem("Startdatetime").Values[0] if notes_event.GetFirstItem("Startdatetime")
|
105
|
+
|
106
|
+
# end date + time
|
92
107
|
@end_time = notes_event.GetFirstItem("EndDatetime").Values[0] if notes_event.GetFirstItem("EndDatetime")
|
108
|
+
|
109
|
+
# event type
|
93
110
|
if notes_event.GetFirstItem("APPOINTMENTTYPE")
|
94
111
|
@appointmenttype = APPOINTMENTTYPE[notes_event.GetFirstItem("APPOINTMENTTYPE").Values[0]]
|
95
112
|
end
|
@@ -112,6 +129,29 @@ module NCal2GCal
|
|
112
129
|
def repeats?
|
113
130
|
@repeats.size > 1
|
114
131
|
end
|
132
|
+
def fill_alarm(notes_event)
|
133
|
+
# Alarm
|
134
|
+
@alarm = false
|
135
|
+
@alarm_offset = 0
|
136
|
+
if notes_event.GetFirstItem("$Alarm")
|
137
|
+
then
|
138
|
+
if notes_event.GetFirstItem("$Alarm").Values[0] == 1.0
|
139
|
+
then
|
140
|
+
@alarm = true
|
141
|
+
ao = notes_event.GetFirstItem("$AlarmOffset")
|
142
|
+
if ao
|
143
|
+
aov = ao.Values[0].to_i
|
144
|
+
if aov > -GCAL_MIN_REMINDER
|
145
|
+
aov = GCAL_MIN_REMINDER
|
146
|
+
elsif aov < -GCAL_MAX_REMINDER
|
147
|
+
aov = GCAL_MAX_REMINDER
|
148
|
+
end
|
149
|
+
@alarm_offset = aov.abs
|
150
|
+
end
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
end
|
115
155
|
def fill_repeats(notes_event)
|
116
156
|
@repeats = []
|
117
157
|
sdts = notes_event.GetFirstItem("Startdatetime")
|
data/lib/ncal2gcal/sync.rb
CHANGED
@@ -30,6 +30,7 @@ module NCal2GCal
|
|
30
30
|
@max_time = DateTime.parse("2038-01-18")
|
31
31
|
# do not sync the description unless the users wants to
|
32
32
|
@sync_desc = params[:sync_desc] # || true
|
33
|
+
@sync_alarm = params[:sync_alarm]
|
33
34
|
|
34
35
|
init_logger
|
35
36
|
end
|
@@ -141,6 +142,9 @@ module NCal2GCal
|
|
141
142
|
google_event.where = notes_event.where.asciify if notes_event.where
|
142
143
|
google_event.all_day = notes_event.all_day?
|
143
144
|
google_event.content = notes_event.content.asciify if @sync_desc
|
145
|
+
if @sync_alarm and notes_event.alarm
|
146
|
+
google_event.reminder = {:method =>'alert', :minutes => notes_event.alarm_offset.to_i.to_s }
|
147
|
+
end
|
144
148
|
|
145
149
|
return google_event
|
146
150
|
end
|
data/ncal2gcal.gemspec
CHANGED
@@ -2,7 +2,7 @@ require "rubygems"
|
|
2
2
|
|
3
3
|
spec = Gem::Specification.new do |s|
|
4
4
|
s.name = %q{ncal2gcal}
|
5
|
-
s.version = "0.1.
|
5
|
+
s.version = "0.1.5"
|
6
6
|
s.authors = ["Elias Kugler"]
|
7
7
|
s.email = %q{groesser3@gmail.com}
|
8
8
|
s.files = Dir["lib/**/*"] + Dir["bin/**/*"] + Dir["*.rb"] + ["MIT-LICENSE","ncal2gcal.gemspec"]
|
@@ -11,6 +11,7 @@ spec = Gem::Specification.new do |s|
|
|
11
11
|
s.extra_rdoc_files = ["README.rdoc"]
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.summary = %q{Sync your Lotus Notes calendar with your Google calendar}
|
14
|
+
s.description = %q{This lib/tool syncs your IBM Lotus Notes calendar with your (private) Google calendar. The synchronisation is only one-way: Lotus Notes events are pushed to your Google Calendar. All types of events (including recurring events like anniversaries) are supported.}
|
14
15
|
s.files.reject! { |fn| fn.include? "CVS" }
|
15
16
|
s.require_path = "lib"
|
16
17
|
s.default_executable = %q{ncal2gcal}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ncal2gcal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elias Kugler
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-
|
12
|
+
date: 2010-03-08 00:00:00 +01:00
|
13
13
|
default_executable: ncal2gcal
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -52,7 +52,7 @@ dependencies:
|
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: 1.0.5
|
54
54
|
version:
|
55
|
-
description:
|
55
|
+
description: "This lib/tool syncs your IBM Lotus Notes calendar with your (private) Google calendar. The synchronisation is only one-way: Lotus Notes events are pushed to your Google Calendar. All types of events (including recurring events like anniversaries) are supported."
|
56
56
|
email: groesser3@gmail.com
|
57
57
|
executables:
|
58
58
|
- ncal2gcal
|