ongoing_events, upcoming_events, _, _ = jams._sort_events(all_events)
app.logger.info(f"Homepage jams in {time.perf_counter() - start} seconds")
+ random_songs = songs.get_random(3)
+
# Group songs by userid
start = time.perf_counter()
page_songs = songs.get_latest(100)
page = render_template(
"index.html",
users=all_users,
+ random_songs=random_songs,
songs_by_user=songs_by_user,
page_title=title,
ongoing_events=ongoing_events,
{% endfor %}
</div>
-<h2>hot new tunes</h2>
{%- from "song-macros.html" import song_list %}
+<h2>human music</h2>
+
+{{ song_list(random_songs, current_user_playlists) }}
+
+<h2>hot new tunes</h2>
{%- for songs in songs_by_user %}
<div class="upload-block">
{% block body %}
<h1>site news</h1>
+<h2>2025-07-24 - Random Homepage Songs</h2>
+<p>
+The homepage now shows a few random songs before the hot new tunes.
+</p>
<h2>2025-07-24 - Server Updates</h2>
<p>
songs = get_song_list_from_page(client, "/")
# Newest first (all songs)
- assert len(songs) == 2
- assert songs[0]["title"] == "song2"
- assert songs[0]["username"] == "user2"
+ assert len(songs) == 4 # Includes random songs (both)
+ assert songs[2]["title"] == "song2"
+ assert songs[2]["username"] == "user2"
- assert songs[1]["title"] == "song1"
- assert songs[1]["username"] == "user1"
+ assert songs[3]["title"] == "song1"
+ assert songs[3]["username"] == "user1"
# Songs by tag #################################################################