Dependency fix + Local/Remote Library support
[fanfix.git] / src / be / nikiroo / fanfix / reader / TuiReader.java
1 package be.nikiroo.fanfix.reader;
2
3 import java.io.IOException;
4 import java.util.List;
5
6 import be.nikiroo.fanfix.Instance;
7 import be.nikiroo.fanfix.LocalLibrary;
8 import be.nikiroo.fanfix.data.MetaData;
9
10 class TuiReader extends BasicReader {
11 @Override
12 public void read() throws IOException {
13 if (getStory() == null) {
14 throw new IOException("No story to read");
15 }
16
17 open(getLibrary(), getStory().getMeta().getLuid());
18 }
19
20 @Override
21 public void read(int chapter) throws IOException {
22 // TODO: show a special page?
23 read();
24 }
25
26 @Override
27 public void browse(String source) {
28 List<MetaData> stories = getLibrary().getListBySource(source);
29 try {
30 TuiReaderApplication app = new TuiReaderApplication(stories, this);
31 new Thread(app).start();
32 } catch (Exception e) {
33 Instance.syserr(e);
34 }
35 }
36 }