mirror of
https://github.com/Xevion/the-office.git
synced 2025-12-09 20:08:47 -06:00
fix quote pattern implementation, add deleted scene check
This commit is contained in:
5
.gitignore
vendored
5
.gitignore
vendored
@@ -2,6 +2,8 @@
|
||||
.vscode/**
|
||||
migrations/**
|
||||
app.db
|
||||
keys.json
|
||||
process.py
|
||||
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
@@ -131,5 +133,4 @@ venv.bak/
|
||||
dmypy.json
|
||||
|
||||
# Pyre type checker
|
||||
.pyre/
|
||||
keys.json
|
||||
.pyre/
|
||||
@@ -3,6 +3,7 @@ import re
|
||||
from app import db, login
|
||||
|
||||
episodes = [5, 6, 22, 23, 14, 26, 24, 24, 24, 23]
|
||||
quotePattern = r'(\w+):.+'
|
||||
|
||||
class Season(db.Model):
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
@@ -61,7 +62,9 @@ class Section(db.Model):
|
||||
def build(self, quotes, commit=False):
|
||||
"""given an List of unformatted script quotes, automatically creates Quotes assigned to this Section"""
|
||||
for quote in quotes:
|
||||
match = re.match()
|
||||
if quote.lower().startswith('deleted scene'):
|
||||
raise Exception(f'Deleted Scene Quote passed to Section Builder: "{quote}"')
|
||||
match = re.match(quotePattern, quote)
|
||||
assert match != None, f"Quote '{quote}' could not be processed."
|
||||
q = Quote(section=self, speaker=match[1], text=match[2])
|
||||
db.session.add(q)
|
||||
|
||||
Reference in New Issue
Block a user