diff --git a/bin/config/banner.txt b/bin/config/banner.txt index 51ed2f9..0e26950 100644 --- a/bin/config/banner.txt +++ b/bin/config/banner.txt @@ -5,6 +5,6 @@ | |___ |___ |___ | [__ |___ |\ | | __ | |\ | |___ | | | |___ |___ |___ ___] |___ | \| |__] | | \| |___ | | | -| ver 0.6 (fairly unstable) | +| ver 0.6.5 (fairly unstable) | | ~endorphant/projects/ttbp/changelog.txt | |__________________________________________________________| diff --git a/bin/ttbp.py b/bin/ttbp.py index 9a1639d..9ebf24c 100644 --- a/bin/ttbp.py +++ b/bin/ttbp.py @@ -10,6 +10,7 @@ import json import core import chatter import inflect +import util ## system globals SOURCE = os.path.join("/home", "endorphant", "projects", "ttbp", "bin") @@ -340,10 +341,12 @@ def view_neighbors(users): count += 1 lastfile = os.path.join("/home", user, ".ttbp", "entries", filename) - date = "" + ago = "never" if lastfile: last = os.path.getctime(lastfile) - date = time.strftime("%Y%m%d %H%M", time.localtime(last)) + #date = time.strftime("%Y%m%d %H%M", time.localtime(last)) + since = time.time()-last + ago = util.pretty_time(int(since)) + " ago" else: last = 0 @@ -354,7 +357,8 @@ def view_neighbors(users): if len(user) < 8: user += "\t" - userList.append(["\t"+user+"\t"+url+pad+"\t("+p.no("feel", count)+")", last]) + userList.append(["\t"+user+"\t"+url+pad+"\t("+ago+")", last]) + #userList.append(["\t"+user+"\t"+url+pad+"\t("+p.no("feel", count)+")", last]) #userList.append(["\t"+user+"\t"+url+pad+"\t("+p.no("feel", count)+") "+date, last]) # sort user by most recent entry diff --git a/bin/util.py b/bin/util.py new file mode 100644 index 0000000..2ab1ce1 --- /dev/null +++ b/bin/util.py @@ -0,0 +1,29 @@ +#!/usr/bin/python + +import inflect +import time + +p = inflect.engine() + +def pretty_time(time): + m, s = divmod(time, 60) + if m > 0: + h, m = divmod(m, 60) + if h > 0: + d, h = divmod(h, 24) + if d > 0: + w, d = divmod(d, 7) + if w > 0: + mo, w = divmod(w, 4) + if mo > 0: + return p.no("month", mo) + else: + return p.no("week", w) + else: + return p.no("day", d) + else: + return p.no("hour", h) + else: + return p.no("minute", m) + else: + return p.no("second", s) diff --git a/changelog.txt b/changelog.txt index a8ff911..877a13a 100644 --- a/changelog.txt +++ b/changelog.txt @@ -28,6 +28,10 @@ TO-DO: CHANGELOG: +ver 0.6.5 + -renamed FEELS ENGINE + -changed neighbor view to show last update time instead of feels count + ver 0.6 -improving exit handling -sort neighbor view by most recently updated