breaking out feed display

master
endorphant 2018-10-12 21:14:28 -04:00
parent 2e871d59d1
commit 4b96158efc
1 changed files with 31 additions and 10 deletions

View File

@ -567,7 +567,7 @@ def main_menu():
view_neighbors(users, prompt) view_neighbors(users, prompt)
elif choice == '3': elif choice == '3':
redraw("most recent global entries") redraw("most recent global entries")
view_feed() view_global_feed()
elif choice == '4': elif choice == '4':
graffiti_handler() graffiti_handler()
elif choice == '5': elif choice == '5':
@ -1275,14 +1275,39 @@ def show_entry(filename):
return return
def view_feed(): def view_global_feed():
''' '''
generate and display list of most recent global entries display list of most recent global entries
'''
(entries, metas)= feed_list(core.find_ttbps())
list_entries(metas, entries, "recent global entries:")
redraw()
return
def view_subscribed_feed():
'''
display list of most recent entries on user's subscribed list.
'''
return
def feed_list(townies):
'''
given a list of townies, generate a list of 50 most recent entries within
the last 30 days. validates against townies with ttbp config files.
returns a tuple of (entries, metas)
''' '''
feedList = [] feedList = []
all_users = core.find_ttbps()
for townie in townies:
if townie not in all_users:
continue
for townie in core.find_ttbps():
entryDir = os.path.join("/home", townie, ".ttbp", "entries") entryDir = os.path.join("/home", townie, ".ttbp", "entries")
try: try:
filenames = os.listdir(entryDir) filenames = os.listdir(entryDir)
@ -1315,11 +1340,7 @@ def view_feed():
user=entry[5], pad=pad, date=entry[3], user=entry[5], pad=pad, date=entry[3],
wordcount=p.no("word", entry[2]))) wordcount=p.no("word", entry[2])))
list_entries(metas, entries, "recent global entries:") return entries, metas
redraw()
return
def graffiti_handler(): def graffiti_handler():
''' '''