Statistics
| Revision:

root / tmp / org.txm.groovy.core / src / groovy / org / txm / macro / transcription / TextTranscription2TRSMacro.groovy @ 499

History | View | Annotate | Download (1.7 kB)

1 321 mdecorde
// Copyright © 2010-2013 ENS de Lyon.
2 321 mdecorde
// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
3 321 mdecorde
// Lyon 2, University of Franche-Comté, University of Nice
4 321 mdecorde
// Sophia Antipolis, University of Paris 3.
5 321 mdecorde
//
6 321 mdecorde
// The TXM platform is free software: you can redistribute it
7 321 mdecorde
// and/or modify it under the terms of the GNU General Public
8 321 mdecorde
// License as published by the Free Software Foundation,
9 321 mdecorde
// either version 2 of the License, or (at your option) any
10 321 mdecorde
// later version.
11 321 mdecorde
//
12 321 mdecorde
// The TXM platform is distributed in the hope that it will be
13 321 mdecorde
// useful, but WITHOUT ANY WARRANTY; without even the implied
14 321 mdecorde
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 321 mdecorde
// PURPOSE. See the GNU General Public License for more
16 321 mdecorde
// details.
17 321 mdecorde
//
18 321 mdecorde
// You should have received a copy of the GNU General
19 321 mdecorde
// Public License along with the TXM platform. If not, see
20 321 mdecorde
// http://www.gnu.org/licenses.
21 321 mdecorde
22 321 mdecorde
package org.txm.macro.transcription
23 321 mdecorde
24 321 mdecorde
import org.kohsuke.args4j.*
25 321 mdecorde
26 321 mdecorde
import groovy.transform.Field
27 321 mdecorde
28 499 mdecorde
import org.txm.rcp.swt.widget.parameters.*
29 321 mdecorde
30 321 mdecorde
31 321 mdecorde
@Field @Option(name="odtDir", usage="Dossier qui contient les fichiers ODT", widget="Folder", required=true, def="")
32 321 mdecorde
File odtDir;
33 321 mdecorde
34 321 mdecorde
@Field @Option(name="debug", usage="Don't clean files, 'y' to enable debug", widget="String", required=false, def="n")
35 321 mdecorde
def debug = "n";
36 321 mdecorde
37 321 mdecorde
if (!ParametersDialog.open(this)) return;
38 321 mdecorde
39 321 mdecorde
File outDir = new File(odtDir, "out") // write result in "out" folder
40 321 mdecorde
41 321 mdecorde
outDir.deleteDir()
42 321 mdecorde
outDir.mkdir()
43 321 mdecorde
44 321 mdecorde
println "out: $outDir"
45 321 mdecorde
println "odtDir: $odtDir"
46 321 mdecorde
47 321 mdecorde
println "DEBUG: "+("y" == debug || "yes" == debug)
48 321 mdecorde
49 321 mdecorde
if (!odtDir.exists()) {
50 321 mdecorde
        println "$odtDir does not exists. Aborting"
51 321 mdecorde
}
52 321 mdecorde
def monitor = null
53 321 mdecorde
TextTranscription2TRS trs = new TextTranscription2TRS(outDir, "y" == debug, monitor)
54 321 mdecorde
trs.process(odtDir)