1 package be
.nikiroo
.fanfix
.reader
;
3 import java
.awt
.EventQueue
;
5 import java
.io
.IOException
;
7 import be
.nikiroo
.fanfix
.Instance
;
8 import be
.nikiroo
.fanfix
.Library
;
9 import be
.nikiroo
.fanfix
.bundles
.Config
;
10 import be
.nikiroo
.fanfix
.data
.MetaData
;
11 import be
.nikiroo
.fanfix
.data
.Story
;
12 import be
.nikiroo
.fanfix
.output
.BasicOutput
.OutputType
;
14 class LocalReader
extends BasicReader
{
17 public LocalReader() throws IOException
{
18 File dir
= Instance
.getReaderDir();
21 throw new IOException(
22 "Cannote create cache directory for local reader: " + dir
);
25 // TODO: can throw an exception, manage that (convert to IOEx ?)
26 OutputType text
= OutputType
.valueOfNullOkUC(Instance
.getConfig()
27 .getString(Config
.LOCAL_READER_NON_IMAGES_DOCUMENT_TYPE
));
29 text
= OutputType
.HTML
;
32 OutputType images
= OutputType
.valueOfNullOkUC(Instance
.getConfig()
33 .getString(Config
.LOCAL_READER_IMAGES_DOCUMENT_TYPE
));
35 images
= OutputType
.CBZ
;
39 lib
= new Library(dir
, text
, images
);
43 public void read() throws IOException
{
47 public void read(int chapter
) {
51 public String
imprt(String luid
) {
53 Story story
= Instance
.getLibrary().getStory(luid
);
54 story
= lib
.save(story
);
55 return story
.getMeta().getLuid();
56 } catch (IOException e
) {
57 Instance
.syserr(new IOException(
58 "Cannot import story from library to LocalReader library: "
65 public File
getTarget(String luid
) {
66 MetaData meta
= lib
.getInfo(luid
);
67 File file
= lib
.getFile(luid
);
70 file
= lib
.getFile(luid
);
71 meta
= lib
.getInfo(luid
);
78 public void start(String type
) {
79 final String typeFinal
= type
;
80 EventQueue
.invokeLater(new Runnable() {
82 new LocalReaderFrame(LocalReader
.this, typeFinal
)