X-Git-Url: http://git.nikiroo.be/?p=nikiroo-utils.git;a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Fsupported%2FText.java;h=2f614fca83529ea1f5e7ae27f08706c4963089e9;hp=cba23bf8c2f1815d2eddba3ff611ed1951b9e4b6;hb=8d59ce0748baeeea0458bab49716ab4543aae439;hpb=81b5e730677858a7e9c9fc6f2f8f7992a4b8b1c3 diff --git a/src/be/nikiroo/fanfix/supported/Text.java b/src/be/nikiroo/fanfix/supported/Text.java index cba23bf..2f614fc 100644 --- a/src/be/nikiroo/fanfix/supported/Text.java +++ b/src/be/nikiroo/fanfix/supported/Text.java @@ -1,7 +1,6 @@ package be.nikiroo.fanfix.supported; import java.io.File; -import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.net.URISyntaxException; @@ -19,8 +18,8 @@ import be.nikiroo.fanfix.bundles.Config; import be.nikiroo.fanfix.data.MetaData; import be.nikiroo.utils.Image; import be.nikiroo.utils.ImageUtils; -import be.nikiroo.utils.MarkableFileInputStream; import be.nikiroo.utils.Progress; +import be.nikiroo.utils.streams.MarkableFileInputStream; /** * Support class for local stories encoded in textual format, with a few rules: @@ -67,16 +66,11 @@ class Text extends BasicSupport { return false; } - @Override - public String getSourceName() { - return "text"; - } - @Override protected Document loadDocument(URL source) throws IOException { try { sourceFile = new File(source.toURI()); - in = new MarkableFileInputStream(new FileInputStream(sourceFile)); + in = new MarkableFileInputStream(sourceFile); } catch (URISyntaxException e) { throw new IOException("Cannot load the text document: " + source); } @@ -92,7 +86,7 @@ class Text extends BasicSupport { meta.setAuthor(getAuthor()); meta.setDate(getDate()); meta.setTags(new ArrayList()); - meta.setSource(getSourceName()); + meta.setSource(getType().getSourceName()); meta.setUrl(getSourceFile().toURI().toURL().toString()); meta.setPublisher(""); meta.setUuid(getSourceFile().toString()); @@ -152,7 +146,7 @@ class Text extends BasicSupport { author = authorDate.substring(0, pos); } - return BasicSupportHelper.fixAuthor(author); + return bsHelper.fixAuthor(author); } private String getDate() { @@ -189,7 +183,7 @@ class Text extends BasicSupport { } } - Image cover = BasicSupportImages.getImage(this, + Image cover = bsImages.getImage(this, sourceFile.getParentFile(), path); if (cover != null) { try { @@ -336,9 +330,8 @@ class Text extends BasicSupport { */ static private String detectChapter(String line, int number) { line = line.toUpperCase(); - for (String lang : Instance.getConfig().getString(Config.CHAPTER) - .split(",")) { - String chapter = Instance.getConfig().getStringX(Config.CHAPTER, + for (String lang : Instance.getConfig().getList(Config.CONF_CHAPTER)) { + String chapter = Instance.getConfig().getStringX(Config.CONF_CHAPTER, lang); if (chapter != null && !chapter.isEmpty()) { chapter = chapter.toUpperCase() + " ";