diff --git a/app.py b/app.py index b60900f..4da3510 100644 --- a/app.py +++ b/app.py @@ -10,17 +10,20 @@ app = flask.Flask('songbook') # db = sqlite3.connect("file:songbook.sqlite?mode=ro", uri=True) -# return flask.render_template('.jinja', +# return flask.render_template('.html', # ) # HOMEPAGE +def openbook(): + return sqlite3.connect("file:songbook.sqlite?mode=ro", uri=True) + @app.route('/') def homepage(): - return flask.render_template('home.jinja') + return flask.render_template('home.html') # SONG INDEX @@ -31,7 +34,7 @@ def song_redirect(): @app.route('/index') def songindex(): - db = sqlite3.connect("file:songbook.sqlite?mode=ro", uri=True) + db = openbook() album_info = db.execute(''' select @@ -56,7 +59,7 @@ def songindex(): track ''').fetchall() - return flask.render_template('songindex.jinja', + return flask.render_template('songindex.html', album_info=album_info, song_info=song_info ) @@ -66,7 +69,7 @@ def songindex(): @app.route('/motif') def motifindex(): - db = sqlite3.connect("file:songbook.sqlite?mode=ro", uri=True) + db = openbook() category_info = db.execute(''' select @@ -86,7 +89,7 @@ def motifindex(): id ''').fetchall() - return flask.render_template('motifindex.jinja', + return flask.render_template('motifindex.html', category_info = category_info, motif_info = motif_info ) @@ -96,7 +99,7 @@ def motifindex(): @app.route('/album/') def albumpage(id): - db = sqlite3.connect("file:songbook.sqlite?mode=ro", uri=True) + db = openbook() album_info = db.execute(''' select @@ -124,7 +127,7 @@ def albumpage(id): (id,) ).fetchall() - return flask.render_template('album.jinja', + return flask.render_template('album.html', album_info=album_info, song_info=song_info ) @@ -134,7 +137,7 @@ def albumpage(id): @app.route('/motif/') def motifpage(id): - db = sqlite3.connect("file:songbook.sqlite?mode=ro", uri=True) + db = openbook() # query motif @@ -163,12 +166,13 @@ def motifpage(id): where motif_id = ? order by + feature desc, song_id ''', (id,) ).fetchall() - return flask.render_template('motif.jinja', + return flask.render_template('motif.html', name=name, clip_info=clip_info ) @@ -178,7 +182,7 @@ def motifpage(id): @app.route('/song/') def songpage(id): - db = sqlite3.connect("file:songbook.sqlite?mode=ro", uri=True) + db = openbook() # query song name @@ -250,12 +254,13 @@ def songpage(id): where song_id = ? order by + feature desc, song_id ''', (id,) ).fetchall() - return flask.render_template('song.jinja', + return flask.render_template('song.html', name=name, id=id, album_info=album_info, diff --git a/reference_clips.ods b/reference_clips.ods index 69fca46..6246d33 100644 Binary files a/reference_clips.ods and b/reference_clips.ods differ diff --git a/static/style.css b/static/style.css index e69de29..c10a07b 100644 --- a/static/style.css +++ b/static/style.css @@ -0,0 +1,2 @@ +body{max-width:50rem;margin-left:auto;margin-right:auto;} +nav{} \ No newline at end of file diff --git a/templates/album.html b/templates/album.html new file mode 100644 index 0000000..86d0853 --- /dev/null +++ b/templates/album.html @@ -0,0 +1,16 @@ +{% extends "nav.html" %} +{% block title %}{{ album_info[0] }}{% endblock %} + +{% block content %} + +

{{ album_info[0] }}

+

Released: {{ album_info[1] }} + + +

+ +{% endblock %} \ No newline at end of file diff --git a/templates/album.jinja b/templates/album.jinja deleted file mode 100644 index c6bb87a..0000000 --- a/templates/album.jinja +++ /dev/null @@ -1,16 +0,0 @@ -{% extends "nav.jinja" %} -{% block title %}{{ album_info[0] }}{% endblock %} - -{% block content %} - -

{{ album_info[0] }}

-

Released: {{ album_info[1] }} - - -

- -{% endblock %} \ No newline at end of file diff --git a/templates/base.html b/templates/base.html new file mode 100644 index 0000000..cf2dc21 --- /dev/null +++ b/templates/base.html @@ -0,0 +1,17 @@ + + + + + {% block title %}{% endblock %} - Eorzea Songbook + + + + + + + + {% block basecontent %}{% endblock %} + + + + \ No newline at end of file diff --git a/templates/base.jinja b/templates/base.jinja deleted file mode 100644 index 39999e7..0000000 --- a/templates/base.jinja +++ /dev/null @@ -1,17 +0,0 @@ - - - - - {% block title %}{% endblock %} - Eorzea Songbook - - - - - - - - {% block basecontent %}{% endblock %} - - - - \ No newline at end of file diff --git a/templates/home.jinja b/templates/home.html similarity index 88% rename from templates/home.jinja rename to templates/home.html index 8c27b95..bf0111d 100644 --- a/templates/home.jinja +++ b/templates/home.html @@ -1,4 +1,4 @@ -{% extends "base.jinja" %} +{% extends "base.html" %} {% block title %}Home{% endblock %} {% block basecontent %} diff --git a/templates/motif.html b/templates/motif.html new file mode 100644 index 0000000..cb96ad7 --- /dev/null +++ b/templates/motif.html @@ -0,0 +1,23 @@ +{% extends "nav.html" %} + +{% block title %}{{ name }}{% endblock %} + +{% block content %} +

Motif: {{ name }}

+ + + +

Clips:

+
    +{% for song_id, motif_id, song in clip_info %} +
  • + + {{ song }} +
  • +{% endfor %} +
+ +{% endblock %} \ No newline at end of file diff --git a/templates/motif.jinja b/templates/motif.jinja deleted file mode 100644 index e592fc7..0000000 --- a/templates/motif.jinja +++ /dev/null @@ -1,22 +0,0 @@ -{% extends "nav.jinja" %} - -{% block title %}{{ name }}{% endblock %} - -{% block content %} -

Motif: {{ name }}

- - - -

Clips:

-
    -{% for song_id, motif_id, song in clip_info %} -
  • - - {{ song }} -
  • -{% endfor %} - -{% endblock %} \ No newline at end of file diff --git a/templates/motifindex.jinja b/templates/motifindex.html similarity index 80% rename from templates/motifindex.jinja rename to templates/motifindex.html index c865406..119f4f5 100644 --- a/templates/motifindex.jinja +++ b/templates/motifindex.html @@ -1,4 +1,4 @@ -{% extends "nav.jinja" %} +{% extends "nav.html" %} {% block title %}Motif Index{% endblock %} {% block content %} @@ -7,7 +7,7 @@

    {{ name }}

      {% for motif_id, motif, category in motif_info if category == category_id %} -
    • {{ motif }}
    • +
    • {{ motif }}
    • {% endfor %}
    {% endfor %} diff --git a/templates/nav.html b/templates/nav.html new file mode 100644 index 0000000..131d284 --- /dev/null +++ b/templates/nav.html @@ -0,0 +1,23 @@ +{% extends "base.html" %} + +{% block basecontent %} + +
    + +
    + +{% block content %}{% endblock %} + +
    + +

    The footer will be in here, when it's ready.

    + +
    + +{% endblock basecontent %} \ No newline at end of file diff --git a/templates/nav.jinja b/templates/nav.jinja deleted file mode 100644 index 044fe5b..0000000 --- a/templates/nav.jinja +++ /dev/null @@ -1,18 +0,0 @@ -{% extends "base.jinja" %} - -{% block basecontent %} - -
    - -

    The header will be in here. For now, click here to go back to the home page.

    - -
    -{% block content %}{% endblock %} - -
    - -

    The footer will be in here, when it's ready.

    - -
    - -{% endblock basecontent %} \ No newline at end of file diff --git a/templates/song.jinja b/templates/song.html similarity index 64% rename from templates/song.jinja rename to templates/song.html index 243c2d5..0d3bf7b 100644 --- a/templates/song.jinja +++ b/templates/song.html @@ -1,4 +1,4 @@ -{% extends "nav.jinja" %} +{% extends "nav.html" %} {% block title %}{{ name }}{% endblock %} {% block content %} @@ -10,7 +10,7 @@

    Artist:

      {% for name, name_rm, credit in artist_info %} -
    • {{ name_rm }} ({{ name }}): {{ credit }}
    • +
    • {{ name_rm }} ({{ name }}): {{ credit }}
    • {% endfor %}
    @@ -28,13 +28,13 @@

    Clips:

    {% endblock %} diff --git a/templates/songindex.jinja b/templates/songindex.html similarity index 66% rename from templates/songindex.jinja rename to templates/songindex.html index 2467ffe..a84b5db 100644 --- a/templates/songindex.jinja +++ b/templates/songindex.html @@ -1,4 +1,4 @@ -{% extends "nav.jinja" %} +{% extends "nav.html" %} {% block title %}Song Index{% endblock %} {% block content %} @@ -7,7 +7,7 @@

    {{ name }}

    {% endfor %}