From f8c6f160f62a13f41132ff02cc5896fe03d09e58 Mon Sep 17 00:00:00 2001 From: endorphant Date: Sat, 13 Oct 2018 18:50:44 -0400 Subject: [PATCH] adding sublist checker --- ttbp/ttbp.py | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/ttbp/ttbp.py b/ttbp/ttbp.py index 61d004b..dedbff2 100644 --- a/ttbp/ttbp.py +++ b/ttbp/ttbp.py @@ -704,6 +704,17 @@ def subscription_handler(intro=""): subprocess.call(["touch", config.SUBS]) subprocess.call(["chmod", "600", config.SUBS]) + subs_raw = [] + if os.path.isfile(config.SUBS): + for line in open(config.SUBS, "r"): + subs_raw.append(line.rstrip()) + + subs = [] + all_users = core.find_ttbps() + for name in subs_raw: + if name in all_users: + subs.append(name) + menuOptions = [ "view subscribed feed", "manage subscriptions" @@ -717,9 +728,13 @@ def subscription_handler(intro=""): if choice is not False: if choice == 0: - print(DUST) + if len(subs) > 0: + redraw("recent entries from your subscribed pals:") + view_subscribed_feed(subs) + else: + intro = "it doesn't look like you have any subscriptions to see! add pals with 'manage subscriptions' here." elif choice == 1: - print(DUST) + intro = DUST else: redraw() return @@ -1323,10 +1338,13 @@ def view_global_feed(): return -def view_subscribed_feed(): +def view_subscribed_feed(subs): ''' display list of most recent entries on user's subscribed list. ''' + (entries, metas)= feed_list(subs) + list_entries(metas, entries, "recent entries from your subscribed pals:") + redraw() return