Search in sources :

Example 1 with ImportFormat

use of biblemulticonverter.format.ImportFormat in project BibleMultiConverter by schierlm.

the class ParatextConverter method run.

@Override
public void run(String... args) throws Exception {
    Module<ImportFormat> importModule = Main.importFormats.get(args[0]);
    Module<ExportFormat> exportModule = Main.exportFormats.get(args[2]);
    AbstractParatextFormat importFormat = (AbstractParatextFormat) importModule.getImplementationClass().newInstance();
    AbstractParatextFormat exportFormat = (AbstractParatextFormat) exportModule.getImplementationClass().newInstance();
    List<ParatextBook> books = importFormat.doImportBooks(new File(args[1]));
    exportFormat.doExportBooks(books, Arrays.copyOfRange(args, 3, args.length));
}
Also used : AbstractParatextFormat(biblemulticonverter.format.paratext.AbstractParatextFormat) ParatextBook(biblemulticonverter.format.paratext.ParatextBook) ExportFormat(biblemulticonverter.format.ExportFormat) File(java.io.File) ImportFormat(biblemulticonverter.format.ImportFormat)

Example 2 with ImportFormat

use of biblemulticonverter.format.ImportFormat in project BibleMultiConverter by schierlm.

the class Main method main.

public static void main(String[] args) throws Exception {
    discoverModules();
    if (args.length > 0) {
        Module<Tool> toolModule = tools.get(args[0]);
        if (toolModule != null) {
            toolModule.getImplementationClass().newInstance().run(Arrays.copyOfRange(args, 1, args.length));
            return;
        }
    }
    if (args.length > 2) {
        Module<ImportFormat> importModule = importFormats.get(args[0]);
        Module<ExportFormat> exportModule = exportFormats.get(args[2]);
        if (importModule != null && exportModule != null) {
            Bible bible = importModule.getImplementationClass().newInstance().doImport(new File(args[1]));
            exportModule.getImplementationClass().newInstance().doExport(bible, Arrays.copyOfRange(args, 3, args.length));
            return;
        }
    }
    System.out.println("Usage:");
    System.out.println("java -jar BibleMultiConverter.jar <ImportFormat> <ImportFile> <ExportFormat> [<ExportArgs>...]");
    System.out.println("java -jar BibleMultiConverter.jar <Tool> [<ToolArgs>...]");
    printModules("import formats", importFormats);
    printModules("export formats", exportFormats);
    printModules("versification formats", versificationFormats);
    printModules("tools", tools);
}
Also used : Bible(biblemulticonverter.data.Bible) ExportFormat(biblemulticonverter.format.ExportFormat) File(java.io.File) Tool(biblemulticonverter.tools.Tool) ImportFormat(biblemulticonverter.format.ImportFormat)

Aggregations

ExportFormat (biblemulticonverter.format.ExportFormat)2 ImportFormat (biblemulticonverter.format.ImportFormat)2 File (java.io.File)2 Bible (biblemulticonverter.data.Bible)1 AbstractParatextFormat (biblemulticonverter.format.paratext.AbstractParatextFormat)1 ParatextBook (biblemulticonverter.format.paratext.ParatextBook)1 Tool (biblemulticonverter.tools.Tool)1