tweaked neighbor view to show last update time instead of feels count
parent
92e2f3731e
commit
ed2a14b846
|
@ -5,6 +5,6 @@
|
|||
| |___ |___ |___ | [__ |___ |\ | | __ | |\ | |___ |
|
||||
| | |___ |___ |___ ___] |___ | \| |__] | | \| |___ |
|
||||
| |
|
||||
| ver 0.6 (fairly unstable) |
|
||||
| ver 0.6.5 (fairly unstable) |
|
||||
| ~endorphant/projects/ttbp/changelog.txt |
|
||||
|__________________________________________________________|
|
||||
|
|
10
bin/ttbp.py
10
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
|
||||
|
|
|
@ -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)
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue