forked from endorphant/ttbp
entry saving respects nopub setting
parent
222e6e9d59
commit
89a53336ac
|
@ -235,6 +235,7 @@ def write_global_feed(blogList):
|
||||||
prints to blog feed
|
prints to blog feed
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
try:
|
||||||
outfile = open(FEED, "w")
|
outfile = open(FEED, "w")
|
||||||
|
|
||||||
## header
|
## header
|
||||||
|
@ -286,6 +287,8 @@ def write_global_feed(blogList):
|
||||||
|
|
||||||
outfile.close()
|
outfile.close()
|
||||||
#subprocess.call(['chmod', 'a+w', FEED])
|
#subprocess.call(['chmod', 'a+w', FEED])
|
||||||
|
except FileNotFoundError:
|
||||||
|
pass
|
||||||
|
|
||||||
## misc helpers
|
## misc helpers
|
||||||
|
|
||||||
|
@ -309,7 +312,7 @@ def meta(entries = FILES):
|
||||||
for filename in entries:
|
for filename in entries:
|
||||||
mtime = os.path.getmtime(filename)
|
mtime = os.path.getmtime(filename)
|
||||||
try:
|
try:
|
||||||
wc = subprocess.check_output(["wc","-w",filename], stderr=subprocess.STDOUT).split()[0]
|
wc = int(subprocess.check_output(["wc","-w",filename], stderr=subprocess.STDOUT).split()[0])
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
wc = "???"
|
wc = "???"
|
||||||
timestamp = time.strftime("%Y-%m-%d at %H:%M", time.localtime(mtime))
|
timestamp = time.strftime("%Y-%m-%d at %H:%M", time.localtime(mtime))
|
||||||
|
|
10
ttbp/ttbp.py
10
ttbp/ttbp.py
|
@ -108,7 +108,7 @@ def menu_handler(options, prompt, pagify=10, rainbow=False, top=""):
|
||||||
return util.list_select(options, prompt)
|
return util.list_select(options, prompt)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
return page_helper(options, prompt, pagify, rainbow, page, total, top)
|
return page_helper(options, prompt, pagify, rainbow, page, int(total), top)
|
||||||
|
|
||||||
def page_helper(options, prompt, pagify, rainbow, page, total, top):
|
def page_helper(options, prompt, pagify, rainbow, page, total, top):
|
||||||
'''
|
'''
|
||||||
|
@ -126,7 +126,7 @@ def page_helper(options, prompt, pagify, rainbow, page, total, top):
|
||||||
optPage = options[x:y]
|
optPage = options[x:y]
|
||||||
|
|
||||||
util.print_menu(optPage, SETTINGS.get("rainbows", False))
|
util.print_menu(optPage, SETTINGS.get("rainbows", False))
|
||||||
print("\n\t( page {page} of {total}; type 'u' or 'd' to scroll up and down )").format(page=page+1, total=total+1)
|
print("\n\t( page {page} of {total}; type 'u' or 'd' to scroll up and down)".format(page=page+1, total=total+1))
|
||||||
|
|
||||||
ans = util.list_select(optPage, prompt)
|
ans = util.list_select(optPage, prompt)
|
||||||
|
|
||||||
|
@ -794,8 +794,10 @@ editor.
|
||||||
|
|
||||||
left = ""
|
left = ""
|
||||||
|
|
||||||
|
if SETTINGS.get("nopub"):
|
||||||
|
core.toggle_nopub(os.path.basename(entry))
|
||||||
|
else:
|
||||||
if core.publishing():
|
if core.publishing():
|
||||||
core.load_files()
|
|
||||||
core.write("index.html")
|
core.write("index.html")
|
||||||
left = "posted to {url}/index.html\n\n>".format(
|
left = "posted to {url}/index.html\n\n>".format(
|
||||||
url="/".join(
|
url="/".join(
|
||||||
|
@ -805,6 +807,8 @@ editor.
|
||||||
if SETTINGS.get('gopher'):
|
if SETTINGS.get('gopher'):
|
||||||
gopher.publish_gopher('feels', core.get_files())
|
gopher.publish_gopher('feels', core.get_files())
|
||||||
left += " also posted to your ~/public_gopher!\n"
|
left += " also posted to your ~/public_gopher!\n"
|
||||||
|
|
||||||
|
core.load_files()
|
||||||
redraw(left + " thanks for sharing your feels!")
|
redraw(left + " thanks for sharing your feels!")
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue