Skip to content

Instantly share code, notes, and snippets.

@axlan
Created August 13, 2022 16:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save axlan/426bf6cf54cb07629af6651a5bfc94c8 to your computer and use it in GitHub Desktop.
Save axlan/426bf6cf54cb07629af6651a5bfc94c8 to your computer and use it in GitHub Desktop.
Python for copying script into format for objection.lol save files.
from enum import Enum, auto
frame = '''{{
"id": -1,
"iid": {iid},
"text": "{text}",
"poseId": {poseId},
"pairPoseId": null,
"bubbleType": 0,
"username": "{name}",
"mergeNext": false,
"doNotTalk": false,
"goNext": false,
"poseAnimation": true,
"flipped": null,
"frameActions": [
{{
"actionId": 1,
"actionParam": "0"
}}
],
"frameFades": [],
"characterId": null,
"popupId": null,
"pairId": null,
"transition": null,
"filter": null
}}'''
class State(Enum):
TITLE = auto(),
TEXT = auto()
## Example transcript.txt:
#
# Mark Bankston
# One of the things you talked about yesterday is you complied with discovery, right?
# You said that on the witness stand.
#
# Alex Jones
# That's one of the things I talked about.
#
# Mark Bankston
# One of the things that you were ordered to do in this lawsuit, you were ordered to turn over any text messages mentioning Sandy Hook.
# Right?
with open('transcript.txt', 'r') as fd:
iid = 1
state = State.TITLE
frames = []
pose_map = {
'Alex Jones': 211,
'Mark Bankston': 4,
'Judge': 186,
}
name = None
text = []
for line in fd.readlines():
line = line.strip()
if len(line) == 0:
state = State.TITLE
frames.append(frame.format(iid=iid, text='\\n'.join(text), name=name, poseId=pose_map[name]))
iid += 1
text = []
elif state == State.TITLE:
name = line
state = State.TEXT
else:
text.append(line.replace('"', "'"))
with open('out.txt', 'w') as fd:
fd.write(',\n'.join(frames))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment