mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Minor improvements
This commit is contained in:
parent
86f8d5a3eb
commit
98ec5885e7
@ -486,25 +486,25 @@ def timestamp_desc(t,short=False):
|
|||||||
|
|
||||||
timeobj = datetime.fromtimestamp(t,tz=TIMEZONE)
|
timeobj = datetime.fromtimestamp(t,tz=TIMEZONE)
|
||||||
|
|
||||||
if short:
|
if not short: return timeobj.strftime(get_settings("TIME_FORMAT"))
|
||||||
difference = int(datetime.now().timestamp() - t)
|
|
||||||
|
|
||||||
thresholds = (
|
difference = int(datetime.now().timestamp() - t)
|
||||||
(10,"just now"),
|
|
||||||
(2*60,f"{difference} seconds ago"),
|
thresholds = (
|
||||||
(2*60*60,f"{difference/60:.0f} minutes ago"),
|
(10,"just now"),
|
||||||
(2*24*60*60,f"{difference/(60*60):.0f} hours ago"),
|
(2*60,f"{difference} seconds ago"),
|
||||||
(5*24*60*60,f"{timeobj.strftime('%A')}"),
|
(2*60*60,f"{difference/60:.0f} minutes ago"),
|
||||||
(31*24*60*60,f"{difference/(60*60*24):.0f} days ago"),
|
(2*24*60*60,f"{difference/(60*60):.0f} hours ago"),
|
||||||
(12*31*24*60*60,f"{timeobj.strftime('%B')}"),
|
(5*24*60*60,f"{timeobj.strftime('%A')}"),
|
||||||
(math.inf,f"{timeobj.strftime('%Y')}")
|
(31*24*60*60,f"{difference/(60*60*24):.0f} days ago"),
|
||||||
)
|
(12*31*24*60*60,f"{timeobj.strftime('%B')}"),
|
||||||
|
(math.inf,f"{timeobj.strftime('%Y')}")
|
||||||
|
)
|
||||||
|
|
||||||
|
for t,s in thresholds:
|
||||||
|
if difference < t: return s
|
||||||
|
|
||||||
for t,s in thresholds:
|
|
||||||
if difference < t: return s
|
|
||||||
|
|
||||||
else:
|
|
||||||
return timeobj.strftime(get_settings("TIME_FORMAT"))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
<span class="button" onclick="scrobbleNew(event)">Scrobble!</span>
|
<span class="button" onclick="scrobbleNew(event)">Scrobble!</span>
|
||||||
<span class="button" onclick="repeatLast()">Last Manual Scrobble</span>
|
<span class="button" onclick="repeatLast()">↻</span>
|
||||||
|
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
|
@ -16,15 +16,17 @@
|
|||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
Kazuma, Aqua, Darkness and Megumin have been dispatched to deal with this situation.<br/><br/>
|
||||||
{% if adminmode %}
|
{% if adminmode %}
|
||||||
You are only seeing this information because you are in admin mode:
|
You are only seeing this information because you are in admin mode:
|
||||||
<br/><br/>
|
<br/><br/>
|
||||||
<div style="white-space: pre-wrap; font-family: monospace;">{% autoescape true -%}
|
<div style="white-space: pre-wrap; font-family: monospace;">{% autoescape true -%}
|
||||||
{{ traceback }}
|
{{ traceback }}
|
||||||
{%- endautoescape %}</div>
|
{%- endautoescape %}</div>
|
||||||
{% else %}
|
<br/><br/>
|
||||||
Kazuma, Aqua, Darkness and Megumin have been dispatched to deal with this situation.
|
If you think this shouldn't have happened, consider
|
||||||
|
<a class='textlink' href="https://github.com/krateng/maloja/issues/new">opening an issue</a>
|
||||||
|
describing the situation.
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user