source: trunk/hiptop notes to EagleFiler/notes2ef.py@ 663

Last change on this file since 663 was 565, checked in by Nicholas Riley, 15 years ago

hiptop notes to EagleFiler: used once; keep for posterity

File size: 914 bytes
Line 
1# 0. hg clone http://bitbucket.org/DanC/palmagent/
2# 1. python dangerSync.py --prod --user=XXXX --passwd=YYYY --get=note
3# 2. python dangerSync.py --xml note > notes.rdf
4# 3. remove "<note>" elements (keep their contents)
5# 4. python notes2ef.py notes.rdf
6
7import sys
8from rdflib.Graph import Graph
9from appscript import app
10from datetime import datetime
11
12g = Graph()
13g.parse(sys.argv[1])
14
15query = g.query(
16 '''SELECT ?body ?update_time
17 WHERE { ?q danger:body ?body .
18 ?q danger:update_time ?update_time . }''',
19 initNs=dict(danger='http://dev.w3.org/2001/palmagent/danger#'))
20
21library = app(id='com.c-command.EagleFiler').library_documents[1]
22
23for body, update_time in query:
24 update_time = datetime.strptime(update_time, '%Y%m%dT%H%M%SZ')
25 records = library.import_(plain_text=body)
26 records[0].creation_date.set(update_time)
27 records[0].modification_date.set(update_time)
Note: See TracBrowser for help on using the repository browser.