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