eyy, got friends to convert

This commit is contained in:
Beppe Vanrolleghem
2018-05-23 15:40:39 +02:00
parent 69426b1392
commit 0099a040b7
407 changed files with 106750 additions and 50 deletions

View File

@@ -4,11 +4,10 @@ cast=[]
Scenes = '"Scenes":{'
def CheckScene(sceneString):
Data = '"lines":[{'
linesEtc=sceneString = sceneString
Data = '\t\t\t"lines":['
linesEtc=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>")]
@@ -21,11 +20,10 @@ def CheckScene(sceneString):
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+'"},{'
Data = Data+'\n\t\t\t\t{"Character":"'+character+'","Line":"'+line+'"},'
linesEtc=linesEtc[len(noBtag):]
Data=Data[:len(Data)-2]+"]"
Data=Data[:len(Data)-1]+"]\n\t\t\t"
return Data
@@ -41,7 +39,7 @@ while (True):
Desc = tempEndOfScript[:tempEndOfScript.find("]")]
ToConvLines=tempEndOfScript[tempEndOfScript.find("]"):]
Lines = CheckScene(ToConvLines)
Scenes = Scenes+'"'+str(SceneCounter)+'":{"SceneDescription":"'+Desc+'"},'+Lines+"},"
Scenes = Scenes+'\n\t\t"'+str(SceneCounter)+'":{\n\t\t\t"SceneDescription":"'+Desc+'",\n'+Lines+"},"
script = TestFromSceneOn[TestFromSceneOn.find("[Scene:")+7:]
SceneCounter = SceneCounter+1
Scenes = Scenes[:len(Scenes)-1]+"}"
@@ -52,6 +50,6 @@ for member in cast:
castStr=castStr+member+'","'
castStr = castStr[:len(castStr)-2]+']'
with open(file+".json", "w+") as outfile:
outfile.write('{"Episode":{"Cast":['+castStr+','+Scenes+'}')
outfile.write('{"'+file+'":{\n\t"Cast":['+castStr+',\n\t'+Scenes[:len(Scenes)-1]+'\n}\n}\n}')
#print(TestFromSceneOn)