~ttx/+junk/scripts

1 by Thierry Carrez
Initial release for gtd tool
1
#!/usr/bin/python
2
#    gtd - Add a task to your Remember the Milk default list
3
#    Copyright (C) 2010 Thierry Carrez
4
#
5
#    Author: Thierry Carrez <thierry.carrez@ubuntu.com>
6
#
7
#    This program is free software: you can redistribute it and/or modify
8
#    it under the terms of the GNU General Public License as published by
9
#    the Free Software Foundation, either version 3 of the License, or
10
#    (at your option) any later version.
11
#
12
#    This program is distributed in the hope that it will be useful,
13
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
14
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
#    GNU General Public License for more details.
16
#
17
#    You should have received a copy of the GNU General Public License
18
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
20
import os
21
import sys
22
import yaml
23
24
import rtm
25
26
27
if len(sys.argv) != 2:
28
    print "Usage: %s \"Task to add to default list\"" % sys.argv[0]
29
    sys.exit(0)
30
31
config = yaml.load(open(os.path.join(os.getenv("HOME"),".rtm.yaml"), "r"))
32
33
session = rtm.createRTM(config['apiKey'], config['secret'], config['token'])
34
35
taskname=sys.argv[1]
36
rsp_timeline = session.timelines.create()
37
timeline = rsp_timeline.timeline
38
rsp_task = session.tasks.add(timeline=timeline,name=taskname)