From 52496aaf5145b17d928386d4d3e31479b3b82fbc Mon Sep 17 00:00:00 2001 From: endorphant Date: Sun, 25 Feb 2018 00:16:37 -0500 Subject: [PATCH 1/2] quick patch to catch oserror if someone deletes their .ttbp directory --- ttbp-manifesto.txt | 56 ----------------------------------------- ttbp/config/__init__.py | 11 ++++++-- ttbp/ttbp.py | 28 ++++++++++++++------- 3 files changed, 28 insertions(+), 67 deletions(-) delete mode 100644 ttbp-manifesto.txt diff --git a/ttbp-manifesto.txt b/ttbp-manifesto.txt deleted file mode 100644 index e35dc9d..0000000 --- a/ttbp-manifesto.txt +++ /dev/null @@ -1,56 +0,0 @@ -TTBP MANIFESTO --------------- -ttbp: tilde town blogging platform; also known as THE FEELS ENGINE - -a history: - - in april 2016, i read a short rant by ~minerobber lamenting the lack of cli - blogging software. this struck a chord with me; years ago, i kludged myself a - perl script that generated an html blog, complete with an rss feed and a - crude tagging system. i've known other people who have done the same. what's - missing, though? - - years ago, i peeled away from livejournal and related web-based blogging - networks; partially as a participant in the general attrition, and partially - to escape some personal bad feelings that i coudn't quite put a finger on. - this is why i started writing on an independent, solo blog; i still had the - urge to publicly share some of my journaling. but it felt lonely. - - this is what happens when i log in to a unix box: i reattach my screens, and - flip through irc to catch up on chat, and alpine to check my mail. in the - past, on non-tilde machines, i've fired up zephyr to message friends. i git - pull my repos for updates. i check the nethack leaderboard. these are all - cli-based actions, but they are also based on the idea that when i wasn't - looking, things changed. those things changed because other people performed - some actions of their own. i catch up on these updates with the implicit - acknowledgement that other humans exist and do things in my environment. - - this is what i realized i missed from running my own clumsy blog scripts. i - had ways to chat, mail, and collaborate on text-based projects through the - terminal, but nothing that served as a central hub for journal-writing. - - i didn't think of myself as a strong programmer or a skilled developer, but i - had a few ideas that i thought i could try out. on april 29th, 2016, i put - out a general call in irc for people to run ~endorphant/bin/ttbp; ~sl2c - confirmed that it worked. on may 2nd, 2016, i opened it up again, and others - jumped in; ~sanqui, ~karlen, ~varscite, ~vilmibm, ~insom, ~marcus, ~nossidge, - ~jumblesale, ~krowbar. others trickled in; people sent me crash reports, - wrote to me about mysterious behaviors, lamented about broken settings when i - pushed code updates, shared with me how this fulfilled their nostalgia for an - experience that i personally never had, complained about lacking features - they wanted, yelled with delight about the interface, filled it with feelings - they didn't know how to express. - - it's now december 4th, 2016, and there are 42 users on ttbp. some of them - have never posted, many of them i've never spoken to. there are 581 entries, - which is an average of almost 14 entries per user, and a little over two and - a half entries per day. it now takes 11 seconds to load the global feed - because i implemented it sloppily, thinking i'd handle scaling issues later. - - i've loved every second of this. i'm humbled and pleased and a little - terrified at the trust and appreciation and responsibility that's been given - to me in the past seven months. - -the backend: -lessons: -future work: diff --git a/ttbp/config/__init__.py b/ttbp/config/__init__.py index ad978c2..942400f 100644 --- a/ttbp/config/__init__.py +++ b/ttbp/config/__init__.py @@ -76,13 +76,13 @@ NOPUB = os.path.join(USER_CONFIG, "nopub") ## UI BANNER = ''' -__________________________________________________________ +___________________________________________________________ | | | the tilde.town | | ____ ____ ____ _ ____ ____ _ _ ____ _ _ _ ____ | | |___ |___ |___ | [__ |___ |\ | | __ | |\ | |___ | | | |___ |___ |___ ___] |___ | \| |__] | | \| |___ | -| ver 0.11.0 (rainbows) | +| ver 0.11.1 (rainbows) | |__________________________________________________________| '''.lstrip() @@ -139,4 +139,11 @@ version 0.9.3 features: * ~login created centralfeels, which is an opt-in collection of html-published feels; create a blank file called '.centralfeels' in your home directory if you'd like to be included!""", + "0.11.1": """ +~[version 0.11.1 update]~ + + * a quick patch to correct a directory listing error, nothing too + exciting + * general PSA: feel free to use the github repo for bugs/feature requests: + https://github.com/modgethanc/ttbp/issues""", } diff --git a/ttbp/ttbp.py b/ttbp/ttbp.py index 253e52b..90d867c 100644 --- a/ttbp/ttbp.py +++ b/ttbp/ttbp.py @@ -49,7 +49,7 @@ from . import chatter from . import gopher from . import util -__version__ = "0.11.0" +__version__ = "0.11.1" __author__ = "endorphant to explore your feels.\n\n") core.load(SETTINGS) @@ -636,7 +634,10 @@ def view_neighbors(users, prompt): url = config.LIVE+user+"/"+userRC.get("publish dir") ## find last entry - files = os.listdir(os.path.join("/home", user, ".ttbp", "entries")) + try: + files = os.listdir(os.path.join("/home", user, ".ttbp", "entries")) + except OSError: + files = [] files.sort() lastfile = "" for filename in files: @@ -917,7 +918,10 @@ def view_feed(): for townie in core.find_ttbps(): entryDir = os.path.join("/home", townie, ".ttbp", "entries") - filenames = os.listdir(entryDir) + try: + filenames = os.listdir(entryDir) + except OSError: + filenames = [] for entry in filenames: ## hardcoded display cutoff at 30 days @@ -1267,19 +1271,25 @@ you're all good to go, """+chatter.say("friend")+"""! please contact ~endorphant something strange happened to you during this update. """) - if z < 1 or y < 10: + if y < 10: # version 0.10.1 patch notes print(config.UPDATES["0.10.1"]) if y < 11: - # version 0.11.1 patch notes + # version 0.11.0 patch notes print(config.UPDATES["0.11.0"]) + if y < 11 or z < 1: + # version 0.11.1 patch notes + print(config.UPDATES["0.11.1"]) + confirm = "" while confirm not in ("x", "", "X", ""): confirm = raw_input("\nplease type when you've finished reading about the updates! ") + print("\n\n") + open(versionFile, "w").write(__version__) ##### From 5f4207d9761e9015560b1ce5a2b1af5290d7608c Mon Sep 17 00:00:00 2001 From: endorphant Date: Sun, 25 Feb 2018 16:26:58 -0500 Subject: [PATCH 2/2] swatting another listdir --- ttbp/core.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ttbp/core.py b/ttbp/core.py index 381d726..3c358c0 100644 --- a/ttbp/core.py +++ b/ttbp/core.py @@ -405,7 +405,10 @@ def www_neighbors(): url = config.LIVE+user+"/"+userRC["publish dir"] lastfile = "" - files = os.listdir(os.path.join("/home", user, ".ttbp", "entries")) + try: + files = os.listdir(os.path.join("/home", user, ".ttbp", "entries")) + except OSError: + files = [] files.sort() for filename in files: if valid(filename):