2011-07-04 9 views
0

私は盲目の人々のためにアクセス可能なフロントエンドアプリケーションを開発中です。 eventsを正常に作成、削除、更新します。私の問題は、定期的にeventのプロパティを取得したいということです。つまり、それが毎月、毎月などであれば、私は自分のユーザーに繰り返しの内容を表示して変更することができます。定期的な予定を読むgoogle calendar api

私が考えることができる唯一の方法は、Recurrence文字列を解析することです。しかし、私はそれが非常に困難で時間がかかることがわかります。誰かが私の問題の別の解決策を考えることができますか?

答えて

0

私が正しく質問を理解していれば、あなたはこのような何かを表示したい:

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

はしかし、私はこれがAPIにアクセスする方法、定期的なイベントに基づいて逆方向に動作するようにあなたを強制的に考えます。定期的なイベントのすべてのwhenプロパティは、リストに格納されます(たとえば、上記の1日あたり1つのエントリ)。言い換えれば、これらの文字列を解析して関係を決定することは、実際に関係を決定する唯一の明らかな方法と思われます。それ

参考:http://code.google.com/apis/calendar/data/2.0/developers_guide_dotnet.html

編集:実は、私はそれがオンライン文書を見つけることができませんが、再発の文字列は、あまりにもアクセス可能であるようです。 CalendarEventEntryクラスのgdata.calendar.dataには、recurrencegdata.data.Recurrenceクラスがあります。

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 solution to parse Google calendar's recurrencies 関連質問が、応答なし参考のため、ここではソースファイル内の関数定義(私はPythonのバージョンを使用しています)で提供のコメントです。

+0

ありがとうございます! – DimitrisZli

関連する問題