diff --git a/app/models.py b/app/models.py index 6d0debb..0267e51 100644 --- a/app/models.py +++ b/app/models.py @@ -103,8 +103,8 @@ class Episode(db.Model): def download(self, force=False): """downloads data""" - print(f'Downloading e{self.number}/s{self.season_id} from {self.link}') if not self.downloaded or force: + print(f'Downloading e{self.number}/s{self.season_id} from {self.link}') data = requests.get(self.link).text open(self.path, "w+", encoding="utf-8").write(data) diff --git a/app/routes.py b/app/routes.py index 751c8dc..7bbe10a 100644 --- a/app/routes.py +++ b/app/routes.py @@ -8,14 +8,13 @@ def index(): return render_template("view.html", seasons=Season.query.all()) -@app.route("/season//") +@app.route("/view//") def viewSeason(season): return render_template( "season.html", season=Season.query.filter_by(id=season).first_or_404() ) - -@app.route("/season///") +@app.route("/view///") def viewEpisode(season, episode): e = Episode.query.filter_by(season_id=season, number=episode).first_or_404() if not e.built: @@ -24,8 +23,14 @@ def viewEpisode(season, episode): return render_template("episode.html", episode=e) -@app.route("/season///rebuild") +@app.route("/rebuild///") def rebuildEpisode(season, episode): e = Episode.query.filter_by(season_id=season, number=episode).first_or_404() e.rebuild() return redirect(url_for("viewEpisode", season=season, episode=episode)) + +@app.route("/redownload///") +def redownloadEpisode(season, episode): + e = Episode.query.filter_by(season_id=season, number=episode).first_or_404() + e.download(force=True) + return redirect(url_for("viewEpisode", season=season, episode=episode)) \ No newline at end of file diff --git a/app/templates/base.html b/app/templates/base.html index 094edb7..c870a49 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -3,14 +3,12 @@ The Office Quotes{% if title %} - {{ title }}{% endif %} {% block head %} - - - + {% endblock head %} - {% block body %} - - {% endblock body %} +{% block body %} + +{% endblock body %} \ No newline at end of file diff --git a/app/templates/content.html b/app/templates/content.html index c1bf03c..297b809 100644 --- a/app/templates/content.html +++ b/app/templates/content.html @@ -2,41 +2,37 @@ {% block head %} {{ super() }} + .tab {margin-left: 2rem;} + {% endblock head %} {% block body %} {{ super() }} -
-
-
-
- Test -
-
-
-
- {% block content %} - {% endblock content %} -
-
-{#
#} +
+

The Office Quotes

+
+
Source for all The Office Quotes
+
+
+
+ {# Site Directory #} +
+
+ {# List of Seasons/Episodes #} + {% for season in seasons %} + Season {{ season.id }}
+ {% for episode in season.episodes %} + e{{ episode.number }} - "Episode Name"
+ {% endfor %} + {% endfor %} +
+
+ {# Main Body of Content #} +
+
+ {% block content %} + {% endblock content%} +
+
+
-
{% endblock body %} \ No newline at end of file diff --git a/app/templates/episode.html b/app/templates/episode.html index 0baf976..ae07437 100644 --- a/app/templates/episode.html +++ b/app/templates/episode.html @@ -6,22 +6,34 @@ text-align: left; color: black; } + .section { + padding: 1rem 1rem 1rem 2rem; + } {% endblock head %} {% block content %} -Go to Season {{ episode.season_id }} -
-Rebuild Episode -
-
-{% for section in episode.sections %} -
-

- {% for quote in section.quotes %} - {{ quote.speaker }}: {{ quote.text }} -
- {% endfor %} -

-
-{% endfor %} + {{ super() }}section + + + {% for section in episode.sections %} +
+

+ {% for quote in section.quotes %} + {{ quote.speaker }}: {{ quote.text }} +
+ {% endfor %} +

+
+ {% endfor %} + {% endblock content %} \ No newline at end of file diff --git a/app/templates/season.html b/app/templates/season.html index 1b0e761..3d8fb72 100644 --- a/app/templates/season.html +++ b/app/templates/season.html @@ -8,8 +8,8 @@ Season {{ season.id }}
{% for episode in season.episodes %} -Episode {{ episode.number }} -
+ Episode {{ episode.number }} +
{% endfor %} {% endblock content %} \ No newline at end of file diff --git a/app/templates/view.html b/app/templates/view.html index 408aea2..87ebaf4 100644 --- a/app/templates/view.html +++ b/app/templates/view.html @@ -1,8 +1,4 @@ {% extends 'content.html' %} {% block content %} {{ super() }} -{% for season in seasons %} -Season {{ season.id }} -
-{% endfor %} -{% endblock content %} \ No newline at end of file +{% endblock content %} \ No newline at end of file