Révision 4

projets/TRS2SRT-standalone/src/org/txm/importer/transcriber/TRS2SRT.groovy (revision 4)
89 89
				currentSpeakers = parser.getAttributeValue(null, "speaker").split(" ")
90 90
				currentSpeaker = currentSpeakers[0]
91 91
				currentSpeach = ""
92
				currentStartTime = Float.parseFloat(parser.getAttributeValue(null, "startTime"))
93
				currentEndTime = Float.parseFloat(parser.getAttributeValue(null, "endTime"))
92
				String s = parser.getAttributeValue(null, "startTime")
93
				String e = parser.getAttributeValue(null, "endTime")
94
				currentStartTime = Float.parseFloat(s)
95
				if (e != null) currentEndTime = Float.parseFloat(e)
96
				else currentEndTime = currentStartTime+3.0; // temporary fix
94 97
				inTurn = true
95 98
				syncCounter = 0;
96 99
				whoCounter = 0;
......
102 105
			case "Sync": // cut a Turn, the Turn@endTime must be replace with Sync@time
103 106
				if (debug) println "Sync!"
104 107
				syncCounter++; 
105
				if (syncCounter > 1) { // ignore first 'Sync', there is no speach to write
108
				if (syncCounter > 1) { // ignore first 'Sync', there is no speech to write
106 109
					def end = currentEndTime
107 110
					currentEndTime = Float.parseFloat(parser.getAttributeValue(null, "time"))
108
					writeSRTTurn()
111
					writeSRTTurn() // write previous Turn, so currentEndTime is the Sync@time
109 112
					currentEndTime = end; // restore Turn@endTime
110 113
				}
111 114
				break;
......
160 163

  
161 164
		def s = formatTime(currentStartTime)
162 165
		def e = formatTime(currentEndTime)
166
		currentStartTime = currentEndTime
163 167
		writer.println """
164 168
$nTurn
165 169
$s --> $e
......
206 210
			println "java -jar TRS2SRT.jar file1 file2 file3"
207 211
			println "\nResult files are saved in the save directory as fileN files."
208 212
		}
209
		
213
	//	args = ["/home/mdecorde/CCC/RECETTE/TRS2SRT/victor/pazinterior_ok.trs"]
210 214
		for (String path : args) {
211 215
			println "Processing path=$path ..."
212 216
			

Formats disponibles : Unified diff