diff --git a/.gitignore b/.gitignore index 2bacb64..0eec845 100644 --- a/.gitignore +++ b/.gitignore @@ -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/ \ No newline at end of file diff --git a/app/models.py b/app/models.py index da09d1d..45c8925 100644 --- a/app/models.py +++ b/app/models.py @@ -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)