чтение повторяющихся событий Google Calendar API - PullRequest
0 голосов
/ 04 июля 2011

Я разрабатываю интерфейсное приложение, доступное для слепых людей. Я создаю, удаляю и обновляю events успешно. Моя проблема в том, что я хочу получить свойства повторяющегося event, т. Е. Если он ежедневный, ежемесячный и т. Д., Чтобы я мог показать своему пользователю, что такое повторяющийся event, и изменить его.

Единственный способ, которым я могу думать, - это анализ строки Recurrence. Хотя я нахожу это очень трудным и трудоемким. Кто-нибудь может придумать другое решение моей проблемы?

1 Ответ

0 голосов
/ 05 июля 2011

Если я правильно понимаю вопрос, вы хотите отобразить что-то вроде этого:

Xyz every day at 5:00 pm starting on 6/1/2011 until 6/6/2011

Однако я думаю, что это заставляет вас работать в обратном направлении, основываясь на том, как обращаются к повторяющимся событиямв API.Все свойства when для повторяющихся событий хранятся в списке (например, одна запись на каждый день выше).Другими словами, анализ этих строк и определение отношения представляется единственным очевидным способом определения отношения.Это

Ссылка: http://code.google.com/apis/calendar/data/2.0/developers_guide_dotnet.html

Редактировать : На самом деле, кажется, что строка повторения также доступна, хотя я не могу найти ее в Интернете.Класс CalendarEventEntry в gdata.calendar.data имеет атрибут recurrence класса gdata.data.Recurrence.Для справки, вот комментарий, предоставленный в определении функции в исходном файле (я использую версию Python):

class Recurrence(atom.core.XmlElement):
  """The gd:recurrence element.

  Represents the dates and times when a recurring event takes place.

  The string that defines the recurrence consists of a set of properties,
  each of which is defined in the iCalendar standard (RFC 2445).

  Specifically, the string usually begins with a DTSTART property that
  indicates the starting time of the first instance of the event, and
  often a DTEND property or a DURATION property to indicate when the
  first instance ends. Next come RRULE, RDATE, EXRULE, and/or EXDATE
  properties, which collectively define a recurring event and its
  exceptions (but see below). (See section 4.8.5 of RFC 2445 for more
  information about these recurrence component properties.) Last comes a
  VTIMEZONE component, providing detailed timezone rules for any timezone
  ID mentioned in the preceding properties.

  Google services like Google Calendar don't generally generate EXRULE
  and EXDATE properties to represent exceptions to recurring events;
  instead, they generate <gd:recurrenceException> elements. However,
  Google services may include EXRULE and/or EXDATE properties anyway;
  for example, users can import events and exceptions into Calendar, and
  if those imported events contain EXRULE or EXDATE properties, then
  Calendar will provide those properties when it sends a <gd:recurrence>
  element.

  Note the the use of <gd:recurrenceException> means that you can't be
  sure just from examining a <gd:recurrence> element whether there are
  any exceptions to the recurrence description. To ensure that you find
  all exceptions, look for <gd:recurrenceException> elements in the feed,
  and use their <gd:originalEvent> elements to match them up with
  <gd:recurrence> elements.
  """
  ...

Редактировать 2 : связанный вопрос, но нет ответа - Решение Python для анализа повторяемости календаря Google .

...