![Main GUI](screenshots/fanfix.png?raw=true "Main GUI")
-It will convert from a (supported) URL to an .epub file for stories or a .cbz file for comics (a few other output types are also available, like Plain Text or LaTeX).
+It will convert from a (supported) URL to an .epub file for stories or a .cbz file for comics (a few other output types are also available, like Plain Text, LaTeX, HTML...).
To help organize your stories, it can also work as a local library.
In this mode, you can:
-- Import a story from its URL (or even another file)
-- Export a story to a file (.epub or .cbz)
+- Import a story from its URL (or just from a file)
+- Export a story to a file (in any of the supported output types)
- Display a story from the local library in text format in the console
- Display a story from the local library graphically **by calling a native program to handle it** (though Fanfix can automatically process it into HTML so any browser can open it)
- a cover image may be present with the same filename as the story, but a .png, .jpeg or .jpg extension
- info_text: contains the same information as the text format, but with a companion .info file to store some metadata (the .info file is supposed to be created by Fanfix or compatible with it)
- cbz: .cbz (collection of images) files, preferably created with Fanfix (but any .cbz file is supported, though without most of Fanfix metadata, obviously)
+- html: HTML files that you can open with any browser; note that it will create a directory structure with ```index.html``` being the file you need to open (or select if you want to convert it into something else) -- we only support importing HTML files created by Fanfix or compatible
## Supported platforms
- ```--read [id] ([chapter number])```: read the given story denoted by ID from the library
- ```--read-url [URL] ([chapter number])```: convert on the fly and read the story denoted by ID, without saving it
- ```--list```: list the stories present in the library and their associated IDs
-- ```--set-reader [reader type]```: set the reader type to CLI or LOCAL for this command
+- ```--set-reader [reader type]```: set the reader type to CLI or LOCAL for this command (must be the first option)
- ```--help```: display the available options
### Environment variables
target.mkdir();
dir = target;
+ // write a copy of the originals inside
+ InfoCover.writeInfo(dir, targetName, story.getMeta());
+ InfoCover.writeCover(dir, targetName, story.getMeta());
+ new InfoText().process(story, dir, targetNameOrig);
+
target = new File(targetDir, targetName + getDefaultExtension(true));
-
+
writer = new BufferedWriter(new OutputStreamWriter(
new FileOutputStream(target), "UTF-8"));
try {
public void run() {
if (!ok) {
JOptionPane.showMessageDialog(
- LocalReaderFrame.this,
+ LocalReaderFrame.this, e.getMessage(),
"Cannot import: " + url,
- e.getMessage(),
JOptionPane.ERROR_MESSAGE);
} else {
refreshBooks(type);
/** Furry website with comics support */
E621,
/** CBZ files */
- CBZ;
+ CBZ,
+ /** HTML files */
+ HTML;
/**
* A description of this support type (more information than the
*/
protected Story processMeta(URL url, boolean close, boolean getDesc)
throws IOException {
- in = Instance.getCache().open(url, this, false);
+ in = openInput(url);
if (in == null) {
return null;
}
return url;
}
+ /**
+ * Open the input file that will be used through the support.
+ *
+ * @param source
+ * the source {@link URL}
+ *
+ * @return the {@link InputStream}
+ *
+ * @throws IOException
+ * in case of I/O error
+ */
+ protected InputStream openInput(URL source) throws IOException {
+ return Instance.getCache().open(source, this, false);
+ }
+
protected InputStream reset(InputStream in) {
try {
in.reset();
}
}
- for (SupportType type : new SupportType[] { SupportType.TEXT,
- SupportType.INFO_TEXT }) {
+ for (SupportType type : new SupportType[] { SupportType.INFO_TEXT,
+ SupportType.TEXT }) {
BasicSupport support = getSupport(type);
if (support != null && support.supports(url)) {
return support;
return new E621().setType(type);
case CBZ:
return new Cbz().setType(type);
+ case HTML:
+ return new Html().setType(type);
}
return null;
import java.util.Map.Entry;
import java.util.Scanner;
-import javax.imageio.ImageIO;
-
import be.nikiroo.fanfix.Instance;
import be.nikiroo.fanfix.data.MetaData;
import be.nikiroo.utils.IOUtils;