mirror of
https://github.com/bvanroll/startrek-ml.git
synced 2025-08-29 03:52:47 +00:00
NeedToLearnToQuit Being lazy and add spaces/enters to make thisjsonclear
This commit is contained in:
3
.vs/ProjectSettings.json
Normal file
3
.vs/ProjectSettings.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"CurrentProjectSetting": null
|
||||
}
|
BIN
.vs/slnx.sqlite
Normal file
BIN
.vs/slnx.sqlite
Normal file
Binary file not shown.
12
ConvertedExample.json
Normal file
12
ConvertedExample.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"Episode":{
|
||||
"Cast":["CastMember1", "CastMember2", "CastMember3"],
|
||||
"Scenes":{
|
||||
"1":{
|
||||
"SceneDescription":"The description of what is happening in the scene",
|
||||
"lines":[{"Character":"CastMember1","Line":"Line that iks said by CastMember1"},{"Character":"CastMember1","Line":"Line that is said by CastMember2"}]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,16 +1,57 @@
|
||||
import sys
|
||||
import json
|
||||
cast=[]
|
||||
Scenes = '"Scenes":{'
|
||||
|
||||
def CheckScene(sceneString):
|
||||
Data = '"lines":[{'
|
||||
linesEtc=sceneString = sceneString
|
||||
while(True):
|
||||
if (linesEtc.find("<p>") == -1 or linesEtc.find(":") == -1 or linesEtc.find("</p>") == -1):
|
||||
print("NO TAGS FOUND TO CREATE A LINE, MOVING ON TO THE NEXT ONE")
|
||||
break
|
||||
temp = linesEtc[linesEtc.find("<p>"):]
|
||||
temp = temp[:temp.find("</p>")]
|
||||
noBtag = temp.replace("<b>", "")
|
||||
noBtag = noBtag.replace("</b>", "")
|
||||
noBtag = noBtag[noBtag.find("<p>")+3:noBtag.find("</p>")]
|
||||
character = noBtag[:noBtag.find(":")]
|
||||
if not(character in cast):
|
||||
cast.append(character)
|
||||
line = noBtag[noBtag.find(":")+2:]
|
||||
line = line.replace('"', '\\"')
|
||||
if (len(character) == 0) or len(line) == 0:
|
||||
print("NO CHARACTER FOUND OR NO LINE FOUND,\n LINE = " + line + "\n BY = " + character)
|
||||
break
|
||||
Data = Data+'"Character":"'+character+'","Line":"'+line+'"},{'
|
||||
linesEtc=linesEtc[len(noBtag):]
|
||||
Data=Data[:len(Data)-2]+"]"
|
||||
return Data
|
||||
|
||||
|
||||
file = sys.argv[1]
|
||||
with open(file, "r") as infile:
|
||||
script=infile.read().replace('\n', '\\n')
|
||||
SceneCounter = 1
|
||||
while (True):
|
||||
if(script.find("[Scene:") == -1):
|
||||
break
|
||||
TestFromSceneOn = script[script.find("[Scene:"):]
|
||||
tempEndOfScript= script[:script.find("[Scene:")]
|
||||
print(tempEndOfScript)
|
||||
script = TestFromSceneOn[script.find("[Scene:")+7:]
|
||||
print("END OF TEST")
|
||||
print(TestFromSceneOn)
|
||||
TestFromSceneOn = script[script.find("[Scene:")+7:]
|
||||
tempEndOfScript= TestFromSceneOn[:TestFromSceneOn.find("[Scene:")]
|
||||
Desc = tempEndOfScript[:tempEndOfScript.find("]")]
|
||||
ToConvLines=tempEndOfScript[tempEndOfScript.find("]"):]
|
||||
Lines = CheckScene(ToConvLines)
|
||||
Scenes = Scenes+'"'+str(SceneCounter)+'":{"SceneDescription":"'+Desc+'"},'+Lines+"},"
|
||||
script = TestFromSceneOn[TestFromSceneOn.find("[Scene:")+7:]
|
||||
SceneCounter = SceneCounter+1
|
||||
Scenes = Scenes[:len(Scenes)-1]+"}"
|
||||
castStr='"'
|
||||
for member in cast:
|
||||
if(len(member) > 25):
|
||||
continue
|
||||
castStr=castStr+member+'","'
|
||||
castStr = castStr[:len(castStr)-2]+']'
|
||||
with open(file+".json", "w+") as outfile:
|
||||
outfile.write('{"Episode":{"Cast":['+castStr+','+Scenes+'}')
|
||||
|
||||
#print(TestFromSceneOn)
|
||||
|
43
The One After Ross Says Rachel.html.json
Normal file
43
The One After Ross Says Rachel.html.json
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user