mirror of
https://github.com/Xevion/the-office.git
synced 2025-12-10 10:08:57 -06:00
add more text alignment fixes, create "unbuilt" parameter to track and build episodes as needed
This commit is contained in:
@@ -65,6 +65,7 @@ class Episode(db.Model):
|
|||||||
id = db.Column(db.Integer, primary_key=True) # arbitrary ID, should NOT be relied on to determine episode number or correlating season
|
id = db.Column(db.Integer, primary_key=True) # arbitrary ID, should NOT be relied on to determine episode number or correlating season
|
||||||
number = db.Column(db.Integer) # episode number
|
number = db.Column(db.Integer) # episode number
|
||||||
season_id = db.Column(db.Integer, db.ForeignKey('season.id')) # correlating season number
|
season_id = db.Column(db.Integer, db.ForeignKey('season.id')) # correlating season number
|
||||||
|
built = db.Column(db.Boolean, default=False)
|
||||||
sections = db.relationship('Section', backref='episode', lazy='dynamic') # sections of quotes under this episode
|
sections = db.relationship('Section', backref='episode', lazy='dynamic') # sections of quotes under this episode
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
@@ -97,9 +98,11 @@ class Episode(db.Model):
|
|||||||
s = Section(episode_id=self.id, deleted=deleted if isDeletedScene else -1, newpeat=isNewpeat)
|
s = Section(episode_id=self.id, deleted=deleted if isDeletedScene else -1, newpeat=isNewpeat)
|
||||||
s.build(quotes[1:] if isDeletedScene else quotes)
|
s.build(quotes[1:] if isDeletedScene else quotes)
|
||||||
db.session.add(s)
|
db.session.add(s)
|
||||||
|
self.built = True
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
def rebuild(self):
|
def rebuild(self):
|
||||||
|
"""functions that clears relevant sections from this Episode"""
|
||||||
self.clear()
|
self.clear()
|
||||||
self.build()
|
self.build()
|
||||||
|
|
||||||
@@ -109,6 +112,7 @@ class Episode(db.Model):
|
|||||||
print(f'Clearing {len(sections)} Sections of Ep {self.number} Season {self.season_id}')
|
print(f'Clearing {len(sections)} Sections of Ep {self.number} Season {self.season_id}')
|
||||||
for section in sections:
|
for section in sections:
|
||||||
section.clear(commit=False, delete=True)
|
section.clear(commit=False, delete=True)
|
||||||
|
self.built = False
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|||||||
@@ -12,7 +12,11 @@ def viewSeason(season):
|
|||||||
|
|
||||||
@app.route('/season/<season>/<episode>/')
|
@app.route('/season/<season>/<episode>/')
|
||||||
def viewEpisode(season, episode):
|
def viewEpisode(season, episode):
|
||||||
return render_template('episode.html', episode=Episode.query.filter_by(season_id=season, number=episode).first_or_404())
|
e = Episode.query.filter_by(season_id=season, number=episode).first_or_404()
|
||||||
|
if not e.built:
|
||||||
|
print('Rebuilding')
|
||||||
|
e.build()
|
||||||
|
return render_template('episode.html', episode=e)
|
||||||
|
|
||||||
@app.route('/season/<season>/<episode>/rebuild')
|
@app.route('/season/<season>/<episode>/rebuild')
|
||||||
def rebuildEpisode(season, episode):
|
def rebuildEpisode(season, episode):
|
||||||
|
|||||||
@@ -1,15 +1,26 @@
|
|||||||
{% extends 'content.html' %}
|
{% extends 'content.html' %}
|
||||||
|
{% block head %}
|
||||||
|
{{ super() }}
|
||||||
|
<style>
|
||||||
|
.quote {
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
{% endblock head %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<a href="{{ url_for('viewSeason', season=episode.season_id) }}" >Go to Season {{ episode.season_id }}</a>
|
<a href="{{ url_for('viewSeason', season=episode.season_id) }}">Go to Season {{ episode.season_id }}</a>
|
||||||
<br>
|
<br>
|
||||||
<a href="{{ url_for('rebuildEpisode', season=episode.season_id, episode=episode.number) }}">Rebuild Episode</a>
|
<a href="{{ url_for('rebuildEpisode', season=episode.season_id, episode=episode.number) }}">Rebuild Episode</a>
|
||||||
<br>
|
<br>
|
||||||
<br>
|
<br>
|
||||||
{% for section in episode.sections %}
|
{% for section in episode.sections %}
|
||||||
{% for quote in section.quotes %}
|
<div style="padding: 2rem 1rem 1rem 2rem;">
|
||||||
<b>{{ quote.speaker }}:</b> {{ quote.text }}
|
<p>
|
||||||
<br>
|
{% for quote in section.quotes %}
|
||||||
{% endfor %}
|
<span class="quote"><b>{{ quote.speaker }}:</b> {{ quote.text }}</span>
|
||||||
<br>
|
<br>
|
||||||
|
{% endfor %}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
Reference in New Issue
Block a user