feat: add human-readable datetime filter and update playlist info template

This commit is contained in:
Kamil
2024-12-18 09:00:12 +00:00
parent b9530a159c
commit 917ec9542f
2 changed files with 7 additions and 2 deletions

View File

@@ -97,3 +97,8 @@ def jellyfin_link(jellyfin_id: str) -> Markup:
link = f"{jellyfin_server_url}/web/#/details?id={jellyfin_id}" link = f"{jellyfin_server_url}/web/#/details?id={jellyfin_id}"
return Markup(f'<a href="{link}" target="_blank">{jellyfin_id}</a>') return Markup(f'<a href="{link}" target="_blank">{jellyfin_id}</a>')
# A template filter for displaying a datetime in a human-readable format
@template_filter('human_datetime')
def human_datetime(dt) -> str:
return dt.strftime('%Y-%m-%d %H:%M:%S')

View File

@@ -7,7 +7,7 @@
<h1>{{ item.name }}</h1> <h1>{{ item.name }}</h1>
<p>{{ item.description }}</p> <p>{{ item.description }}</p>
<p>{{ item.track_count }} songs, {{ total_duration }}</p> <p>{{ item.track_count }} songs, {{ total_duration }}</p>
<p>Last Updated: {{ item.last_updated}} | Last Change: {{ item.last_changed}}</p> <p>Last Updated: {{ item.last_updated | human_datetime}} | Last Change: {{ item.last_changed | human_datetime}}</p>
{% include 'partials/_add_remove_button.html' %} {% include 'partials/_add_remove_button.html' %}
{% if session['is_admin'] and item.jellyfin_id %} {% if session['is_admin'] and item.jellyfin_id %}
<p> <p>