@app.route("/")
def index():
users = [row["username"] for row in query_db("select username from users")]
- return render_template("index.html", users=users)
+ songs = Song.get_latest(50)
+ song_list = render_template("song-list.html", songs=songs)
+ return render_template("index.html", users=users, song_list=song_list)
@app.get("/signup")
def signup_get():
def get_all_for_tag(cls, tag):
return cls._from_db(f"select * from song_tags inner join songs on song_tags.songid = songs.songid inner join users on songs.userid = users.userid where (tag = ?)", [tag])
+ @classmethod
+ def get_latest(cls, count):
+ return cls._from_db("select * from songs inner join users on songs.userid = users.userid order by songs.created desc limit ?", [count])
+
@classmethod
def _from_db(cls, query, args=()):
songs_data = query_db(query, args)
<!DOCTYPE HTML>
<html>
<head>
- <title>{% block title %} Base {% endblock %}</title>
+ <title>{% block title %}{% endblock %}</title>
<link rel="stylesheet" href="/static/styles.css">
<script src="/static/player.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1">
{% extends "base.html" %}
+{% block title %}Little Song Place{% endblock %}
+
{% block body %}
+<h2>A Brief Introduction</h2>
+
<p>Hello, and welcome!</p>
-<p>Check out the music of the fine folks below! If you create an account, you'll show up here too. :)</p>
+<p>
+I created this website because I wanted a little place where a few friends can
+share songs with each other. There are lots of <em>big</em> places for this
+already of course, but they all feel too cold and impersonal to me. I figure
+maybe some of you also feel the same way, so I made this little song place just
+for us.
+</p>
+
+<p>
+At present it's very basic - you can listen to the newest songs here on the
+home page, or go to someone's profile to listen to all of their music. There
+are no likes, comments, followers, or play counts. Maybe someday there will
+be, or maybe we'll discover we don't need them. I'm open to any thoughts or
+feedback you might have! Just send me (cfull) a message on Discord. :)
+</p>
-<h2>Lovely Humans:</h2>
+<p>Check out the music of the fine folks below! If you create an account, you'll show up here too.</p>
+
+<h2>Profiles</h2>
{% for user in users %}
<a href="/users/{{ user }}">{{ user }}</a><br>
{% endfor %}
+<h2>Recently Uploaded Songs</h2>
+{{ song_list|safe }}
+
{% endblock %}
{% extends "base.html" %}
-{% block title %}Login{% endblock %}
+{% block title %}Sign In{% endblock %}
{% block body %}
{% extends "base.html" %}
-{% block title %}{{ name }}'s Profile{% endblock %}
+{% block title %}{{ name }}'s profile{% endblock %}
{% block body %}