X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;ds=sidebyside;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Freader%2FCliReader.java;h=96ca64405bf7ced80bbb8b9c334119352acc1399;hb=1387a30ab59dbf4071f2c5e5e0e08ca98c75b726;hp=8a45885646cde715febce086981272157c04997c;hpb=bc2ea776b67cabcbdcbbc6d8a4e2df1aafa9101a;p=fanfix.git diff --git a/src/be/nikiroo/fanfix/reader/CliReader.java b/src/be/nikiroo/fanfix/reader/CliReader.java deleted file mode 100644 index 8a45885..0000000 --- a/src/be/nikiroo/fanfix/reader/CliReader.java +++ /dev/null @@ -1,95 +0,0 @@ -package be.nikiroo.fanfix.reader; - -import java.io.IOException; -import java.util.List; - -import be.nikiroo.fanfix.Instance; -import be.nikiroo.fanfix.bundles.StringId; -import be.nikiroo.fanfix.data.Chapter; -import be.nikiroo.fanfix.data.MetaData; -import be.nikiroo.fanfix.data.Paragraph; -import be.nikiroo.fanfix.data.Story; - -/** - * Command line {@link Story} reader. - *
- * Will output stories to the console.
- *
- * @author niki
- */
-class CliReader extends BasicReader {
- public void read() throws IOException {
- MetaData meta = getMeta();
-
- if (meta == null) {
- throw new IOException("No story to read");
- }
-
- String title = "";
- String author = "";
-
- if (meta.getTitle() != null) {
- title = meta.getTitle();
- }
-
- if (meta.getAuthor() != null) {
- author = "©" + meta.getAuthor();
- if (meta.getDate() != null && !meta.getDate().isEmpty()) {
- author = author + " (" + meta.getDate() + ")";
- }
- }
-
- System.out.println(title);
- System.out.println(author);
- System.out.println("");
-
- // TODO: progress?
- for (Chapter chap : getStory(null)) {
- if (chap.getName() != null && !chap.getName().isEmpty()) {
- System.out.println(Instance.getTrans().getString(
- StringId.CHAPTER_NAMED, chap.getNumber(),
- chap.getName()));
- } else {
- System.out.println(Instance.getTrans().getString(
- StringId.CHAPTER_UNNAMED, chap.getNumber()));
- }
- }
- }
-
- public void read(int chapter) throws IOException {
- MetaData meta = getMeta();
-
- if (meta == null) {
- throw new IOException("No story to read");
- }
-
- // TODO: progress?
- if (chapter > getStory(null).getChapters().size()) {
- System.err.println("Chapter " + chapter + ": no such chapter");
- } else {
- Chapter chap = getStory(null).getChapters().get(chapter - 1);
- System.out.println("Chapter " + chap.getNumber() + ": "
- + chap.getName());
-
- for (Paragraph para : chap) {
- System.out.println(para.getContent());
- System.out.println("");
- }
- }
- }
-
- public void browse(String source) {
- List