Code cleanup: Libraries/Readers
[nikiroo-utils.git] / src / be / nikiroo / fanfix / reader / CliReader.java
index b3dd3edc79300b28c2ea779c91c887bbbbd9d704..de55bf9b06a8a033662037c14cb412f1615844e1 100644 (file)
@@ -9,7 +9,6 @@ import be.nikiroo.fanfix.data.Chapter;
 import be.nikiroo.fanfix.data.MetaData;
 import be.nikiroo.fanfix.data.Paragraph;
 import be.nikiroo.fanfix.data.Story;
-import be.nikiroo.fanfix.supported.BasicSupport.SupportType;
 
 /**
  * Command line {@link Story} reader.
@@ -19,7 +18,6 @@ import be.nikiroo.fanfix.supported.BasicSupport.SupportType;
  * @author niki
  */
 class CliReader extends BasicReader {
-       @Override
        public void read() throws IOException {
                if (getStory() == null) {
                        throw new IOException("No story to read");
@@ -58,8 +56,11 @@ class CliReader extends BasicReader {
                }
        }
 
-       @Override
-       public void read(int chapter) {
+       public void read(int chapter) throws IOException {
+               if (getStory() == null) {
+                       throw new IOException("No story to read");
+               }
+
                if (chapter > getStory().getChapters().size()) {
                        System.err.println("Chapter " + chapter + ": no such chapter");
                } else {
@@ -74,10 +75,9 @@ class CliReader extends BasicReader {
                }
        }
 
-       @Override
-       public void start(SupportType type) {
+       public void browse(String source) {
                List<MetaData> stories;
-               stories = Instance.getLibrary().getList(type);
+               stories = getLibrary().getListBySource(source);
 
                for (MetaData story : stories) {
                        String author = "";