From bc994b51af187242bf4fda2c2abb364d7456907b Mon Sep 17 00:00:00 2001 From: Dylan Lloyd Date: Sun, 6 Mar 2011 01:58:21 -0500 Subject: [PATCH] publish_notes now takes the time from notes New notes format ~/docs/notes/note_url.html: Title YYYY/MM/DD HH:MM[am|pm]

Lorem ipsum...

--- publish_notes.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/publish_notes.py b/publish_notes.py index 8663f9c..2f99dc6 100755 --- a/publish_notes.py +++ b/publish_notes.py @@ -29,13 +29,12 @@ for note in notes: url = note[:note.index('.')] f = open(os.path.join(NOTES_DIRECTORY, note)) title = str(f.readline()[:-1]) + date_posted = time.strptime(str(f.readline()[:-1]), "%Y/%m/%d %I:%M%p") text = ''.join(f.readlines()) #converts list to single string if title in existing_titles: continue - mtime = time.localtime(os.path.getmtime(os.path.join(NOTES_DIRECTORY, note))) - date_posted = "%s-%s-%s" % (str(mtime.tm_year)[2:], mtime.tm_mon, mtime.tm_mday) sql = "INSERT INTO notes (date_posted, url, title, text)\ VALUES(\"%s\", \"%s\", \"%s\", \"%s\")"\ - % (date_posted, url, title, db.escape_string(text)) + % (time.strftime("%Y/%m/%d %I:%M:00", date_posted), url, title, db.escape_string(text)) #print sql cursor.execute(sql) -- 2.30.2