incremented to version 0.7

added filename validator
master
endorphant 2016-05-11 00:10:04 -04:00
parent 30426ab016
commit a82c25840e
4 changed files with 37 additions and 29 deletions

View File

@ -5,6 +5,6 @@
| |___ |___ |___ | [__ |___ |\ | | __ | |\ | |___ |
| | |___ |___ |___ ___] |___ | \| |__] | | \| |___ |
| |
| ver 0.6.5 (fairly unstable) |
| ver 0.7.0 (almost stable) |
| ~endorphant/projects/ttbp/changelog.txt |
|__________________________________________________________|

View File

@ -3,6 +3,7 @@
import os
import time
import subprocess
import re
import chatter
@ -49,7 +50,8 @@ def load_files():
FILES = []
for filename in os.listdir(DATA):
filename = os.path.join(DATA, filename)
if os.path.isfile(filename) and os.path.splitext(filename)[1] == ".txt":
#if os.path.isfile(filename) and os.path.splitext(filename)[1] == ".txt":
if os.path.isfile(filename) and valid(filename):
FILES.append(filename)
FILES.sort()
@ -63,9 +65,6 @@ def write(outurl="default.html"):
for line in HEADER:
outfile.write(line)
#for line in write_placeholder():
# outfile.write(line)
outfile.write("\n")
for filename in FILES:
@ -171,12 +170,31 @@ def meta(entries = FILES):
meta.sort(key = lambda filename:filename[4])
meta.reverse()
return meta
def valid(filename):
# check if the filename is YYYYMMDD.txt
filesplit = os.path.splitext(os.path.basename(filename))
if filesplit[1] != ".txt":
return False
pattern = '^((19|20)\d{2})(0[1-9]|1[0-2])(0[1-9]|1\d|2\d|3[01])$'
if not re.match(pattern, filesplit[0]):
return False
return True
#############
#############
#############
def test():
load()
#for x in FILES:
# print(x)
metaTest = meta()

View File

@ -216,9 +216,6 @@ def print_menu(menu):
i += 1
def main_menu():
#os.system("clear")
#print(BANNER)
#redraw()
menuOptions = [
"record your feels",
"review your feels",
@ -226,18 +223,11 @@ def main_menu():
"browse global feels",
"change your settings",
"send some feedback",
"(wip) see credits"]
#print(SPACER)
#print("you're at ttbp home. remember, you can always press <ctrl-c> to come back here.\n\n")
print("you're at ttbp home.\n\n")
"see credits"]
print("you're at ttbp home. remember, you can always press <ctrl-c> to come back here.\n\n")
#print("you're at ttbp home.\n\n")
print_menu(menuOptions)
#print("how are you feeling today? ")
#try:
# choice = raw_input("\ntell me about your feels (or 'quit' to exit): ")
#except KeyboardInterrupt:
# redraw(EJECT)
# return main_menu()
try:
choice = raw_input("\ntell me about your feels (or 'quit' to exit): ")
except KeyboardInterrupt:
@ -313,7 +303,8 @@ def view_neighbors(users):
files = os.listdir(os.path.join("/home", user, ".ttbp", "entries"))
files.sort()
for filename in files:
if os.path.splitext(filename)[1] == ".txt" and len(os.path.splitext(filename)[0]) == 8:
#if os.path.splitext(filename)[1] == ".txt" and len(os.path.splitext(filename)[0]) == 8:
if core.valid(filename):
count += 1
lastfile = os.path.join("/home", user, ".ttbp", "entries", filename)
@ -438,8 +429,9 @@ def view_feed():
filenames = os.listdir(entryDir)
for entry in filenames:
### REALLY MAKE A REAL FILENAME VALIDATOR
fileSplit = os.path.splitext(entry)
if len(fileSplit[0]) == 8 and fileSplit[1] == ".txt":
#fileSplit = os.path.splitext(entry)
#if len(fileSplit[0]) == 8 and fileSplit[1] == ".txt":
if core.valid(entry):
feedList.append(os.path.join(entryDir, entry))
metas = core.meta(feedList)

View File

@ -1,18 +1,15 @@
TO-DO:
(goals for stable release)
-filename validator
-only count/process entries if filename is
.ttbp/entries/YYMMDD.txt"
-show most recent global entries on html
-make commenting actually use mail instead of dumping
to a file?
-command line flags
-command line flags:
-shortcut to most recent feels, writing entry, seeing own entry
-markdown parsing
-neighbor view takes you to individual entry listing
(goals for phase two)
-make feedback actually use mail instead of dumping to a file
-stylesheet selector
-and make a couple more custom stylesheets
-replying to entries??
@ -29,6 +26,7 @@ CHANGELOG:
ver 0.7
-fixed program crashing? maybe?
-added credits
-added filename validator
ver 0.6.5
-renamed FEELS ENGINE