Refactoring

This commit is contained in:
Sweetbread committed 2026-02-07 18:39:58 +03:00
1 parent 0f5d1b5221
commit db11fabe1a
5 files changed
+120 -89

No files matched your search

@@ -10,25 +10,23 @@
</div>
{% endmacro %}
{% if lb_now.data and lb.data %}
<div
class="block"
hx-get="/m/listenbrainz"
hx-trigger="every 15s"
hx-swap="outerHTML"
hx-headers='{
"If-Modified-Since": {{ (lb_now.last_updated, lb.last_updated) | max | int }},
"If-None-Match": "{{ lb_etag() }}"
"If-Modified-Since": {{ lb.last_updated | int }},
"If-None-Match": "{{ lb.etag }}"
}'
>
<h2><a href="https://listenbrainz.org/user/risdeveau/">Listenbrainz</a></h2>
{% if lb_now.data and lb_now.data.listens.0 %}
{{ track_block(lb_now.data.listens.0, is_active=true) }}
{% if lb.caches.now.data and lb.caches.now.data.listens.0 %}
{{ track_block(lb.caches.now.data.listens.0, is_active=true) }}
{% endif %}
{% if lb.data and lb.data.listens %}
{% for track in lb.data.listens %}
{% if lb.caches.listens.data and lb.caches.listens.data.listens %}
{% for track in lb.caches.listens.data.listens %}
{{ track_block(track) }}
{% endfor %}
{% endif %}
</div>
{% endif %}
+8 -8
View File
@@ -4,15 +4,15 @@
hx-trigger="every 1m"
hx-swap="outerHTML"
hx-headers='{
"If-Modified-Since": {{ (recent.last_updated, owned.last_updated) | max | int }},
"If-None-Match": "{{ steam_etag() }}"
"If-Modified-Since": {{ steam.last_updated | int }},
"If-None-Match": "{{ steam.etag }}"
}'
>
<h2><a href="https://steamcommunity.com/id/risdeveau">Steam</a></h2>
{% if recent.data.games %}
{% if steam.caches.recent.data.games %}
<h3>Recently played:</h3>
{% for g in recent.data.games %}
{% for g in steam.caches.recent.data.games %}
<a href="https://store.steampowered.com/app/{{ g.appid }}" class="block">
<picture>
<source media="(max-width: 45rem)" srcset="{{ g.v_cover }}">
@@ -31,12 +31,12 @@
</div>
</a>
{% endfor %}
<p>Last updated: {{ rtmsmp(recent.last_updated) }} ago</p>
<p>Last updated: {{ rtmsmp(steam.caches.recent.last_updated) }} ago</p>
{% endif %}
{% if owned.data.games %}
{% if steam.caches.owned.data.games %}
<h3>Top played games:</h3>
{% set owned_games = owned.data.games | sort(attribute="playtime_forever", reverse=true) %}
{% set owned_games = steam.caches.owned.data.games | sort(attribute="playtime_forever", reverse=true) %}
{% for g in owned_games[:5] %}
<a href="https://store.steampowered.com/app/{{ g.appid }}" class="block">
<picture>
@@ -58,6 +58,6 @@
</div>
</a>
{% endfor %}
<p>Last updated: {{ rtmsmp(owned.last_updated) }} ago</p>
<p>Last updated: {{ rtmsmp(steam.caches.owned.last_updated) }} ago</p>
{% endif %}
</div>