Event alarms

817 views
Skip to first unread message

sheamus

unread,
Nov 19, 2011, 2:34:40 PM11/19/11
to RiCal
I am trying to add an alarm to an event. So an hour before a game, I
sound is played, and message is displayed.

I am assuming that for the alarm, I can give it a description which
will be the message displayed.

Looking at a ics file exported by ical, the sound played is given like
this:
ATTACH;VALUE=URI:SoundName

I am not sure how do get the ';VALUE=URI' part.
But
event do
attach :value => "SoundName", :params => { "VALUE" => "URI" }
end

does not work.

The exported ICS file from iCal also includes a TRIGGER item. Is this
the time before the event? It seems to have a value of -1PTH
regardless of whether the alert is 1 hour or 1 day before.

The exported ICS file also has a X-WR-ALARMUID value which looks like
a GUID. I am guessing this is an index into OS X's alarm system. Is
there a generic way to make alarms? i.e, the application importing the
ICS file will see the ALARM, and create it's own reminder?

Rick DeNatale

unread,
Nov 19, 2011, 7:44:37 PM11/19/11
to rica...@googlegroups.com
On Sat, Nov 19, 2011 at 2:34 PM, sheamus <shea....@gmail.com> wrote:
I am trying to add an alarm to an event.  So an hour before a game, I
sound is played, and message is displayed.

Exactly what happens on an alarm depends on the calendar client application. I assume you are using iCal.app on the Mac based on what follows, but I don't think there is a calendar app independent definition of how alarms are handled.



I am assuming that for the alarm, I can give it a description which
will be the message displayed.

Looking at a ics file exported by ical, the sound played is given like
this:
ATTACH;VALUE=URI:SoundName

I am not sure how do get the ';VALUE=URI' part.
But
event do
  attach :value => "SoundName", :params => { "VALUE" => "URI" }
end

does not work.

The exported ICS file from iCal also includes a TRIGGER item. Is this
the time before the event? It seems to have a value of -1PTH
regardless of whether the alert is 1 hour or 1 day before.

First off, the attachment isn't a direct property of an event but of an alarm (VALARM) subcomponent of the event. http://www.kanzaki.com/docs/ical/valarm.html

Here's an event named "Testing" excerpted from an exported iCal calendar which has two alerts displayed in the get info box:

   alert: Message with Sound
           Basso
           8 minutes before

   alert: Message
           15 minutes before

BEGIN:VEVENT
STATUS:CONFIRMED
CREATED:20111119T231159Z
UID:A5689D0D-543F-430A-BA06-D2F9B35122C2
DTEND;TZID=America/New_York:20111108T180000
TRANSP:OPAQUE
SUMMARY:Testing
DTSTART;TZID=America/New_York:20111108T100000
DTSTAMP:20111119T232621Z
SEQUENCE:5
BEGIN:VALARM
X-WR-ALARMUID:564B8313-6D3D-46F7-B8C9-1221A091031A
TRIGGER:-PT8M
ATTACH;VALUE=URI:Basso
ACTION:AUDIO
END:VALARM
BEGIN:VALARM
X-WR-ALARMUID:ACC3A861-0EAD-4669-8C66-E982743C0134
TRIGGER:-PT15M
DESCRIPTION:Event reminder
ACTION:DISPLAY
END:VALARM
END:VEVENT

Notice that there are 2 valarms nested within the event.  The first, according to the icalendar RFC, should play a sound 8 minutes before the event.  The second should display "Event reminder" 15 minutes before the event.

But ical.app doesn't do exactly what the rfc calls for.  The AUDIO display seems to both produce the sound, AND displays an alert dialog with  the event's name as the message.  And the DISPLAY action displays exactly the same dialog, except it doesn't play a sound.  Although the 'message' only valarm has a description of "Event reminder" which is used for the title of the alert dialog box, there doesn't seem to be a way in the ical.app UI to change that description, and the AUDIO valarm uses the same title for its alert dialog. 

Note that the value of the ATTACH property of the first valarm is "URI:Basso".

So to replicate this you'd want something like

event do
   # Other event attributes
   alarm do
       attach "URI:Basso"
       trigger "-PT8M"
       action "AUDIO"
       x_wr_alarmuid '564B8313-6D3D-46F7-B8C9-1221A091031A'
    end

    alarm do
       trigger '-PT15M'
       description 'Event reminder'
       action 'DISPLAY'
       x_wr_alarmuid  'ACC3A861-0EAD-4669-8C66-E982743C0134' 
     end
end



The exported ICS file also has a X-WR-ALARMUID value which looks like
a GUID.  I am guessing this is an index into OS X's alarm system.  Is
there a generic way to make alarms? i.e, the application importing the
ICS file will see the ALARM, and create it's own reminder?

Those 'X' attributes are outside of the icalendar RFC.  I suspect they are internally generated by ical.app somehow, but I have not a clue how, or how those attributes are used by ical.app or the calendar apps in IOS, or anywhere else.

--
Rick DeNatale

Google+: +Rick DeNatale
Blog: http://talklikeaduck.denhaven2.com/
Github: http://github.com/rubyredrick
Twitter: @RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale

sheamus

unread,
Nov 21, 2011, 10:23:54 AM11/21/11
to RiCal
That did it, thanks,
~S

On Nov 19, 6:44 pm, Rick DeNatale <rick.denat...@gmail.com> wrote:


> On Sat, Nov 19, 2011 at 2:34 PM, sheamus <shea.mar...@gmail.com> wrote:
> > I am trying to add an alarm to an event.  So an hour before a game, I
> > sound is played, and message is displayed.
>
> Exactly what happens on an alarm depends on the calendar client
> application. I assume you are using iCal.app on the Mac based on what
> follows, but I don't think there is a calendar app independent definition
> of how alarms are handled.
>
>
>
>
>
>
>
>
>
> > I am assuming that for the alarm, I can give it a description which
> > will be the message displayed.
>
> > Looking at a ics file exported by ical, the sound played is given like
> > this:
> > ATTACH;VALUE=URI:SoundName
>
> > I am not sure how do get the ';VALUE=URI' part.
> > But
> > event do
> >   attach :value => "SoundName", :params => { "VALUE" => "URI" }
> > end
>
> > does not work.
>
> > The exported ICS file from iCal also includes a TRIGGER item. Is this
> > the time before the event? It seems to have a value of -1PTH
> > regardless of whether the alert is 1 hour or 1 day before.
>
> First off, the attachment isn't a direct property of an event but of an

> alarm (VALARM) subcomponent of the event.http://www.kanzaki.com/docs/ical/valarm.html

> Google+: +Rick DeNatale <https://plus.google.com/102541178931067955550>

Reply all
Reply to author
Forward
0 new messages