X-Git-Url: https://disinclined.org/git/?a=blobdiff_plain;f=publish_notes.py;h=2f99dc61e5404df72c54f5c0493038bf0d2b731a;hb=6f04d2b1c7461b1c50dd3c9f895baabafc4d6db4;hp=8663f9c44c1333686c428854ff378af059dc5276;hpb=a6fc8a7a21a0063db905737365e9daa149554665;p=dylansserver.git 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)