From: Dylan Lloyd Date: Sun, 6 Mar 2011 06:58:21 +0000 (-0500) Subject: publish_notes now takes the time from notes X-Git-Url: https://disinclined.org/git/?a=commitdiff_plain;h=bc994b51af187242bf4fda2c2abb364d7456907b;p=dylansserver.git 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...

--- 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)