fix quote pattern implementation, add deleted scene check

This commit is contained in:
Xevion
2020-01-19 22:41:08 -06:00
parent e1e5c82950
commit 798d05827f
2 changed files with 7 additions and 3 deletions

3
.gitignore vendored
View File

@@ -2,6 +2,8 @@
.vscode/**
migrations/**
app.db
keys.json
process.py
# Byte-compiled / optimized / DLL files
__pycache__/
@@ -132,4 +134,3 @@ dmypy.json
# Pyre type checker
.pyre/
keys.json

View File

@@ -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)