forked from endorphant/ttbp
started nopub feature
core file loading now checks files against a list of nopubs, stored in .ttbp/config/nopubmaster
parent
ed071ebb67
commit
cd63c6f09a
12
bin/core.py
12
bin/core.py
|
@ -17,6 +17,7 @@ WWW = os.path.join(PATH, "www")
|
||||||
CONFIG = os.path.join(PATH, "config")
|
CONFIG = os.path.join(PATH, "config")
|
||||||
DATA = os.path.join(PATH, "entries")
|
DATA = os.path.join(PATH, "entries")
|
||||||
FEED = os.path.join(SOURCE, "www", "index.html")
|
FEED = os.path.join(SOURCE, "www", "index.html")
|
||||||
|
NOPUB = os.path.join(CONFIG, "nopub")
|
||||||
|
|
||||||
HEADER = ""
|
HEADER = ""
|
||||||
FOOTER = ""
|
FOOTER = ""
|
||||||
|
@ -34,8 +35,16 @@ def load():
|
||||||
def load_files():
|
def load_files():
|
||||||
global FILES
|
global FILES
|
||||||
|
|
||||||
|
exclude = []
|
||||||
|
|
||||||
|
if os.path.isfile(NOPUB):
|
||||||
|
for line in open(NOPUB, "r"):
|
||||||
|
exclude.append(line.rstrip())
|
||||||
|
|
||||||
FILES = []
|
FILES = []
|
||||||
for filename in os.listdir(DATA):
|
for filename in os.listdir(DATA):
|
||||||
|
if filename in exclude:
|
||||||
|
continue
|
||||||
filename = os.path.join(DATA, filename)
|
filename = os.path.join(DATA, filename)
|
||||||
if os.path.isfile(filename) and valid(filename):
|
if os.path.isfile(filename) and valid(filename):
|
||||||
FILES.append(filename)
|
FILES.append(filename)
|
||||||
|
@ -165,7 +174,7 @@ def valid(filename):
|
||||||
# check if the filename is YYYYMMDD.txt
|
# check if the filename is YYYYMMDD.txt
|
||||||
|
|
||||||
filesplit = os.path.splitext(os.path.basename(filename))
|
filesplit = os.path.splitext(os.path.basename(filename))
|
||||||
|
|
||||||
if filesplit[1] != ".txt":
|
if filesplit[1] != ".txt":
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -202,7 +211,6 @@ def write_global_feed(blogList):
|
||||||
<p> </p>
|
<p> </p>
|
||||||
|
|
||||||
<h3>live feels-sharing:</h3>
|
<h3>live feels-sharing:</h3>
|
||||||
<p><i>(time not exactly to scale)</i></p>
|
|
||||||
<div class=\"feed\">
|
<div class=\"feed\">
|
||||||
<ul>
|
<ul>
|
||||||
""")
|
""")
|
||||||
|
|
|
@ -407,7 +407,7 @@ press <enter> to begin recording your feels.
|
||||||
if publishing():
|
if publishing():
|
||||||
core.load_files()
|
core.load_files()
|
||||||
core.write("index.html")
|
core.write("index.html")
|
||||||
left = "posted to "+LIVE+USER+"/"+SETTINGS["publish dir"]+"/index.html"
|
left = "posted to "+LIVE+USER+"/"+SETTINGS["publish dir"]+"/index.html\n\n>"
|
||||||
redraw(left + " thanks for sharing your feels!")
|
redraw(left + " thanks for sharing your feels!")
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue