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 |
|
---|
7 | import sys
|
---|
8 | from rdflib.Graph import Graph
|
---|
9 | from appscript import app
|
---|
10 | from datetime import datetime
|
---|
11 |
|
---|
12 | g = Graph()
|
---|
13 | g.parse(sys.argv[1])
|
---|
14 |
|
---|
15 | query = 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 |
|
---|
21 | library = app(id='com.c-command.EagleFiler').library_documents[1]
|
---|
22 |
|
---|
23 | for 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.