Re: [O] Google Tasks Integration

2012-01-31 Thread Patrick Brennan
Hi Eric,

Here is the script. It's pretty simple. There is no facility for
synchronizing an org-mode file as yet. I think the best way to do the sync
would be to do it when pushing an org-mode file to Google Tasks.

Tell me how you like this and if it works well for you.

Patrick

PS:

** Requirements:
  - Python 2.6. This is the version I am using, and I am not sure if an
earlier
version will work.
  - setuptools. This is necessary in order to install the Google API for
Python.
Get setuptools from here:
http://pypi.python.org/pypi/setuptools#downloads
I downloaded the egg package
(
http://pypi.python.org/packages/2.6/s/setuptools/setuptools-0.6c11-py2.6.egg#md5=bfa92100bd772d5a213eedd356d64086
),
set it to +x and run it
sudo ./setuptools-0.6c11-py2.6.egg
  - Google Tasks API for Python.
Use easy_install per this page:
http://code.google.com/p/google-api-python-client/wiki/Installation
sudo easy_install --upgrade google-api-python-client

Thanks,
Patrick

On Tue, Jan 31, 2012 at 5:12 AM, Eric S Fraga e.fr...@ucl.ac.uk wrote:

 Patrick Brennan pbren...@gmail.com writes:

  This weekend, while trying to avoid doing any real work, I started
 noodling
  around with the Google Tasks API and I got a respectable distance toward
 a
  script which will read your Google Tasks and export them to Org-mode.
  Currently it will capture the task title, the notes, the todo status
 (TODO
  or DONE) and the hierarchy, i.e. child tasks will be correctly placed
 under
  their parents. There's still a lot of polish to apply, and of course,
 there
  is no bidirectional capability as yet. Still, I wanted to send out this
  notice in case anyone wanted to compare notes or thought it might be an
  interesting application to share. The mobile apps for Google Tasks are
  quite good, and if I can get a really good export going, I think this
 will
  actually provide a plausible alternative workflow to the existing
 MobileOrg
  flow.
 
  Patrick

 I would be very interested in this.  I have links to and from google
 calendar for appointments but could not figure out how to do either
 direction for TODO items.

 Thanks,
 eric

 --
 : Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.92.1
 : using Org-mode version 7.8.03 (release_7.8.03.283.g171ea)


#! /usr/bin/python
import gflags
import httplib2
import math
import re

from apiclient.discovery import build
from oauth2client.file import Storage
from oauth2client.client import OAuth2WebServerFlow
from oauth2client.tools import run


# Algorithm from pg 7 of Peter Duffet-Smith, 
# Practical Astronomy With Your Calculator, 3d ed.
# Check against http://www.onlineconversion.com/julian_date.htm
# and Orbiter distribution/Utils/Date.exe
# This version does not check for Gregorian calendar or BC!!!
# This version does not handle fractional days!!!
def JulianDate (Year,Month,Day,modified=False):
if (Month == 1)or(Month == 2):
Yprime = Year - 1
Mprime = Month + 12
else:
Yprime = Year
Mprime = Month

A = math.floor(Yprime / 100.0)
B = 2.0 - A + math.floor(A / 4.0)

C = math.floor(365.25 * Yprime)

D = math.floor(30.6001 * (Mprime + 1.0))

# Julian Day
JD = B + C + D + Day + 1720994.5

# Modified Julian Day
MJD = B + C + D + Day - 679006.0

if modified:
return MJD
else:
return JD


# Given a year, month, and day, compute the day of the week
def DayOfWeek(Year,Month,Day):
dayNames = [ 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' ]
mjd = JulianDate(Year,Month,Day,True)
diff = mjd - 15019.0
# dayIndex = math.floor(diff) % 7
dayIndex = int(diff) % 7
return dayNames[dayIndex]


# Given a string which represents a date and time, e.g.
# '2012-01-30T23:59:00Z' RFC 3339 timestamp
# Format it into a Org-Mode date.
def formatDateTimeStringToOrgMode(DateTimeString,angleBrackets=True):
prog = re.compile('([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(.{1})')
match = prog.match(DateTimeString)

Year = int(match.group(1))
Month = int(match.group(2))
Day = int(match.group(3))
ShortDayName = DayOfWeek(Year,Month,Day)
Hour = int(match.group(4))
Minute = int(match.group(5))
Second = int(match.group(6))
TimeZone = match.group(7) # TODO: Use the timezone somehow

if angleBrackets:
openBracket = ''
closeBracket = ''
else:
openBracket = '['
closeBracket = ']'

retString = '%s%04d-%02d-%02d %s %02d:%02d:%02d%s' % \
(openBracket, \
 Year, Month, Day, ShortDayName, Hour, Minute, Second, \
 closeBracket)

return retString

[O] Google Tasks Integration

2012-01-30 Thread Patrick Brennan
This weekend, while trying to avoid doing any real work, I started noodling
around with the Google Tasks API and I got a respectable distance toward a
script which will read your Google Tasks and export them to Org-mode.
Currently it will capture the task title, the notes, the todo status (TODO
or DONE) and the hierarchy, i.e. child tasks will be correctly placed under
their parents. There's still a lot of polish to apply, and of course, there
is no bidirectional capability as yet. Still, I wanted to send out this
notice in case anyone wanted to compare notes or thought it might be an
interesting application to share. The mobile apps for Google Tasks are
quite good, and if I can get a really good export going, I think this will
actually provide a plausible alternative workflow to the existing MobileOrg
flow.

Patrick


[O] Org-mode 7.7 Broken with respect to mouse and checklists?

2011-11-04 Thread Patrick Brennan
Hi,

I have a checklist in this form:

- [ ] Item One
- [ ] Item Two

In Org-mode 7.7, if I put my mouse inside one of the checks and press the
left button, I get the following message:

org-open-at-point: Wrong type argument: markerp, 471

The number changes depending upon where the checkmark is.

This works fine in org-mode 7.4 and 7.6. Any clues what I'm doing wrong in
7.7?

Thanks,
Patrick


[Orgmode] orgutil

2011-01-23 Thread Patrick Brennan
Hello everyone,

I have created a TCL script which can be used to parse org files. Its
primary purpose was for my personal use: I had a bunch of AbstractSpoon
ToDoList files which needed to be converted to Org-mode. In the process I
created a bidirectional converter: it will convert TDL to Org and
vice-versa. It also has a lot of routines which might prove useful to the
Org community.

The script is licensed under the GPLv3 and can be found here:
https://sourceforge.net/projects/orgutil/

I hope you find it useful!

Patrick
___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode