Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added creation and update dates & times

If starred.json has a 'published' field, it's interpreted as a Unix
epoch time and converted to an SQL datetime in the output's 'created'
tag.  Similarly, 'updated' fields are converted to 'updated' tags.
  • Loading branch information...
commit e9e2fbb87ddd4af79ac0da594879aeec8f7dbe31 1 parent 208f163
@kerchen authored
Showing with 11 additions and 1 deletion.
  1. +11 −1 export2enex.py
View
12 export2enex.py
@@ -25,7 +25,7 @@
import getopt, sys
import os.path
import codecs
-
+import time
def usage():
print "\nOptions:"
@@ -82,6 +82,12 @@ def usage():
subject = ""
if 'title' in s.keys():
subject = s["title"].encode(char_encoding, 'replace')
+ if 'published' in s.keys():
+ published_epoch = s["published"]
+ published_datetime = time.strftime("%Y%m%dT%H%M%SZ", time.localtime(published_epoch) )
+ if 'updated' in s.keys():
+ updated_epoch = s["updated"]
+ updated_datetime = time.strftime("%Y%m%dT%H%M%SZ", time.localtime(updated_epoch) )
if notebook:
subject = subject + " @" + notebook
@@ -102,6 +108,10 @@ def usage():
d = s["content"]
msg_body = msg_body + d["content"].encode(char_encoding, 'replace')
msg_body = msg_body + "</en-note>]]>\r\n</content>\r\n"
+ if published_datetime:
+ msg_body = msg_body + "<created>" + published_datetime + "</created>"
+ if updated_datetime:
+ msg_body = msg_body + "<updated>" + updated_datetime + "</updated>"
msg_body = msg_body + "<note-attributes><source>web.clip</source><source-url>" + msg_url + "</source-url></note-attributes>"
msg_body = msg_body + "</note>\r\n"
Please sign in to comment.
Something went wrong with that request. Please try again.