Revision 2288 tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZImport.groovy

XTZImport.groovy (revision 2288)
8 8

  
9 9
import org.eclipse.core.runtime.IProgressMonitor;
10 10
import org.txm.utils.xml.DomUtils;
11
import org.txm.core.preferences.TBXPreferences;
11 12
import org.txm.metadatas.Metadatas
12 13
import org.txm.utils.io.FileCopy;
13 14
import org.txm.*
......
43 44
			return super.getTXMFilesOrder();
44 45
		}
45 46
		Metadatas metadata = importer.getMetadata();
47
		if (metadata == null) { // if metadata was not built, try building it
48
			File allMetadataFile = Metadatas.findMetadataFile(binaryDirectory);
49
			if (allMetadataFile.exists()) {
50
				metadata = new Metadatas(allMetadataFile,
51
						Toolbox.getPreference(TBXPreferences.METADATA_ENCODING),
52
						Toolbox.getPreference(TBXPreferences.METADATA_COLSEPARATOR),
53
						Toolbox.getPreference(TBXPreferences.METADATA_TXTSEPARATOR), 1)
54
			}
55
		}
56
		
46 57
		if (metadata == null) {
47 58
			println "no metadata, using default text order"
48 59
			return super.getTXMFilesOrder();
49 60
		}
61
		
50 62
		File txmDirectory = new File(binaryDirectory, "txm/"+corpusName);
51 63
		ArrayList<File> files = new ArrayList<File>(Arrays.asList(txmDirectory.listFiles(new FileFilter() {
52 64
			@Override
......
61 73
			def ti = metadata.get(t)
62 74
			for (org.txm.metadatas.Entry e : ti) {
63 75
				if ("textorder".equals(e.getId())) {
64
					textorder[t] = ti.get("textorder")
76
					textorder[t] = ti.value()
65 77
				}
66 78
			}
67 79
		}
......
86 98
			}
87 99
		});
88 100
		//println files
89
		return files;
101
		return texts;
90 102
	}
91 103
	
92 104
	public void start() throws InterruptedException {

Also available in: Unified diff