organizes the motif index and starts work on search bar
This commit is contained in:
parent
50752c32fd
commit
90a4e3c8f3
48
app.py
48
app.py
@ -25,6 +25,47 @@ def homepage():
|
||||
|
||||
return flask.render_template('home.html')
|
||||
|
||||
# SEARCH RESULTS
|
||||
|
||||
@app.route('/search')
|
||||
def searchpage():
|
||||
|
||||
db = openbook()
|
||||
|
||||
searchargs = flask.request.args['q']
|
||||
|
||||
searchresult = db.execute('''
|
||||
select
|
||||
'song', id, name
|
||||
from
|
||||
song
|
||||
where
|
||||
name
|
||||
like
|
||||
'%' || ? || '%'
|
||||
union all
|
||||
select
|
||||
'album', id, name
|
||||
from
|
||||
album
|
||||
where
|
||||
name
|
||||
like
|
||||
'%' || ? || '%'
|
||||
''',
|
||||
(searchargs,searchargs)
|
||||
).fetchall()
|
||||
|
||||
return flask.render_template('',
|
||||
album_info=album_info,
|
||||
song_info=song_info
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# SONG INDEX
|
||||
|
||||
@app.route('/song')
|
||||
@ -87,7 +128,7 @@ def motifindex():
|
||||
group by
|
||||
category.id, category.name
|
||||
order by
|
||||
count(category.id) desc
|
||||
category.id
|
||||
''').fetchall()
|
||||
|
||||
motif_info = db.execute('''
|
||||
@ -102,7 +143,7 @@ def motifindex():
|
||||
group by
|
||||
id, name, category
|
||||
order by
|
||||
id
|
||||
clip.song_id
|
||||
''').fetchall()
|
||||
|
||||
return flask.render_template('motifindex.html',
|
||||
@ -270,8 +311,7 @@ def songpage(id):
|
||||
where
|
||||
song_id = ?
|
||||
order by
|
||||
feature desc,
|
||||
song_id
|
||||
start_ms
|
||||
''',
|
||||
(id,)
|
||||
).fetchall()
|
||||
|
||||
BIN
reference.ods
BIN
reference.ods
Binary file not shown.
Binary file not shown.
@ -153,7 +153,7 @@ a{
|
||||
background: lch(25% 40 45);
|
||||
display: flex;
|
||||
flex: auto;
|
||||
justify-content: right;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.motif-box span{
|
||||
@ -162,10 +162,19 @@ a{
|
||||
|
||||
}
|
||||
|
||||
.motif-name::before{
|
||||
content: "T";
|
||||
margin-right: 2rem;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.motif-name{
|
||||
text-align: center;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.motif-count{
|
||||
|
||||
position: absolute, right;
|
||||
text-align: right;
|
||||
width: 2rem;
|
||||
}
|
||||
@ -7,6 +7,7 @@
|
||||
<meta name="description" content="Listen to the motifs of Final Fantasy XIV's soundtrack." />
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}" />
|
||||
<link rel="icon" sizes="16x16 32x32 48x48" type="image/png" href="" />
|
||||
<script src="https://unpkg.com/htmx.org@1.9.2" integrity="sha384-L6OqL9pRWyyFU3+/bjdSri+iIphTN/bvYyM37tICVyOJkWZLpP2vGn6VUEXgzg6h" crossorigin="anonymous"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
@ -1,9 +1,5 @@
|
||||
{% block footer %}
|
||||
|
||||
<footer>
|
||||
|
||||
<p> The footer will be in here, when it's ready. </p>
|
||||
|
||||
</footer>
|
||||
|
||||
{% endblock footer %}
|
||||
</footer>
|
||||
@ -1,5 +1,3 @@
|
||||
{% block navheader %}
|
||||
|
||||
<header>
|
||||
<nav>
|
||||
<ul class="top-buttons">
|
||||
@ -8,6 +6,15 @@
|
||||
<li><a href="{{ url_for('motifindex') }}">Motifs</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
<input
|
||||
type="search"
|
||||
name="q"
|
||||
placeholder="Search..."
|
||||
hx-get="/search"
|
||||
hx-trigger="search"
|
||||
hx-target="#search-results"
|
||||
/>
|
||||
<div id="search-results"></div>
|
||||
|
||||
</header>
|
||||
|
||||
{% endblock %}
|
||||
0
templates/searchresults.html
Normal file
0
templates/searchresults.html
Normal file
Loading…
Reference in New Issue
Block a user