Index: tmp/org.txm.groovy.core/src/groovy/org/txm/macro/transcription/SegmentTRSInSectionFromMarkerMacro.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/macro/transcription/SegmentTRSInSectionFromMarkerMacro.groovy	(revision 3029)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/macro/transcription/SegmentTRSInSectionFromMarkerMacro.groovy	(revision 3030)
@@ -10,9 +10,13 @@
 @Field @Option(name="trsDirectory", usage="Dossier qui contient les fichiers TRS", widget="Folder", required=true, def="")
 File trsDirectory;
 
+@Field @Option(name="resultDirectory", usage="Dossier résultat TRS", widget="Folder", required=true, def="")
+File resultDirectory;
+
 @Field @Option(name="newSectionMarker", usage="The marker, spaces included", widget="String", required=true, def=" *#")
 def newSectionMarker
 
+
 if (!ParametersDialog.open(this)) return;
 
 if (!trsDirectory.exists()) {
@@ -20,8 +24,7 @@
 	return
 }
 
-File outputDirectory = new File(trsDirectory, "out")
-println "Writing result to $outputDirectory..."
+println "Writing result to $resultDirectory..."
 
 dateTimeFormatter = DateTimeFormatter.ISO_LOCAL_TIME
 def strTotime(def str) {
@@ -44,14 +47,14 @@
 }
 
 try {
-	def trsFiles = trsDirectory.list(new FilenameFilter() { public boolean accept(File dir, String name) { return name.toLowerCase().endsWith(".trs"); } });
+	def trsFiles = trsDirectory.listFiles().findAll() { it.getName().toLowerCase().endsWith(".trs") }
 	
 	if (trsFiles.size() == 0) {
 		println "No TRS file to process in $trsDirectory"
 		return;
 	}
 	
-	ConsoleProgressBar cpb = new ConsoleProgressBar(sectionGroupsToInsert.keySet().size())
+	ConsoleProgressBar cpb = new ConsoleProgressBar(trsFiles.size())
 	for (File trsFile : trsFiles) {
 		cpb.tick()
 
@@ -68,7 +71,7 @@
 		def trsEpisode = trsEpisodes[0]
 		def trsSections =  trs.Episode.Section // 1
 		if (trsSections.size() > 1) {
-			println "multiple Section node in $trsFile"
+			println "Error: multiple Section node in $trsFile"
 			continue
 		}
 		def trsSection = trsSections[0]
@@ -76,51 +79,44 @@
 		def turns = trsSection.Turn
 		def newSections = []
 		def iSection = 0;
-		def currentSection = null
-		def currentNode = null
+		def previousSection = trsSection
+		def currentSection = trsSection
 		
-		for (def turn : turns) {
+		for (int iTurn = 0 ; iTurn < turns.size() ; iTurn++) {
+			def turn = turns[iTurn]
 			def start = Float.parseFloat(turn.@startTime)
 			def end = Float.parseFloat(turn.@endTime)
 			
-			def found = null
-			for (int i = iSection ; i < sections.size() ; i++) {
-				if (end < sections[i][0]) { // Turn is before section
-					
-				} else if (sections[i][1] < start) { // Turn is before section
-					
-				} else {
-					found = sections[i]
-					iSection = i
-					break // stop searching and set iSection to accelerate next search
-				}
-			}
-			
-			if (found == null) {
-				if (currentSection != null || currentNode == null) {
-					currentNode = new Node(trsEpisode, "Section", ["type":"Sujet non synchronisé", "startTime":turn.@startTime, "endTime":"", "synchronized":"false"] )
-					currentSection = null;
-				}
-			} else {
-				if (found != currentSection) {
-					if (currentNode != null && currentNode.@synchronized == "false") {
-						def tmp = currentNode.Turn
-						currentNode.@endTime = tmp[-1].@endTime
+			String content = turn.text().trim()
+			println "TURN: "+content
+			if (content.startsWith(newSectionMarker)) {
+				println "NEW SECTION !"
+				previousSection = currentSection
+				currentSection = new Node(trsEpisode, "Section", new LinkedHashMap(["type":newSectionMarker, "startTime":turn.@startTime, "endTime":previousSection.attributes()["endTime"]]))
+				
+				previousSection.attributes()["endTime"] = turn.@startTime
+				turns[iTurn-1].attributes()["endTime"] = turn.@startTime
+				
+					def children = turn.children()
+					for (int i = 0 ; i < children.size() ; i++) {
+						def node = children[i]
+						if (node instanceof String) {
+							println "FIXING: $node "
+							children.remove(i)
+							i--
+						} else if (node instanceof groovy.util.Node && node.name() == "w" && node.text().contains(newSectionMarker)) {
+							println "FIXING: w $node "
+							children.remove(node)
+						}
 					}
-					
-					currentSection = found
-					currentNode = new Node(trsEpisode, "Section", currentSection[2])
-				}
 			}
+			
 			trsSection.remove(turn)
-			currentNode.append(turn)
+			currentSection.append(turn)
 		}
 		
-		//remove the initial section
-		trsEpisode.remove(trsSection)
-		
-		outputDirectory.mkdir()
-		File outfile = new File(outputDirectory, trsFile.getName())
+		resultDirectory.mkdir()
+		File outfile = new File(resultDirectory, trsFile.getName())
 		outfile.withWriter("UTF-8") { writer ->
 			writer.write('<?xml version="1.0" encoding="UTF-8"?>\n<!DOCTYPE Trans SYSTEM "trans-14.dtd">\n')
 			def printer = new groovy.util.XmlNodePrinter(new PrintWriter(writer))
@@ -129,7 +125,7 @@
 		}
 	}
 	cpb.done()
-	reader.close()
+	
 	println "Done."
 	
 } catch(Exception e) {
Index: tmp/org.txm.groovy.core/src/groovy/org/txm/macro/transcription/Vocapia2Transcriber.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/macro/transcription/Vocapia2Transcriber.groovy	(revision 3029)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/macro/transcription/Vocapia2Transcriber.groovy	(revision 3030)
@@ -40,6 +40,7 @@
 		def turninfos = new LinkedHashMap()
 		boolean other = false;
 		String word = ""
+		String duration = "0.0"
 		try {
 			
 			for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
@@ -84,11 +85,18 @@
 								writer.writeEndElement()
 								writer.writeCharacters("\n")
 								break;
+								
+							case "Channel":
+								duration = parser.getAttributeValue(null, "sigdur")
+								break;
 							
 							case "SegmentList":
 								writer.writeStartElement("Episode")
 							//<Section type="report" startTime="0" endTime="3617.593">
+								
 								writer.writeStartElement("Section")
+								writer.writeAttribute("startTime", "0.0")
+								writer.writeAttribute("endTime", duration)
 								for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
 									writer.writeAttribute(parser.getAttributeLocalName(i), parser.getAttributeValue(i))
 								}
Index: tmp/org.txm.groovy.core/src/groovy/org/txm/macro/projects/nov13/PrepareTranscriptionsMacro.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/macro/projects/nov13/PrepareTranscriptionsMacro.groovy	(revision 3029)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/macro/projects/nov13/PrepareTranscriptionsMacro.groovy	(revision 3030)
@@ -20,6 +20,9 @@
 		
 @Field @Option(name="nonPrimarySpeakerRegex", usage="other non primary id of the other turns", widget="String", required=false, def="")
 		String nonPrimarySpeakerRegex
+		
+@Field @Option(name="newSectionMarker", usage="section marker", widget="String", required=false, def="*#")
+		String newSectionMarker
 
 @Field @Option(name="debug", usage="speaker ID of the primary speaker", widget="Boolean", required=false, def="false")
 		Boolean debug
@@ -39,6 +42,7 @@
 gse.runMacro(org.txm.macro.transcription.Vocapia2TranscriberMacro, ["vocapiaDirectory":vocapiaDirectory, "resultDirectory":trsDirectory])
 
 
+println "DETECTING MARKED SECTIONS..."
 
 trsFiles = trsDirectory.listFiles().findAll(){it.getName().toLowerCase().endsWith(".trs")}
 if (trsFiles.size() == 0) {
@@ -46,10 +50,22 @@
 	return false
 }
 
+File sectionsDirectory = new File(resultDirectory, "sections")
+sectionsDirectory.mkdir()
+gse.runMacro(org.txm.macro.transcription.SegmentTRSInSectionFromMarkerMacro, ["trsDirectory":trsDirectory, "resultDirectory":sectionsDirectory, "newSectionMarker":newSectionMarker])
+
+
 println "CREATE THE 'OTHER' TURNS..."
+
+trsFiles = sectionsDirectory.listFiles().findAll(){it.getName().toLowerCase().endsWith(".trs")}
+if (trsFiles.size() == 0) {
+	println "No XML file found in $sectionsDirectory"
+	return false
+}
+
 File otherDirectory = new File(resultDirectory, "otherturns")
 otherDirectory.mkdir()
-ConsoleProgressBar cpb = new ConsoleProgressBar(trsFiles.size())
+cpb = new ConsoleProgressBar(trsFiles.size())
 for (File file : trsFiles) {
 	cpb.tick()
 	
@@ -63,14 +79,15 @@
 }
 cpb.done()
 
+
+println "NORMALIZING LOCUTORS..."
+
 trsFiles = otherDirectory.listFiles().findAll(){it.getName().toLowerCase().endsWith(".trs")}
 if (trsFiles.size() == 0) {
 	println "No XML file found in $otherDirectory"
 	return false
 }
 
-// FIX LOCUTORS
-println "NORMALIZING LOCUTORS..."
 cpb = new ConsoleProgressBar(trsFiles.size())
 for (File file : trsFiles) {
 	cpb.tick()
