[chandler-users] Prototype daily agenda script

Jared Rhine jared at wordzoo.com
Tue Nov 20 16:43:43 PST 2007


I wrote a little python script which produces a weekly plain-text  
report with all my appointments, queried off live Chandler Hub.

It's checked into an SVN sandbox:

   http://svn.osafoundation.org/sandbox/hub/trunk/bin/daily-report

It requires the 'vobject' and 'davclient' Python libraries.  (Python  
2.5 preferred to pick up XML parsing library).

I'm now using this in a cronjob like this:

-----
#!/bin/sh

~/work/hub/bin/daily-report --username jared --password XXXXXX --coll  
13499777-9077-1177-ba8d-da11fa177777 --coll '6a640777-1f77-1177- 
f577-0016cbca6777?ticket=66aar42777'
-----

to produce this output:

-----
--- Wednesday, November 21 2007 ---
Ted/Jared 1:1           [2:30pm, 30 min]
IRC QA Session          [11:00am, 1 hr]
Mikeal PTO
Adam PTO
Dan PTO 11/20 - 11/21

--- Thursday, November 22 2007 ---
Jared/Sheila 1:1        [1:15pm, 45 min]
QA staff meeting        [1:15pm, 45 min]
Cosmo Meeting           [2:00pm, 1 hr]
Desktop Release Meeting [4:00pm, 1 hr]
Thanksgiving

--- Friday, November 23 2007 ---
wx IRC Office Hour      [9:00am, 1 hr]
Cosmo Bug Council       [2:00pm, 1 hr]
Thanksgiving

--- Saturday, November 24 2007 ---

--- Sunday, November 25 2007 ---

--- Monday, November 26 2007 ---
QA/Release              [11:30am, 1 hr]
Jared/Katie 1:1         [3:00pm, 30 min]
Weekly PPD Meeting      [1:30pm, 1 hr]

--- Tuesday, November 27 2007 ---
Ops Group Meeting       [10:30am, 1 hr]
Desktop Group Meeting   [1:15pm, 45 min]
Ops Group Meeting       [10:30am, 1 hr]
Desktop Bug Council     [4:00pm, 1 hr]
-----

You'll need to look up the collection ids (and any tickets needed)  
manually and put those on the command-line.

The script's usage (--help) produces:

-----

Usage: daily-report --coll 13587f72-7774-11db-ba8d-abc1fadef65b  
[options]

   This script produces a plain-text report listing all events present
   in one or more Chandler Server (Cosmo) collections which occur
   within the next week (or other specified time window).  One or more
   collections must be specified on the command-line.  Ticketed
   collections may be specified like:

     --coll '6a640777-1f77-1177-f577-0016c7776a77?ticket=b177r477j0'

   making sure to escape the question-mark from the shell if needed.
   A username and password is required unless all collections are  
ticketed.
   This script starts all reports on the current day, and should be
   suitable for calling regularly (daily or weekly) via cron.

Options:
   -h, --help            show this help message and exit
   -c COLLECTION, --collection=COLLECTION
                         search specified collection for items to  
include in report.  can be specified more than once.  can include a  
Cosmo ticket.
   -u USERNAME, --username=USERNAME
                         the HTTP username to use to access non-ticket  
collections
   -p PASSWORD, --password=PASSWORD
                         the HTTP password to use to access non-ticket  
collections
   -d DAYS, --days=DAYS  number of days to include in report [default:  
7]
   -t TIMEZONE, --timezone=TIMEZONE
                         timezone to use for servertime  queries  
[default: -08:00]
   -U COSMOURL, --cosmourl=COSMOURL
                         base URL to use for Cosmo lookup requests  
[default: https://hub.chandlerproject.org]

-----

The script produces Atom queries to get an expanded list of events  
within each day's timerange, but then does a DAV lookup on the  
resulting event's UUIDs so I can get the ICS representation of an  
event and shove it through vobject.  Otherwise, I'd need to implement  
all duration parsing, etc, in my code.  It'd be handy to have an Atom  
projection that gave me vCalendar format directly.

The code is really only at a prototype level.  Nobody besides myself  
has tested it, and I wasn't quite sure what I was writing when I  
started.  I have dreams of making the functionality available to any  
Hub user who wants it (without having to run the script locally), but  
that's at best a side project right now.

Enjoy.

-- Jared


More information about the chandler-users mailing list