]> littlesong.place Git - littlesongplace.git/commitdiff
Home page update and minor tweaks
authorChris Fulljames <christianfulljames@gmail.com>
Sun, 19 Jan 2025 02:40:22 +0000 (21:40 -0500)
committerChris Fulljames <christianfulljames@gmail.com>
Sun, 19 Jan 2025 02:40:22 +0000 (21:40 -0500)
main.py
templates/base.html
templates/index.html
templates/login.html
templates/profile.html

diff --git a/main.py b/main.py
index f9d6375d047ca4e24c471ac0fb3910e98c4533fa..5bdf722343c2315ee46194266fd90d64f049989a 100644 (file)
--- a/main.py
+++ b/main.py
@@ -45,7 +45,9 @@ app.logger.addHandler(handler)
 @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():
@@ -529,6 +531,10 @@ class Song:
     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)
index ac7708bc03fa65deb2f06269141b53b55501cc12..0a99afcfeb4d6fe6584d2e789b444606d72d2d0a 100644 (file)
@@ -1,7 +1,7 @@
 <!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">
index 2e802c734065345cb6e8cdf6b76309b1a472c0f0..7800dbd979b43e90289bfdfe1b68e171e6b94d00 100644 (file)
@@ -1,14 +1,37 @@
 {% 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 %}
index 40d095e89d4ab51b46b40a28830e05fc9034ed72..a44e65b743719514c8c5cbdd2fb3188ebff5c0c5 100644 (file)
@@ -1,6 +1,6 @@
 {% extends "base.html" %}
 
-{% block title %}Login{% endblock %}
+{% block title %}Sign In{% endblock %}
 
 {% block body %}
 
index f605ff67b51a3e2ab2fbfd288eb030a77a30db35..9662de4fabb8aa89c35f8ecebbc3ee8f9e93684e 100644 (file)
@@ -1,6 +1,6 @@
 {% extends "base.html" %}
 
-{% block title %}{{ name }}'s Profile{% endblock %}
+{% block title %}{{ name }}'s profile{% endblock %}
 
 {% block body %}