diff --git a/htmlgenerators.py b/htmlgenerators.py index bbe32a3..fa10d76 100644 --- a/htmlgenerators.py +++ b/htmlgenerators.py @@ -64,25 +64,22 @@ def getTimeDesc(timestamp,short=False): import datetime tim = datetime.datetime.utcfromtimestamp(timestamp) if short: - now = datetime.datetime.utcnow() - datestring = "" - if tim.year < now.year: - return str(tim.year) - if tim.month < now.month: - return tim.strftime("%B") - if tim.day+1 < now.day: - return tim.strftime("%d. %B") - if tim.day+1 == now.day: - return "yesterday" - if tim.hour+1 < now.hour: - return str(now.hour - tim.hour) + " hours ago" - if tim.minute+1 < now.minute: - return str(now.minute - tim.minute) + " minutes ago" - if tim.second+10 < now.second: - return str(now.second - tim.second) + " seconds ago" - - return "just now" - return tim.strftime("%d. %b %Y") + now = datetime.datetime.now(tz=datetime.timezone.utc) + difference = int(now.timestamp() - timestamp) + + if difference < 10: return "just now" + if difference < 60: return str(difference) + " seconds ago" + difference = int(difference/60) + if difference < 60: return str(difference) + " minutes ago" + difference = int(difference/60) + if difference < 24: return str(difference) + " hours ago" + difference = int(difference/24) + if difference < 7: return tim.strftime("%A") + if difference < 31: return str(difference) + " days ago" + #if difference < 300 and tim.year == now.year: return tim.strftime("%B") + #if difference < 300: return tim.strftime("%B %Y") + + return tim.strftime("%d. %B %Y") else: return tim.strftime("%d. %b %Y %I:%M %p") diff --git a/website/maloja.css b/website/maloja.css index 0bef41d..35a51d1 100644 --- a/website/maloja.css +++ b/website/maloja.css @@ -133,6 +133,7 @@ table td.icon { background-position:center; padding-right:6px;*/ padding:0px; + padding-right:5px; } table td.icon div { @@ -140,11 +141,12 @@ table td.icon div { height:20px; background-size:cover; background-position:center; - margin-right:4px; } table td.artists,td.artist,td.title { - width:500px; + /*width:500px;*/ + min-width:100px; + padding-right:15px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; diff --git a/website/start.html b/website/start.html index 54bf645..87d54fe 100644 --- a/website/start.html +++ b/website/start.html @@ -8,11 +8,6 @@ - - Scrobbles today KEY_SCROBBLES_TODAY -
Scrobbles this month KEY_SCROBBLES_MONTH -
Scrobbles overall KEY_SCROBBLES_TOTAL -

Top Artists

@@ -116,7 +111,11 @@

Last Scrobbles

- + Today KEY_SCROBBLES_TODAY + This month KEY_SCROBBLES_MONTH + This year KEY_SCROBBLES_YEAR + All Time KEY_SCROBBLES_TOTAL +

KEY_SCROBBLE_TIME