Dependency fix + Local/Remote Library support
[fanfix.git] / src / be / nikiroo / fanfix / reader / TuiReader.java
CommitLineData
c1873e56
NR
1package be.nikiroo.fanfix.reader;
2
3import java.io.IOException;
4import java.util.List;
5
6import be.nikiroo.fanfix.Instance;
68e2c6d2 7import be.nikiroo.fanfix.LocalLibrary;
c1873e56
NR
8import be.nikiroo.fanfix.data.MetaData;
9
10class 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
b0e88ebd 17 open(getLibrary(), getStory().getMeta().getLuid());
c1873e56
NR
18 }
19
20 @Override
21 public void read(int chapter) throws IOException {
22 // TODO: show a special page?
23 read();
24 }
25
26 @Override
b0e88ebd
NR
27 public void browse(String source) {
28 List<MetaData> stories = getLibrary().getListBySource(source);
c1873e56
NR
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}